diff options
| -rw-r--r-- | entities/entities/ws_teleporter/init.lua | 36 | ||||
| -rw-r--r-- | entities/entities/ws_teleporter/shared.lua | 3 | ||||
| -rw-r--r-- | gamemode/itemsystem/items/spell_teleport.lua | 60 |
3 files changed, 68 insertions, 31 deletions
diff --git a/entities/entities/ws_teleporter/init.lua b/entities/entities/ws_teleporter/init.lua index f364cac..eee04d7 100644 --- a/entities/entities/ws_teleporter/init.lua +++ b/entities/entities/ws_teleporter/init.lua @@ -4,14 +4,40 @@ AddCSLuaFile("shared.lua") include('shared.lua') function ENT:Initialize() + self:SetModel("models/hunter/tubes/circle2x2.mdl") + self:PhysicsInit(SOLID_VPHYSICS) - self:SetMoveType(MOVETYPE_NONE) + self:SetMoveType(MOVETYPE_VPHYSICS) self:SetSolid(SOLID_VPHYSICS) - self:DrawShadow(false) + -- self:SetCollisionGroup(COLLISION_GROUP_INTERACTIVE) + self:PhysWake() + self:SetMaterial("models/shadertest/shader3") - local phys = self:GetPhysicsObject() - phys:EnableMotion(false) - phys:Sleep() + timer.Simple(0,function() + local phys = self:GetPhysicsObject() + if IsValid(phys) then + phys:EnableMotion(false) + else + print("Failed to disable motion") + end + end) + + timer.Simple(20,function() + local exp = ents.Create("env_explosion") + exp:SetPos(self:GetPos()) + exp:Fire("Explode","",0) + exp:Spawn() + for k,v in pairs(ents.FindInSphere(self:GetPos(),200)) do + if v.TakeDamage then + local dmg = (200 - v:GetPos():Distance(self:GetPos())) / 2 + v:TakeDamage(dmg,nil,self) + end + end + + self.Remove(self) + end) + + --phys:Sleep() self:SetHealth(30) diff --git a/entities/entities/ws_teleporter/shared.lua b/entities/entities/ws_teleporter/shared.lua index 3899060..0d902fb 100644 --- a/entities/entities/ws_teleporter/shared.lua +++ b/entities/entities/ws_teleporter/shared.lua @@ -3,7 +3,7 @@ ENT.Base = "base_anim" function ENT:OnRemove() end ---[[ + function ENT:PhysicsCollide(data, phys) print("We're collideing!") if(self.endpoint) then @@ -17,4 +17,3 @@ function ENT:PhysicsCollide(data, phys) 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 38bbac6..e86f388 100644 --- a/gamemode/itemsystem/items/spell_teleport.lua +++ b/gamemode/itemsystem/items/spell_teleport.lua @@ -10,6 +10,15 @@ ITEM.HoldType = "magic" game.AddParticles("particles/particletest.pcf") PrecacheParticleSystem("firetest") +ITEM.Structure = { + { + Bone = "ValveBiped.Bip01_R_Hand", + Model = "models/props_junk/Rock001a.mdl", + Size = Vector(1,1,1), + Pos = Vector(0,0,0), + Ang = Angle(0,0,0), + }, +} ITEM.Recipe = { Resources = { @@ -21,6 +30,7 @@ ITEM.Recipe = { } ITEM.CD = 0.25 +ITEM.Range = 9999 --[[ All saved points are stored in a global table where @@ -37,39 +47,39 @@ function ITEM:DoTeleport(score,pl,self) local D = ents.Create("ws_teleporter") D:SetPos(pl:GetShootPos() + aim * 200) - D:SetOwner(pl) + -- D:SetOwner(pl) D:SetAngles(aim:Angle()) D.endpoint = savedpoint[pl] 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 ITEM.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 +-- local teleportfunc = function(score, pl, self) +-- print("teleportfunc called!") +-- if ITEM.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 - pl:EmitSound(Sound("physics/flesh/flesh_impact_hard.wav"),100,math.random(90,110)) -end -]]-- function ITEM:OnSecondary(pl,tr) - print("Endpoint set?") + pl:ChatPrint("Endpoint set?") ParticleEffect("firetest",pl:GetPos(),pl:GetAngles(),pl) savedpoint[pl] = pl:GetPos() end @@ -77,6 +87,8 @@ end function ITEM:OnPrimary(pl,tr) if CLIENT then return end print("Attempting to cast...") - pl:Cast("Gateway",teleportfunc,self) + pl:Cast("Gateway",function(score,pl,s) + self:DoTeleport(score,pl,s) + end,self) end RegisterItem(ITEM) |
