Skip to content

Commit

Permalink
Fix all the bugs I added in the previous commits
Browse files Browse the repository at this point in the history
  • Loading branch information
rafraser committed Oct 15, 2020
1 parent 979d4b0 commit 7822760
Show file tree
Hide file tree
Showing 4 changed files with 133 additions and 137 deletions.
15 changes: 5 additions & 10 deletions fluffy_poltergeist/entities/entities/pg_model_control.lua
Original file line number Diff line number Diff line change
@@ -1,17 +1,12 @@
ENT.Type = "point"

--[[
function ENT:Initialize()
GAMEMODE.BarrelModels = ["models/props_c17/oildrum001_explosive.mdl"]
GAMEMODE.BarrelSkins = [0]
end
]]
function ENT:Initialize()
GAMEMODE.PropModels = {}
end

-- KV properties for mapping data
function ENT:KeyValue(key, value)
if not self.Ready then
GAMEMODE.PropModels = {}
self.Ready = true
end

if string.StartWith(key, "model") then
table.insert(GAMEMODE.PropModels, value)
end
Expand Down
39 changes: 39 additions & 0 deletions fluffy_poltergeist/entities/entities/pg_spawner.lua
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
ENT.Type = "point"
ENT.RespawnTime = 3

function ENT:KeyValue(key, value)
if key == "frequency" then
self.RespawnTime = math.Clamp(tonumber(value), 1, 60)
end
end

function ENT:Think()
if (self.Timer or 0) < CurTime() then
self.Timer = CurTime() + self.RespawnTime
self:SpawnProp()
end
end

function ENT:SpawnProp()
if table.Count(ents.FindByClass("prop_phys*")) > GAMEMODE.MaxProps then return end
local prop = self:CreateProp(table.Random(GAMEMODE.PropModels))
local phys = prop:GetPhysicsObject()

if phys and phys:IsValid() then
phys:AddAngleVelocity(Vector((VectorRand() * 200):Angle()))
end
end

function ENT:CreateProp(model)
local prop = ents.Create("prop_physics")
prop:SetPos(self:GetPos())
prop:SetAngles(self:GetAngles())
prop:SetModel(model)
prop:SetSkin(math.random(0, prop:SkinCount()-1))
prop:Spawn()
return prop
end

function ENT:GetFrequency()
return self.RespawnTime
end
40 changes: 1 addition & 39 deletions fluffy_poltergeist/entities/entities/prop_spawner.lua
Original file line number Diff line number Diff line change
@@ -1,39 +1 @@
ENT.Type = "point"
ENT.RespawnTime = 3

function ENT:KeyValue(key, value)
if key == "frequency" then
self.RespawnTime = math.Clamp(tonumber(value), 1, 60)
end
end

function ENT:Think()
if (self.Timer or 0) < CurTime() then
self.Timer = CurTime() + self.RespawnTime
self:SpawnProp()
end
end

function ENT:SpawnProp()
if table.Count(ents.FindByClass("prop_phys*")) > GAMEMODE.MaxProps then return end
local prop = self:CreateProp(table.Random(GAMEMODE.PropModels))
local phys = prop:GetPhysicsObject()

if phys and phys:IsValid() then
phys:AddAngleVelocity(Vector((VectorRand() * 200):Angle()))
end
end

function ENT:CreateProp(model)
local prop = ents.Create("prop_physics")
prop:SetPos(self:GetPos())
prop:SetAngles(self:GetAngles())
prop:SetModel(model)
prop:Spawn()
prop:SetSkin(math.random(0, self:SkinCount()-1))
return prop
end

function ENT:GetFrequency()
return self.RespawnTime
end
ENT.Base = "pg_spawner"
176 changes: 88 additions & 88 deletions fluffy_poltergeist/gamemode/tables.lua
Original file line number Diff line number Diff line change
Expand Up @@ -73,105 +73,105 @@ for k, v in pairs(GM.PropModels) do
end

GM.PropDie = {
"npc/roller/mine/rmine_explode_shock1.wav"
"ambient/energy/weld2.wav"
"npc/scanner/scanner_electric2.wav"
"npc/scanner/cbot_energyexplosion1.wav"
"ambient/levels/labs/electric_explosion1.wav"
"ambient/levels/labs/electric_explosion2.wav"
"ambient/levels/labs/electric_explosion3.wav"
"ambient/levels/labs/electric_explosion4.wav"
"npc/roller/mine/rmine_explode_shock1.wav",
"ambient/energy/weld2.wav",
"npc/scanner/scanner_electric2.wav",
"npc/scanner/cbot_energyexplosion1.wav",
"ambient/levels/labs/electric_explosion1.wav",
"ambient/levels/labs/electric_explosion2.wav",
"ambient/levels/labs/electric_explosion3.wav",
"ambient/levels/labs/electric_explosion4.wav",
"ambient/levels/labs/electric_explosion5.wav"
}

