diff options
| author | Alexander Pickering <alexandermpickering@gmail.com> | 2016-05-25 22:40:09 -0400 |
|---|---|---|
| committer | Alexander Pickering <alexandermpickering@gmail.com> | 2016-05-25 22:40:09 -0400 |
| commit | f797cbe348dd52b51da4cd4812cfa291d1434095 (patch) | |
| tree | df4fabacfc6819a981d750c510122f5bbda8083c /entities/weapons | |
| parent | a5932d386488030b6005c829fe343f74daed9893 (diff) | |
| parent | fd04cb695e1c0e6597456f2b1b7b076310fd81bf (diff) | |
| download | gmstranded-f797cbe348dd52b51da4cd4812cfa291d1434095.tar.gz gmstranded-f797cbe348dd52b51da4cd4812cfa291d1434095.tar.bz2 gmstranded-f797cbe348dd52b51da4cd4812cfa291d1434095.zip | |
Merge branch 'structsystem'hotfix
Diffstat (limited to 'entities/weapons')
| -rw-r--r-- | entities/weapons/gms_wand.lua | 40 |
1 files changed, 22 insertions, 18 deletions
diff --git a/entities/weapons/gms_wand.lua b/entities/weapons/gms_wand.lua index cd71e2c..724b5d9 100644 --- a/entities/weapons/gms_wand.lua +++ b/entities/weapons/gms_wand.lua @@ -20,10 +20,14 @@ function SWEP:Initialize() end function SWEP:PrimaryAttack() - ParticleEffectAttach( "vortigaunt_hand_glow_c", PATTACH_ABSORIGIN_FOLLOW, self, 0 ) + if(SERVER) then + //if !(self:IsCarriedByLocalPlayer()) then return end + //ParticleEffectAttach( "vortigaunt_hand_glow_c", PATTACH_ABSORIGIN_FOLLOW, self, 0 ) + //ParticleEffect("vortigaunt_hand_glow_c",self.Owner:GetPos() + Vector(0,0,64),self:GetAngles(),self) + end //ParticleEffectAttach("vortigaunt_hand_glow_c",PATTACH_ABSORIGIN_FOLLOW,self,0) self:throw_attack("models/props/cs_office/Chair_office.mdl") - + end local ShootSound = Sound("Metal.SawbladeStick") @@ -31,46 +35,46 @@ local ShootSound = Sound("Metal.SawbladeStick") function SWEP:throw_attack (model_file) //Get an eye trace. This basically draws an invisible line from - //the players eye. This SWep makes very little use of the trace, except to + //the players eye. This SWep makes very little use of the trace, except to //calculate the amount of force to apply to the object thrown. local tr = self.Owner:GetEyeTrace() - + //Play some noises/effects using the sound we precached earlier self:EmitSound(ShootSound) self.BaseClass.ShootEffects(self) - + //We now exit if this function is not running serverside if (!SERVER) then return end - + //The next task is to create a physics prop based on the supplied model local ent = ents.Create("prop_physics") ent:SetModel(model_file) - - + + //Set the initial position and angles of the object. This might need some fine tuning; //but it seems to work for the models I have tried. ent:SetPos(self.Owner:EyePos() + (self.Owner:GetAimVector() * 16)) ent:SetAngles(self.Owner:EyeAngles()) - + ent:Spawn() - + ParticleEffectAttach( "vortigaunt_hand_glow_c", PATTACH_ABSORIGIN_FOLLOW, ent, 0 ) - - + + //Now we need to get the physics object for our entity so we can apply a force to it local phys = ent:GetPhysicsObject() - + //Check if the physics object is valid. If not, remove the entity and stop the function if !(phys && IsValid(phys)) then ent:Remove() return end - - //Time to apply the force. My method for doing this was almost entirely empirical + + //Time to apply the force. My method for doing this was almost entirely empirical //and it seems to work fairly intuitively with chairs. phys:ApplyForceCenter(self.Owner:GetAimVector():GetNormalized() * math.pow(tr.HitPos:Length(), 3)) - - + + //Now for the important part of adding the spawned objects to the undo and cleanup lists. cleanup.Add(self.Owner, "props", ent) - + undo.Create ("Thrown_SWEP_Entity") undo.AddEntity (ent) undo.SetPlayer (self.Owner) |
