diff options
| author | Alexander Pickering <Alexander.Pickering@anondomain.site90.net> | 2016-03-05 12:52:18 -0500 |
|---|---|---|
| committer | Alexander Pickering <Alexander.Pickering@anondomain.site90.net> | 2016-03-05 12:52:18 -0500 |
| commit | f3bd5b0c7a3f340d48962d7c6701645b5fb734b6 (patch) | |
| tree | cfbfc3535d5b9764200653bf000dd0f45de68b03 | |
| parent | 52cf408ce832952c92804e114746b1e427576a8e (diff) | |
| download | wintersurvival2-f3bd5b0c7a3f340d48962d7c6701645b5fb734b6.tar.gz wintersurvival2-f3bd5b0c7a3f340d48962d7c6701645b5fb734b6.tar.bz2 wintersurvival2-f3bd5b0c7a3f340d48962d7c6701645b5fb734b6.zip | |
Temporary fix for teleport spell
| -rw-r--r-- | entities/entities/ws_teleporter/init.lua | 24 | ||||
| -rw-r--r-- | entities/entities/ws_teleporter/shared.lua | 6 | ||||
| -rw-r--r-- | gamemode/itemsystem/items/spell_teleport.lua | 11 |
3 files changed, 31 insertions, 10 deletions
diff --git a/entities/entities/ws_teleporter/init.lua b/entities/entities/ws_teleporter/init.lua index 08d73f5..f364cac 100644 --- a/entities/entities/ws_teleporter/init.lua +++ b/entities/entities/ws_teleporter/init.lua @@ -7,10 +7,24 @@ function ENT:Initialize() self:PhysicsInit(SOLID_VPHYSICS) self:SetMoveType(MOVETYPE_NONE) self:SetSolid(SOLID_VPHYSICS) - if(self.model) then - self:SetModel(self.model) - else - print("Teleporter constructed without model!, this might be an error!") + self:DrawShadow(false) + + local phys = self:GetPhysicsObject() + phys:EnableMotion(false) + phys:Sleep() + + self:SetHealth(30) + + self.HP = 500 + self.MaxHP = self.HP +end + +function ENT:OnTakeDamage(dmginfo) + self.HP = self.HP-dmginfo:GetDamage() + local newcolor = (self.HP/self.MaxHP)*255 + self:SetColor(Color(newcolor,newcolor,newcolor)) + if (self.HP <= 0) then + self:EmitSound(Sound("physics/wood/wood_plank_break"..math.random(1,4)..".wav")) + self:Remove() end - if (!self.Item) then self:Remove() end end diff --git a/entities/entities/ws_teleporter/shared.lua b/entities/entities/ws_teleporter/shared.lua index 000ebf6..3899060 100644 --- a/entities/entities/ws_teleporter/shared.lua +++ b/entities/entities/ws_teleporter/shared.lua @@ -3,14 +3,18 @@ ENT.Base = "base_anim" function ENT:OnRemove() end - +--[[ function ENT:PhysicsCollide(data, phys) print("We're collideing!") if(self.endpoint) then if(data.HitEntity:IsPlayer()) then + print("Hit entity was player!") data.HitEntity:SetPos(self.endpoint) + else + print("Hit entity was not player!") end else print("Teleporter without endpoint, this might be an error!") end end +]]-- diff --git a/gamemode/itemsystem/items/spell_teleport.lua b/gamemode/itemsystem/items/spell_teleport.lua index 6294955..4faed17 100644 --- a/gamemode/itemsystem/items/spell_teleport.lua +++ b/gamemode/itemsystem/items/spell_teleport.lua @@ -32,31 +32,34 @@ function ITEM:DoTeleport(score,pl,self) local aim = pl:GetAimVector() local D = ents.Create("ws_teleporter") - - D:SetPos(pl:GetShootPos()+aim*200) D:SetOwner(pl) D:SetAngles(aim:Angle()) - D:Spawn() D.endpoint = self.savedpoint + D:Spawn() + D:Activate() pl:EmitSound(Sound("physics/flesh/flesh_impact_hard.wav"),100,math.random(90,110)) end local teleportfunc = function(score, pl, self) print("teleportfunc called!") if(self.savedpoint == nil) then return end + if(score != 100) then return end print("Fully successfull teleport callback:") print(pl) + pl:SetPos(self.savedpoint) + --[[ local aim = pl:GetAimVector() local D = ents.Create("ws_teleporter") - + D:SetModel("models/props_wasteland/wood_fence02a.mdl") D:SetPos(pl:GetShootPos()+aim*200) D:SetOwner(pl) D:SetAngles(aim:Angle()) D:Spawn() D.endpoint = self.savedpoint + ]]-- pl:EmitSound(Sound("physics/flesh/flesh_impact_hard.wav"),100,math.random(90,110)) end |