GM.PropHit = {
"weapons/fx/nearmiss/bulletltor03.wav"
"weapons/fx/nearmiss/bulletltor04.wav"
"weapons/fx/nearmiss/bulletltor05.wav"
"weapons/fx/nearmiss/bulletltor06.wav"
"weapons/fx/nearmiss/bulletltor07.wav"
"weapons/fx/nearmiss/bulletltor09.wav"
"weapons/fx/nearmiss/bulletltor10.wav"
"weapons/fx/nearmiss/bulletltor11.wav"
"weapons/fx/nearmiss/bulletltor12.wav"
"weapons/fx/nearmiss/bulletltor13.wav"
"weapons/fx/rics/ric1.wav"
"weapons/fx/rics/ric2.wav"
"weapons/fx/rics/ric3.wav"
"weapons/fx/rics/ric4.wav"
"weapons/fx/nearmiss/bulletltor03.wav",
"weapons/fx/nearmiss/bulletltor04.wav",
"weapons/fx/nearmiss/bulletltor05.wav",
"weapons/fx/nearmiss/bulletltor06.wav",
"weapons/fx/nearmiss/bulletltor07.wav",
"weapons/fx/nearmiss/bulletltor09.wav",
"weapons/fx/nearmiss/bulletltor10.wav",
"weapons/fx/nearmiss/bulletltor11.wav",
"weapons/fx/nearmiss/bulletltor12.wav",
"weapons/fx/nearmiss/bulletltor13.wav",
"weapons/fx/rics/ric1.wav",
"weapons/fx/rics/ric2.wav",
"weapons/fx/rics/ric3.wav",
"weapons/fx/rics/ric4.wav",
"weapons/fx/rics/ric5.wav"
}

GM.ChangeSounds = {
"ambient/levels/citadel/weapon_disintegrate1.wav"
"ambient/levels/citadel/weapon_disintegrate2.wav"
"ambient/levels/citadel/weapon_disintegrate3.wav"
"ambient/levels/citadel/weapon_disintegrate1.wav",
"ambient/levels/citadel/weapon_disintegrate2.wav",
"ambient/levels/citadel/weapon_disintegrate3.wav",
"ambient/levels/citadel/weapon_disintegrate4.wav"
}

GM.TauntSounds = {
"vo/citadel/br_laugh01.wav"
"vo/npc/Barney/ba_yell.wav"
"vo/ravenholm/monk_blocked01.wav"
"vo/ravenholm/madlaugh01.wav"
"vo/ravenholm/madlaugh02.wav"
"vo/ravenholm/madlaugh03.wav"
"vo/ravenholm/madlaugh04.wav"
"vo/coast/bugbait/sandy_youthere.wav"
"vo/npc/male01/hi01.wav"
"vo/citadel/br_mock09.wav"
"vo/canals/male01/stn6_incoming.wav"
"vo/coast/bugbait/sandy_poorlaszlo.wav"
"vo/coast/bugbait/sandy_youthere.wav"
"vo/coast/odessa/male01/nlo_cheer01.wav"
"vo/coast/odessa/male01/nlo_cheer02.wav"
"vo/coast/odessa/male01/nlo_cheer03.wav"
"vo/coast/odessa/male01/nlo_cheer04.wav"
"vo/k_lab/ba_thereheis.wav"
"vo/npc/barney/ba_bringiton.wav"
"vo/npc/barney/ba_goingdown.wav"
"vo/npc/barney/ba_followme02.wav"
"vo/npc/barney/ba_hereitcomes.wav"
"vo/npc/barney/ba_heretheycome01.wav"
"vo/npc/barney/ba_heretheycome02.wav"
"vo/npc/barney/ba_uhohheretheycome.wav"
"vo/npc/barney/ba_laugh01.wav"
"vo/npc/barney/ba_laugh02.wav"
"vo/npc/barney/ba_laugh03.wav"
"vo/npc/barney/ba_laugh04.wav"
"vo/npc/barney/ba_ohyeah.wav"
"vo/npc/barney/ba_yell.wav"
"vo/npc/barney/ba_gotone.wav"
"vo/npc/male01/evenodds.wav"
"vo/npc/male01/behindyou01.wav"
"vo/npc/male01/behindyou02.wav"
"vo/npc/male01/cit_dropper04.wav"
"vo/npc/male01/fantastic02.wav"
"vo/npc/male01/gethellout.wav"
"vo/npc/male01/gordead_ques07.wav"
"vo/npc/male01/likethat.wav"
"vo/npc/male01/overhere01.wav"
"vo/npc/male01/overhere01.wav"
"vo/npc/male01/overthere02.wav"
"vo/npc/male01/excuseme01.wav"
"vo/npc/male01/pardonme01.wav"
"vo/npc/male01/question23.wav"
"vo/npc/male01/question06.wav"
"vo/npc/male01/okimready03.wav"
"vo/npc/male01/squad_away01.wav"
"vo/npc/male01/squad_away02.wav"
"vo/npc/male01/squad_away03.wav"
"vo/npc/male01/squad_follow02.wav"
"vo/npc/male01/vanswer13.wav"
"vo/npc/male01/heretheycome01.wav"
"vo/npc/male01/yeah02.wav"
"vo/npc/male01/gotone01.wav"
"vo/npc/male01/gotone02.wav"
"vo/npc/male01/headsup02.wav"
"vo/ravenholm/engage01.wav"
"vo/ravenholm/monk_death07.wav"
"vo/ravenholm/shotgun_closer.wav"
"vo/streetwar/sniper/ba_heycomeon.wav"
"vo/streetwar/sniper/ba_hearcat.wav"
"vo/citadel/br_laugh01.wav",
"vo/npc/Barney/ba_yell.wav",
"vo/ravenholm/monk_blocked01.wav",
"vo/ravenholm/madlaugh01.wav",
"vo/ravenholm/madlaugh02.wav",
"vo/ravenholm/madlaugh03.wav",
"vo/ravenholm/madlaugh04.wav",
"vo/coast/bugbait/sandy_youthere.wav",
"vo/npc/male01/hi01.wav",
"vo/citadel/br_mock09.wav",
"vo/canals/male01/stn6_incoming.wav",
"vo/coast/bugbait/sandy_poorlaszlo.wav",
"vo/coast/bugbait/sandy_youthere.wav",
"vo/coast/odessa/male01/nlo_cheer01.wav",
"vo/coast/odessa/male01/nlo_cheer02.wav",
"vo/coast/odessa/male01/nlo_cheer03.wav",
"vo/coast/odessa/male01/nlo_cheer04.wav",
"vo/k_lab/ba_thereheis.wav",
"vo/npc/barney/ba_bringiton.wav",
"vo/npc/barney/ba_goingdown.wav",
"vo/npc/barney/ba_followme02.wav",
"vo/npc/barney/ba_hereitcomes.wav",
"vo/npc/barney/ba_heretheycome01.wav",
"vo/npc/barney/ba_heretheycome02.wav",
"vo/npc/barney/ba_uhohheretheycome.wav",
"vo/npc/barney/ba_laugh01.wav",
"vo/npc/barney/ba_laugh02.wav",
"vo/npc/barney/ba_laugh03.wav",
"vo/npc/barney/ba_laugh04.wav",
"vo/npc/barney/ba_ohyeah.wav",
"vo/npc/barney/ba_yell.wav",
"vo/npc/barney/ba_gotone.wav",
"vo/npc/male01/evenodds.wav",
"vo/npc/male01/behindyou01.wav",
"vo/npc/male01/behindyou02.wav",
"vo/npc/male01/cit_dropper04.wav",
"vo/npc/male01/fantastic02.wav",
"vo/npc/male01/gethellout.wav",
"vo/npc/male01/gordead_ques07.wav",
"vo/npc/male01/likethat.wav",
"vo/npc/male01/overhere01.wav",
"vo/npc/male01/overhere01.wav",
"vo/npc/male01/overthere02.wav",
"vo/npc/male01/excuseme01.wav",
"vo/npc/male01/pardonme01.wav",
"vo/npc/male01/question23.wav",
"vo/npc/male01/question06.wav",
"vo/npc/male01/okimready03.wav",
"vo/npc/male01/squad_away01.wav",
"vo/npc/male01/squad_away02.wav",
"vo/npc/male01/squad_away03.wav",
"vo/npc/male01/squad_follow02.wav",
"vo/npc/male01/vanswer13.wav",
"vo/npc/male01/heretheycome01.wav",
"vo/npc/male01/yeah02.wav",
"vo/npc/male01/gotone01.wav",
"vo/npc/male01/gotone02.wav",
"vo/npc/male01/headsup02.wav",
"vo/ravenholm/engage01.wav",
"vo/ravenholm/monk_death07.wav",
"vo/ravenholm/shotgun_closer.wav",
"vo/streetwar/sniper/ba_heycomeon.wav",
"vo/streetwar/sniper/ba_hearcat.wav",
"vo/streetwar/sniper/ba_overhere.wav"
}

0 comments on commit 7822760

Please sign in to comment.