From d345792c3f7cfe37f8446b828946fdc5b2c645ed Mon Sep 17 00:00:00 2001 From: Robert Fraser Date: Sun, 11 Oct 2020 20:58:13 +1000 Subject: [PATCH 01/38] Dodgeball: Only allow pickup of dodgeballs --- fluffy_dodgeball/gamemode/init.lua | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/fluffy_dodgeball/gamemode/init.lua b/fluffy_dodgeball/gamemode/init.lua index b8dfe30..d81a342 100644 --- a/fluffy_dodgeball/gamemode/init.lua +++ b/fluffy_dodgeball/gamemode/init.lua @@ -84,6 +84,11 @@ function GM:CollectBall(ball, team) ball:SetNWVector("RColor", c) end +-- Only balls can be picked up in Dodgeball +function GM:GravGunPickupAllowed(ply, ent) + return ent:GetClass() == "db_dodgeball" +end + -- Handle collection when the gravity gun picks up a ball function GM:GravGunOnPickedUp(ply, ent) if ply:Team() ~= TEAM_BLUE and ply:Team() ~= TEAM_RED then return end From 2bac194502440bc17e3b422ba3473cb5918c1cbb Mon Sep 17 00:00:00 2001 From: Robert Fraser Date: Sun, 11 Oct 2020 21:02:51 +1000 Subject: [PATCH 02/38] Dodgeball: Attempt to fix balls that spawn stuck in the world --- fluffy_dodgeball/entities/entities/db_dodgeball.lua | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/fluffy_dodgeball/entities/entities/db_dodgeball.lua b/fluffy_dodgeball/entities/entities/db_dodgeball.lua index 0c3664d..c5954fd 100644 --- a/fluffy_dodgeball/entities/entities/db_dodgeball.lua +++ b/fluffy_dodgeball/entities/entities/db_dodgeball.lua @@ -19,6 +19,11 @@ function ENT:Initialize() self.CurrentBounces = 0 self.LastTime = CurTime() + + if util.IsInWorld(self:GetPos() - Vector(0, 0, self.Size/2)) then + print("moving up!") + self:SetPos(self:GetPos() + Vector(0, 0, self.Size + 8)) + end end -- Destroy the ball if damaged by trigger_hurt entities, otherwise apply physics damage From ac6eb333e8dcc859030c6a28268b31bbd7484789 Mon Sep 17 00:00:00 2001 From: Robert Fraser Date: Sun, 11 Oct 2020 21:09:37 +1000 Subject: [PATCH 03/38] Stop game start message sometimes being a time traveller --- fluffy_dodgeball/entities/entities/db_dodgeball.lua | 2 +- fluffy_mg_base/gamemode/cl_round_state.lua | 3 ++- fluffy_mg_base/gamemode/init.lua | 1 - 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/fluffy_dodgeball/entities/entities/db_dodgeball.lua b/fluffy_dodgeball/entities/entities/db_dodgeball.lua index c5954fd..25798cf 100644 --- a/fluffy_dodgeball/entities/entities/db_dodgeball.lua +++ b/fluffy_dodgeball/entities/entities/db_dodgeball.lua @@ -20,8 +20,8 @@ function ENT:Initialize() self.CurrentBounces = 0 self.LastTime = CurTime() + -- Attempt to unstuck balls in the world if util.IsInWorld(self:GetPos() - Vector(0, 0, self.Size/2)) then - print("moving up!") self:SetPos(self:GetPos() + Vector(0, 0, self.Size + 8)) end end diff --git a/fluffy_mg_base/gamemode/cl_round_state.lua b/fluffy_mg_base/gamemode/cl_round_state.lua index c972a96..719bdd5 100644 --- a/fluffy_mg_base/gamemode/cl_round_state.lua +++ b/fluffy_mg_base/gamemode/cl_round_state.lua @@ -288,8 +288,9 @@ function GM:DrawRoundState() if GAME_STATE == "Warmup" then local start_time = GetGlobalFloat("WarmupTime", CurTime()) local t = GAMEMODE.WarmupTime - (CurTime() - start_time) - GAMEMODE:DrawShadowText("Round starting in " .. math.ceil(t) .. "...", "FS_40", 4, 4, GAMEMODE.FCol1, TEXT_ALIGN_LEFT, TEXT_ALIGN_TOP) + if t < 0.5 then return end + GAMEMODE:DrawShadowText("Round starting in " .. math.ceil(t) .. "...", "FS_40", 4, 4, GAMEMODE.FCol1, TEXT_ALIGN_LEFT, TEXT_ALIGN_TOP) return end diff --git a/fluffy_mg_base/gamemode/init.lua b/fluffy_mg_base/gamemode/init.lua index 7f4a0d4..a501750 100644 --- a/fluffy_mg_base/gamemode/init.lua +++ b/fluffy_mg_base/gamemode/init.lua @@ -135,7 +135,6 @@ function GM:PlayerInitialSpawn(ply) -- Otherwise, automatically assign teams (hopefully evenly..) if not GAMEMODE.TeamBased then ply:SetTeam(TEAM_UNASSIGNED) - return else GAMEMODE:PlayerRequestTeam(ply, team.BestAutoJoinTeam()) From e260a13e83d623d85a44141d78604e8a71673224 Mon Sep 17 00:00:00 2001 From: Robert Fraser Date: Sun, 11 Oct 2020 21:14:48 +1000 Subject: [PATCH 04/38] Microgames: Remove balloons modifier --- .../entities/entities/microgames_balloon.lua | 107 ------------------ .../entities/weapons/balloon_popper.lua | 77 ------------- .../gamemode/modifiers/balloons.lua | 44 ------- 3 files changed, 228 deletions(-) delete mode 100644 fluffy_microgames/entities/entities/microgames_balloon.lua delete mode 100644 fluffy_microgames/entities/weapons/balloon_popper.lua delete mode 100644 fluffy_microgames/gamemode/modifiers/balloons.lua diff --git a/fluffy_microgames/entities/entities/microgames_balloon.lua b/fluffy_microgames/entities/entities/microgames_balloon.lua deleted file mode 100644 index a445a4e..0000000 --- a/fluffy_microgames/entities/entities/microgames_balloon.lua +++ /dev/null @@ -1,107 +0,0 @@ -AddCSLuaFile() -ENT.Type = "anim" --- Balloon properties -ENT.PrintName = "Balloon" -ENT.Model = "models/maxofs2d/balloon_classic.mdl" -ENT.Points = 1 -ENT.SpeedMin = 20 -ENT.SpeedMax = 30 -ENT.Balloon = true - -ENT.BalloonTypes = { - classic = { - points = 1, - minspeed = 20, - maxspeed = 30, - model = "models/maxofs2d/balloon_classic.mdl" - }, - heart = { - points = 3, - minspeed = 50, - maxspeed = 80, - model = "models/balloons/balloon_classicheart.mdl" - }, - star = { - points = 5, - minspeed = 100, - maxspeed = 200, - model = "models/balloons/balloon_star.mdl" - } -} - --- Create the balloon -function ENT:Initialize() - -- Select the type of balloon - local r = util.SharedRandom("BalloonTypeRandom", 0, 1, self:EntIndex()) - local bType = "classic" - - if r < 0.15 then - bType = "star" - elseif r < 0.50 then - bType = "heart" - end - - -- Load balloon properties - local bTable = self.BalloonTypes[bType] - self.Accelerate = util.SharedRandom("BalloonSpeedRandom", bTable.minspeed, bTable.maxspeed, self:EntIndex()) - self.Score = bTable.points - self:SetModel(bTable.model) - local hue = util.SharedRandom("BalloonColorRandom", 0, 360, self:EntIndex()) - self:SetColor(HSVToColor(hue, 1, 1)) - self:SetRenderMode(RENDERMODE_TRANSALPHA) - -- Create physics object - self:PhysicsInitSphere(10, "rubber") - local phys = self:GetPhysicsObject() - - if IsValid(phys) then - phys:SetMass(100) - phys:Wake() - phys:EnableGravity(false) - end - - self:StartMotionController() - -- Add a little bit of sideways velocity - local xx = util.SharedRandom("BalloonXRandom", -1, 1, self:EntIndex()) - local yy = util.SharedRandom("BalloonYRandom", -1, 1, self:EntIndex()) - self.SideMotion = Vector(xx, yy, 0) * self.Accelerate - self.Speed = Vector(0, 0, self.Accelerate * 5) - local yaw = util.SharedRandom("BalloonYaw", 0, 360, self:EntIndex()) - self:SetAngles(Angle(0, yaw, 0)) -end - --- Pop the balloon if we hit the world -function ENT:PhysicsCollide(data, phys) - if data.HitEntity == game.GetWorld() then - -- Balloon prop effect - local c = self:GetColor() - local ed = EffectData() - ed:SetOrigin(self:GetPos()) - ed:SetStart(Vector(c.r, c.g, c.b)) - util.Effect("balloon_pop", ed) - self:Remove() - end -end - --- Handle balloon popping effects -function ENT:OnTakeDamage(dmginfo) - -- Balloon prop effect - local c = self:GetColor() - local ed = EffectData() - ed:SetOrigin(self:GetPos()) - ed:SetStart(Vector(c.r, c.g, c.b)) - util.Effect("balloon_pop", ed) - -- Register this with the gamemode - local attacker = dmginfo:GetAttacker() - - if IsValid(attacker) and attacker:IsPlayer() then - hook.Run("PropBreak", attacker, self) - end - - self:Remove() -end - --- Make the balloon physically float upwards -function ENT:PhysicsSimulate(phys, delta) - self.Speed = self.Speed -- + Vector(0, 0, self.Accelerate * delta) + (self.SideMotion * delta) - return Vector(0, 0, 0), self.Speed, SIM_GLOBAL_FORCE -end \ No newline at end of file diff --git a/fluffy_microgames/entities/weapons/balloon_popper.lua b/fluffy_microgames/entities/weapons/balloon_popper.lua deleted file mode 100644 index abcc796..0000000 --- a/fluffy_microgames/entities/weapons/balloon_popper.lua +++ /dev/null @@ -1,77 +0,0 @@ -SWEP.Base = "weapon_mg_base" - -if CLIENT then - SWEP.Slot = 1 - SWEP.SlotPos = 0 - SWEP.IconLetter = "-" - SWEP.IconFont = "HL2MPTypeDeath" - killicon.AddFont("balloon_popper", "HL2MPTypeDeath", "-", Color(255, 80, 0, 255)) -end - -SWEP.PrintName = "Balloon Popper" --- Primary fire damage and aim settings -SWEP.Primary.Damage = 20 -SWEP.Primary.Cone = 0.015 -SWEP.Primary.Delay = 0.1 -SWEP.Primary.NumShots = 1 -SWEP.Primary.Sound = Sound("Weapon_Pistol.Single") -SWEP.Primary.Recoil = 1 -SWEP.Primary.Tracer = "mg_tracer" --- Primary ammo settings -SWEP.Primary.ClipSize = 12 -SWEP.Primary.DefaultClip = 12 -SWEP.Primary.Ammo = "Pistol" -SWEP.Primary.Automatic = false -SWEP.Secondary.Automatic = true -- ??? --- Set the model for the gun --- Using hands is preferred -SWEP.UseHands = true -SWEP.ViewModel = "models/weapons/c_pistol.mdl" -SWEP.ViewModelFOV = 62 -SWEP.WorldModel = "models/weapons/w_pistol.mdl" -SWEP.HoldType = "pistol" - --- Custom bullet firing because we have an extra check to make the weapon 'wider' -function SWEP:ShootBullets(damage, numbullets, aimcone) - -- Setup the bullet table and fire it - local owner = self:GetOwner() - local scale = aimcone - local bullet = {} - bullet.Num = numbullets - bullet.Src = owner:GetShootPos() - bullet.Dir = owner:GetAimVector() - bullet.Spread = Vector(scale, scale, 0) - bullet.Force = math.Round(damage / 10) - bullet.Damage = math.Round(damage) - bullet.AmmoType = self.Primary.Ammo - bullet.HullSize = 32 - owner:FireBullets(bullet) - - -- Make the firing look nice - self:SendWeaponAnim(ACT_VM_PRIMARYATTACK) - owner:SetAnimation(PLAYER_ATTACK1) - - -- Fire a secondary tracer - -- Traces a box slightly bigger than a balloon - -- Near-misses will still pop the balloon - if SERVER then - local startpos = owner:GetShootPos() - local endpos = owner:GetShootPos() + (owner:GetAimVector() * 1000) - local mins = Vector(-10, -10, -10) - local maxs = Vector(10, 10, 10) - - local tr = util.TraceHull({ - start = startpos, - endpos = endpos, - filter = owner, - mins = mins, - maxs = maxs, - mask = MASK_SHOT_HULL - }) - - -- If the tracer hits a balloon - apply damage to it - if (tr.Hit and not tr.HitWorld) and tr.Entity.Balloon then - tr.Entity:TakeDamage(100, owner, self) - end - end -end \ No newline at end of file diff --git a/fluffy_microgames/gamemode/modifiers/balloons.lua b/fluffy_microgames/gamemode/modifiers/balloons.lua deleted file mode 100644 index 2eb1606..0000000 --- a/fluffy_microgames/gamemode/modifiers/balloons.lua +++ /dev/null @@ -1,44 +0,0 @@ -MOD.Name = "Balloons" -MOD.Region = "knockback" -MOD.ScoreValue = 0.1 -MOD.ScoringPane = true -MOD.WinValue = 3 -MOD.RoundTime = 20 - -local function spawnBalloons() - local number = GAMEMODE:PlayerScale(0.4, 3, 8) - local positions = GAMEMODE:GetRandomLocations(number, "edge") - - for i = 1, number do - local pos = positions[i] - local ent = ents.Create("microgames_balloon") - ent:SetPos(pos + Vector(0, 0, 8)) - ent:Spawn() - end -end - -function MOD:Initialize() - spawnBalloons() - GAMEMODE:Announce("Balloons!", "Pop as many as you can!") -end - -function MOD:Loadout(ply) - ply:Give("balloon_popper") - ply:GiveAmmo(256, "Pistol") -end - -function MOD:PropBreak(ply, prop) - if prop:GetClass() ~= "microgames_balloon" then return end - ply:AddMScore(prop.Score or 1) -end - -MOD.ThinkTime = 1 - -function MOD:Think() - spawnBalloons() -end - -function MOD:EntityTakeDamage(ent, dmg) - if not ent:IsPlayer() then return end - if dmg:GetAttacker():IsPlayer() then return true end -end \ No newline at end of file From 53d3f124bf26f183ac27a6748a17fd062a4ba899 Mon Sep 17 00:00:00 2001 From: Robert Fraser Date: Sun, 11 Oct 2020 21:17:27 +1000 Subject: [PATCH 05/38] Microgames: Make sure crates break instantly --- fluffy_microgames/gamemode/modifiers/crates.lua | 1 + 1 file changed, 1 insertion(+) diff --git a/fluffy_microgames/gamemode/modifiers/crates.lua b/fluffy_microgames/gamemode/modifiers/crates.lua index 883b45c..996e951 100644 --- a/fluffy_microgames/gamemode/modifiers/crates.lua +++ b/fluffy_microgames/gamemode/modifiers/crates.lua @@ -12,6 +12,7 @@ local function spawnCrates() ent:SetPos(pos) ent:SetModel("models/props_junk/wood_crate001a.mdl") ent:Spawn() + ent:SetHealth(1) end end From 6b649eb8aae8af46b9e207cc26ef814d50a56323 Mon Sep 17 00:00:00 2001 From: Robert Fraser Date: Sun, 11 Oct 2020 21:22:24 +1000 Subject: [PATCH 06/38] Microgames: Freezebuild now color-codes saws --- fluffy_microgames/gamemode/modifiers/freezebuild.lua | 3 +++ 1 file changed, 3 insertions(+) diff --git a/fluffy_microgames/gamemode/modifiers/freezebuild.lua b/fluffy_microgames/gamemode/modifiers/freezebuild.lua index fbc2e9c..a76825c 100644 --- a/fluffy_microgames/gamemode/modifiers/freezebuild.lua +++ b/fluffy_microgames/gamemode/modifiers/freezebuild.lua @@ -25,6 +25,8 @@ local function spawnSawblade(position) local saw = ents.Create("prop_physics") saw:SetModel("models/props_junk/sawblade001a.mdl") saw:SetPos(position + Vector(math.Rand(-1, 1), math.Rand(-1, 1), 1) * 8) + saw:SetMaterial("models/debug/debugwhite") + saw:SetColor(Color(0, 155, 0)) saw:Spawn() end @@ -59,6 +61,7 @@ function MOD:GravGunPunt(ply, ent) if phys:IsValid() and phys:IsMotionEnabled() then phys:EnableMotion(false) + ent:SetColor(Color(155, 0, 0)) end end From e07da806cab11d19cf3bb9b96089b33f00629261 Mon Sep 17 00:00:00 2001 From: Robert Fraser Date: Sun, 11 Oct 2020 21:26:19 +1000 Subject: [PATCH 07/38] Map vote now handles names with two parts properly --- fluffy_mg_base/gamemode/vgui/MapVotePanel.lua | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/fluffy_mg_base/gamemode/vgui/MapVotePanel.lua b/fluffy_mg_base/gamemode/vgui/MapVotePanel.lua index 4c0cc82..b568b75 100644 --- a/fluffy_mg_base/gamemode/vgui/MapVotePanel.lua +++ b/fluffy_mg_base/gamemode/vgui/MapVotePanel.lua @@ -37,9 +37,16 @@ function PANEL:AddChildren(width, height) gamemode = p.Options[1] or "gamemode" local split = string.Split(p.Options[2] or "map", "_") map_pretty = "" - for k, v in pairs(split) do - if #v < 4 and (k == 1 or k == #split) then continue end - map_pretty = map_pretty .. " " .. v:sub(1, 1):upper() .. v:sub(2) + + if #split == 2 then + -- Take the second segment only + map_pretty = split[2]:sub(1, 1):upper() .. split[2]:sub(2) + else + -- Assemble + for k, v in pairs(split) do + if #v < 4 and (k == 1 or k == #split) then continue end + map_pretty = map_pretty .. " " .. v:sub(1, 1):upper() .. v:sub(2) + end end end From fec87159431720f9ba8c35fadb3192ef146c58f3 Mon Sep 17 00:00:00 2001 From: Robert Fraser Date: Sun, 11 Oct 2020 21:30:55 +1000 Subject: [PATCH 08/38] Tidy up Pitfall cleanup code --- fluffy_pitfall/gamemode/init.lua | 24 ++++++------------------ 1 file changed, 6 insertions(+), 18 deletions(-) diff --git a/fluffy_pitfall/gamemode/init.lua b/fluffy_pitfall/gamemode/init.lua index e1e6235..66bfb26 100644 --- a/fluffy_pitfall/gamemode/init.lua +++ b/fluffy_pitfall/gamemode/init.lua @@ -93,24 +93,12 @@ end) -- Remove any leftover entities when the level is cleared function GM:ClearLevel() - for k, v in pairs(ents.FindByClass("pf_platform")) do - v:Remove() - end - - for k, v in pairs(ents.FindByClass("info_player_start")) do - v:Remove() - end - - for k, v in pairs(ents.FindByClass("gmod_player_start")) do - v:Remove() - end - - for k, v in pairs(ents.FindByClass("info_player_terrorist")) do - v:Remove() - end - - for k, v in pairs(ents.FindByClass("info_player_counterterrorist")) do - v:Remove() + local classes = {"pf_platform", "info_player_start", "gmod_player_start", "info_player_terrorist", "info_player_counterterrorist"} + + for _, class in pairs(classes) do + for k,v in pairs(ents.FindByClass(class)) do + v:Remove() + end end end From 3b81b7164d9a14113efea912ec16b27afabc2ccd Mon Sep 17 00:00:00 2001 From: Robert Fraser Date: Sun, 11 Oct 2020 21:36:22 +1000 Subject: [PATCH 09/38] Pitfall: pf_origin entity for mappers --- fluffy_pitfall/entities/entities/pf_origin.lua | 1 + fluffy_pitfall/gamemode/init.lua | 13 +++++++++++-- minigames.fgd | 5 +++++ 3 files changed, 17 insertions(+), 2 deletions(-) create mode 100644 fluffy_pitfall/entities/entities/pf_origin.lua diff --git a/fluffy_pitfall/entities/entities/pf_origin.lua b/fluffy_pitfall/entities/entities/pf_origin.lua new file mode 100644 index 0000000..902e52e --- /dev/null +++ b/fluffy_pitfall/entities/entities/pf_origin.lua @@ -0,0 +1 @@ +ENT.Type = "point" \ No newline at end of file diff --git a/fluffy_pitfall/gamemode/init.lua b/fluffy_pitfall/gamemode/init.lua index 66bfb26..e64de9e 100644 --- a/fluffy_pitfall/gamemode/init.lua +++ b/fluffy_pitfall/gamemode/init.lua @@ -87,14 +87,23 @@ end hook.Add("PreRoundStart", "CreatePlatforms", function() GAMEMODE:ClearLevel() - local pos = GAMEMODE.PlatformPositions[game.GetMap()] or Vector(0, 0, 0) + -- Find the position for the center platform + local pos = GAMEMODE.PlatformPositions[game.GetMap()] + if not pos then + local origins = ents.FindByClass("pf_origin") + if #origins < 1 then + pos = Vector(0, 0, 0) + else + pos = origins[1]:GetPos() + end + end GAMEMODE:GenerateLevel(pos) end) -- Remove any leftover entities when the level is cleared function GM:ClearLevel() local classes = {"pf_platform", "info_player_start", "gmod_player_start", "info_player_terrorist", "info_player_counterterrorist"} - + for _, class in pairs(classes) do for k,v in pairs(ents.FindByClass(class)) do v:Remove() diff --git a/minigames.fgd b/minigames.fgd index 8203a9a..ca8af4b 100644 --- a/minigames.fgd +++ b/minigames.fgd @@ -240,6 +240,11 @@ colorbonus(string) : "Color Bonus" : "255,128,0" : "Color of platforms with bonuses. RGB comma separated no spaces." ] +@PointClass = pf_origin: + "Origin marker for Pitfall maps. This should mark the center location of the bottom layer of platforms. Without this entity, this defaults to 0, 0, 0." +[ +] + // POLTERGEIST @PointClass iconsprite("editor/env_shooter.vmt") = pg_spawner: "Spawn point for Poltergeist entities" From a7ea1270bd90a98353f9076e116d9de9142fb152 Mon Sep 17 00:00:00 2001 From: Robert Fraser Date: Sun, 11 Oct 2020 22:44:11 +1000 Subject: [PATCH 10/38] Pitfall: Stop map spawns absolutely murdering games --- fluffy_pitfall/gamemode/init.lua | 15 --------------- 1 file changed, 15 deletions(-) diff --git a/fluffy_pitfall/gamemode/init.lua b/fluffy_pitfall/gamemode/init.lua index e64de9e..2a802d9 100644 --- a/fluffy_pitfall/gamemode/init.lua +++ b/fluffy_pitfall/gamemode/init.lua @@ -34,21 +34,6 @@ function GM:PlayerLoadout(ply) ply:SetJumpPower(200) end --- Handle spawns slightly differently due to the random platforms -function GM:PlayerSelectSpawn(ply) - local spawns = ents.FindByClass("info_player_start") - if (#spawns <= 0) then return false end - local selected = table.Random(spawns) - - while selected.spawnUsed do - selected = table.Random(spawns) - end - - selected.spawnUsed = true - - return selected -end - -- Credit damage to players for Knockbacks hook.Add("EntityTakeDamage", "CreditPitfallKills", function(ply, dmginfo) if not ply:IsPlayer() then return end From 2cbc4660bdf27240e49da72d0b8c523c5f6cdc3d Mon Sep 17 00:00:00 2001 From: Robert Fraser Date: Sun, 11 Oct 2020 22:53:23 +1000 Subject: [PATCH 11/38] Pitfall: Only give weapons after the safe period --- fluffy_pitfall/entities/entities/pf_platform.lua | 6 +++--- fluffy_pitfall/gamemode/init.lua | 6 +++++- fluffy_pitfall/gamemode/shared.lua | 6 +++++- 3 files changed, 13 insertions(+), 5 deletions(-) diff --git a/fluffy_pitfall/entities/entities/pf_platform.lua b/fluffy_pitfall/entities/entities/pf_platform.lua index 6d6c608..13b47e3 100644 --- a/fluffy_pitfall/entities/entities/pf_platform.lua +++ b/fluffy_pitfall/entities/entities/pf_platform.lua @@ -65,11 +65,11 @@ end -- Make platforms take damage when someone is touching them function ENT:Touch(ent) - -- 3 seconds of spawn protection in rounds + -- Spawn protection before platforms fall if not GAMEMODE:InRound() then return end - if GAMEMODE:GetRoundStartTime() + 3 > CurTime() then return end + if GAMEMODE:GetRoundStartTime() + GAMEMODE.SafeTime > CurTime() then return end + -- Only living players make the platforms fall - if not IsValid(ent) then return end if not ent:IsPlayer() then return end if not ent:Alive() or ent.Spectating then return end diff --git a/fluffy_pitfall/gamemode/init.lua b/fluffy_pitfall/gamemode/init.lua index 2a802d9..a036264 100644 --- a/fluffy_pitfall/gamemode/init.lua +++ b/fluffy_pitfall/gamemode/init.lua @@ -28,10 +28,14 @@ end -- Players start with a platform breaker weapon function GM:PlayerLoadout(ply) - ply:Give("weapon_platformbreaker") ply:SetWalkSpeed(350) ply:SetRunSpeed(360) ply:SetJumpPower(200) + + -- Give weapons after the safe period has ended + timer.Simple(GAMEMODE.SafeTime, function() + ply:Give("weapon_platformbreaker") + end) end -- Credit damage to players for Knockbacks diff --git a/fluffy_pitfall/gamemode/shared.lua b/fluffy_pitfall/gamemode/shared.lua index 669e078..ab0a29a 100644 --- a/fluffy_pitfall/gamemode/shared.lua +++ b/fluffy_pitfall/gamemode/shared.lua @@ -12,15 +12,19 @@ GM.HelpText = [[ Secondary fire will send players flying. ]] + GM.TeamBased = false -- Is the gamemode FFA or Teams? GM.Elimination = true GM.WinBySurvival = true +GM.ThirdpersonEnabled = true + GM.RoundNumber = 10 -- How many rounds? GM.RoundTime = 90 -- Seconds each round lasts for -GM.ThirdpersonEnabled = true GM.RoundType = "timed" GM.GameTime = 500 GM.HUDStyle = HUD_STYLE_CLOCK_TIMER_ALIVE +GM.SafeTime = 3 + function GM:Initialize() end \ No newline at end of file From df35e3331aacf70bdf608addf758f097e39c2c7b Mon Sep 17 00:00:00 2001 From: Robert Fraser Date: Sun, 11 Oct 2020 23:00:02 +1000 Subject: [PATCH 12/38] Fix spawnpoints not being calculated if no spawnpoints existed at the start of a round --- fluffy_mg_base/gamemode/sv_player.lua | 2 +- fluffy_pitfall/gamemode/init.lua | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/fluffy_mg_base/gamemode/sv_player.lua b/fluffy_mg_base/gamemode/sv_player.lua index 0f6fe52..750cf38 100644 --- a/fluffy_mg_base/gamemode/sv_player.lua +++ b/fluffy_mg_base/gamemode/sv_player.lua @@ -63,7 +63,7 @@ function GM:PlayerSelectSpawn(ply) end -- Find FFA spawn entities - if not IsTableOfEntitiesValid(GAMEMODE.SpawnPoints) then + if not IsTableOfEntitiesValid(GAMEMODE.SpawnPoints) or #GAMEMODE.SpawnPoints < 1 then GAMEMODE.SpawnPoints = ents.FindByClass("info_player_start") if #GAMEMODE.SpawnPoints < 2 then GAMEMODE.SpawnPoints = table.Add(GAMEMODE.SpawnPoints, ents.FindByClass("info_player_terrorist")) diff --git a/fluffy_pitfall/gamemode/init.lua b/fluffy_pitfall/gamemode/init.lua index a036264..ff2dc78 100644 --- a/fluffy_pitfall/gamemode/init.lua +++ b/fluffy_pitfall/gamemode/init.lua @@ -33,7 +33,7 @@ function GM:PlayerLoadout(ply) ply:SetJumpPower(200) -- Give weapons after the safe period has ended - timer.Simple(GAMEMODE.SafeTime, function() + timer.Simple(GAMEMODE.RoundCooldown + GAMEMODE.SafeTime, function() ply:Give("weapon_platformbreaker") end) end From a7be67d3c37ff80844d67881aba6d0e40f500761 Mon Sep 17 00:00:00 2001 From: Robert Fraser Date: Wed, 14 Oct 2020 14:59:00 +1000 Subject: [PATCH 13/38] Incoming: Rewrite all entities --- .../entities/entities/inc_prop_remover.lua | 7 +++ .../entities/inc_prop_remover/init.lua | 60 ------------------- .../entities/entities/inc_prop_spawner.lua | 1 + .../entities/inc_prop_spawner/cl_init.lua | 7 --- .../entities/inc_prop_spawner/init.lua | 9 --- .../entities/inc_prop_spawner/shared.lua | 2 - .../entities/entities/inc_winners_area.lua | 9 +++ .../entities/inc_winners_area/init.lua | 47 --------------- .../entities/entities/slope_prop_remover.lua | 1 + .../entities/slope_prop_remover/init.lua | 60 ------------------- .../entities/entities/slope_prop_spawner.lua | 1 + .../entities/slope_prop_spawner/cl_init.lua | 7 --- .../entities/slope_prop_spawner/init.lua | 9 --- .../entities/slope_prop_spawner/shared.lua | 2 - .../entities/entities/slope_winners_area.lua | 1 + .../entities/slope_winners_area/init.lua | 47 --------------- 16 files changed, 20 insertions(+), 250 deletions(-) create mode 100644 fluffy_incoming/entities/entities/inc_prop_remover.lua delete mode 100644 fluffy_incoming/entities/entities/inc_prop_remover/init.lua create mode 100644 fluffy_incoming/entities/entities/inc_prop_spawner.lua delete mode 100644 fluffy_incoming/entities/entities/inc_prop_spawner/cl_init.lua delete mode 100644 fluffy_incoming/entities/entities/inc_prop_spawner/init.lua delete mode 100644 fluffy_incoming/entities/entities/inc_prop_spawner/shared.lua create mode 100644 fluffy_incoming/entities/entities/inc_winners_area.lua delete mode 100644 fluffy_incoming/entities/entities/inc_winners_area/init.lua create mode 100644 fluffy_incoming/entities/entities/slope_prop_remover.lua delete mode 100644 fluffy_incoming/entities/entities/slope_prop_remover/init.lua create mode 100644 fluffy_incoming/entities/entities/slope_prop_spawner.lua delete mode 100644 fluffy_incoming/entities/entities/slope_prop_spawner/cl_init.lua delete mode 100644 fluffy_incoming/entities/entities/slope_prop_spawner/init.lua delete mode 100644 fluffy_incoming/entities/entities/slope_prop_spawner/shared.lua create mode 100644 fluffy_incoming/entities/entities/slope_winners_area.lua delete mode 100644 fluffy_incoming/entities/entities/slope_winners_area/init.lua diff --git a/fluffy_incoming/entities/entities/inc_prop_remover.lua b/fluffy_incoming/entities/entities/inc_prop_remover.lua new file mode 100644 index 0000000..5f67c66 --- /dev/null +++ b/fluffy_incoming/entities/entities/inc_prop_remover.lua @@ -0,0 +1,7 @@ +ENT.Type = "brush" + +function ENT:Touch(ent) + if ent:IsPlayer() then return end + if ent:GetClass() == "prop_ragdoll" then return end + ent:Remove() +end \ No newline at end of file diff --git a/fluffy_incoming/entities/entities/inc_prop_remover/init.lua b/fluffy_incoming/entities/entities/inc_prop_remover/init.lua deleted file mode 100644 index c8f3b2a..0000000 --- a/fluffy_incoming/entities/entities/inc_prop_remover/init.lua +++ /dev/null @@ -1,60 +0,0 @@ -ENT.Base = "base_entity" -ENT.Type = "brush" - ---[[--------------------------------------------------------- - Name: Initialize ----------------------------------------------------------]] -function ENT:Initialize() -end - ---[[--------------------------------------------------------- - Name: StartTouch ----------------------------------------------------------]] -function ENT:StartTouch(entity) -end - ---[[--------------------------------------------------------- - Name: EndTouch ----------------------------------------------------------]] -function ENT:EndTouch(entity) -end - ---[[--------------------------------------------------------- - Name: Touch ----------------------------------------------------------]] -function ENT:Touch(entity) - for k, v in pairs(ents.GetAll()) do - if (entity == v and not v:IsPlayer() and v:GetClass() ~= "prop_ragdoll") then - v:Remove() - end - end -end - ---[[--------------------------------------------------------- - Name: PassesTriggerFilters - Desc: Return true if this object should trigger us ----------------------------------------------------------]] -function ENT:PassesTriggerFilters(entity) - return true -end - ---[[--------------------------------------------------------- - Name: KeyValue - Desc: Called when a keyvalue is added to us ----------------------------------------------------------]] -function ENT:KeyValue(key, value) -end - ---[[--------------------------------------------------------- - Name: Think - Desc: Entity's think function. ----------------------------------------------------------]] -function ENT:Think() -end - ---[[--------------------------------------------------------- - Name: OnRemove - Desc: Called just before entity is deleted ----------------------------------------------------------]] -function ENT:OnRemove() -end \ No newline at end of file diff --git a/fluffy_incoming/entities/entities/inc_prop_spawner.lua b/fluffy_incoming/entities/entities/inc_prop_spawner.lua new file mode 100644 index 0000000..902e52e --- /dev/null +++ b/fluffy_incoming/entities/entities/inc_prop_spawner.lua @@ -0,0 +1 @@ +ENT.Type = "point" \ No newline at end of file diff --git a/fluffy_incoming/entities/entities/inc_prop_spawner/cl_init.lua b/fluffy_incoming/entities/entities/inc_prop_spawner/cl_init.lua deleted file mode 100644 index 1a6518c..0000000 --- a/fluffy_incoming/entities/entities/inc_prop_spawner/cl_init.lua +++ /dev/null @@ -1,7 +0,0 @@ -include("shared.lua") - -function ENT:Draw() -end - -function ENT:Initialize() -end \ No newline at end of file diff --git a/fluffy_incoming/entities/entities/inc_prop_spawner/init.lua b/fluffy_incoming/entities/entities/inc_prop_spawner/init.lua deleted file mode 100644 index c94400f..0000000 --- a/fluffy_incoming/entities/entities/inc_prop_spawner/init.lua +++ /dev/null @@ -1,9 +0,0 @@ -AddCSLuaFile("cl_init.lua") -AddCSLuaFile("shared.lua") -include("shared.lua") - -function ENT:Initialize() - self:PhysicsInit(SOLID_NONE) - self:SetMoveType(MOVETYPE_NONE) - self:SetSolid(SOLID_NONE) -end \ No newline at end of file diff --git a/fluffy_incoming/entities/entities/inc_prop_spawner/shared.lua b/fluffy_incoming/entities/entities/inc_prop_spawner/shared.lua deleted file mode 100644 index 598343e..0000000 --- a/fluffy_incoming/entities/entities/inc_prop_spawner/shared.lua +++ /dev/null @@ -1,2 +0,0 @@ -ENT.Type = "anim" -ENT.Base = "base_entity" \ No newline at end of file diff --git a/fluffy_incoming/entities/entities/inc_winners_area.lua b/fluffy_incoming/entities/entities/inc_winners_area.lua new file mode 100644 index 0000000..a033a3f --- /dev/null +++ b/fluffy_incoming/entities/entities/inc_winners_area.lua @@ -0,0 +1,9 @@ +ENT.Type = "brush" + +function ENT:StartTouch(ent) + if not ent:IsPlayer() then return end + if not GAMEMODE:InRound() then return end + + self:Remove() + GAMEMODE:IncomingVictory(ent) +end \ No newline at end of file diff --git a/fluffy_incoming/entities/entities/inc_winners_area/init.lua b/fluffy_incoming/entities/entities/inc_winners_area/init.lua deleted file mode 100644 index 0a2b462..0000000 --- a/fluffy_incoming/entities/entities/inc_winners_area/init.lua +++ /dev/null @@ -1,47 +0,0 @@ -ENT.Base = "base_entity" -ENT.Type = "brush" - ---[[--------------------------------------------------------- - Name: Initialize ----------------------------------------------------------]] -function ENT:Initialize() -end - ---[[--------------------------------------------------------- - Name: Touch ----------------------------------------------------------]] -function ENT:StartTouch(entity) - if IsValid(self) and entity:IsPlayer() then - self:Remove() - GAMEMODE:IncomingVictory(entity) - end -end - ---[[--------------------------------------------------------- - Name: PassesTriggerFilters - Desc: Return true if this object should trigger us ----------------------------------------------------------]] -function ENT:PassesTriggerFilters(entity) - return true -end - ---[[--------------------------------------------------------- - Name: KeyValue - Desc: Called when a keyvalue is added to us ----------------------------------------------------------]] -function ENT:KeyValue(key, value) -end - ---[[--------------------------------------------------------- - Name: Think - Desc: Entity's think function. ----------------------------------------------------------]] -function ENT:Think() -end - ---[[--------------------------------------------------------- - Name: OnRemove - Desc: Called just before entity is deleted ----------------------------------------------------------]] -function ENT:OnRemove() -end \ No newline at end of file diff --git a/fluffy_incoming/entities/entities/slope_prop_remover.lua b/fluffy_incoming/entities/entities/slope_prop_remover.lua new file mode 100644 index 0000000..ce758a0 --- /dev/null +++ b/fluffy_incoming/entities/entities/slope_prop_remover.lua @@ -0,0 +1 @@ +ENT.Base = "inc_prop_remover" \ No newline at end of file diff --git a/fluffy_incoming/entities/entities/slope_prop_remover/init.lua b/fluffy_incoming/entities/entities/slope_prop_remover/init.lua deleted file mode 100644 index c8f3b2a..0000000 --- a/fluffy_incoming/entities/entities/slope_prop_remover/init.lua +++ /dev/null @@ -1,60 +0,0 @@ -ENT.Base = "base_entity" -ENT.Type = "brush" - ---[[--------------------------------------------------------- - Name: Initialize ----------------------------------------------------------]] -function ENT:Initialize() -end - ---[[--------------------------------------------------------- - Name: StartTouch ----------------------------------------------------------]] -function ENT:StartTouch(entity) -end - ---[[--------------------------------------------------------- - Name: EndTouch ----------------------------------------------------------]] -function ENT:EndTouch(entity) -end - ---[[--------------------------------------------------------- - Name: Touch ----------------------------------------------------------]] -function ENT:Touch(entity) - for k, v in pairs(ents.GetAll()) do - if (entity == v and not v:IsPlayer() and v:GetClass() ~= "prop_ragdoll") then - v:Remove() - end - end -end - ---[[--------------------------------------------------------- - Name: PassesTriggerFilters - Desc: Return true if this object should trigger us ----------------------------------------------------------]] -function ENT:PassesTriggerFilters(entity) - return true -end - ---[[--------------------------------------------------------- - Name: KeyValue - Desc: Called when a keyvalue is added to us ----------------------------------------------------------]] -function ENT:KeyValue(key, value) -end - ---[[--------------------------------------------------------- - Name: Think - Desc: Entity's think function. ----------------------------------------------------------]] -function ENT:Think() -end - ---[[--------------------------------------------------------- - Name: OnRemove - Desc: Called just before entity is deleted ----------------------------------------------------------]] -function ENT:OnRemove() -end \ No newline at end of file diff --git a/fluffy_incoming/entities/entities/slope_prop_spawner.lua b/fluffy_incoming/entities/entities/slope_prop_spawner.lua new file mode 100644 index 0000000..b14265d --- /dev/null +++ b/fluffy_incoming/entities/entities/slope_prop_spawner.lua @@ -0,0 +1 @@ +ENT.Base = "inc_prop_spawner" \ No newline at end of file diff --git a/fluffy_incoming/entities/entities/slope_prop_spawner/cl_init.lua b/fluffy_incoming/entities/entities/slope_prop_spawner/cl_init.lua deleted file mode 100644 index 1a6518c..0000000 --- a/fluffy_incoming/entities/entities/slope_prop_spawner/cl_init.lua +++ /dev/null @@ -1,7 +0,0 @@ -include("shared.lua") - -function ENT:Draw() -end - -function ENT:Initialize() -end \ No newline at end of file diff --git a/fluffy_incoming/entities/entities/slope_prop_spawner/init.lua b/fluffy_incoming/entities/entities/slope_prop_spawner/init.lua deleted file mode 100644 index c94400f..0000000 --- a/fluffy_incoming/entities/entities/slope_prop_spawner/init.lua +++ /dev/null @@ -1,9 +0,0 @@ -AddCSLuaFile("cl_init.lua") -AddCSLuaFile("shared.lua") -include("shared.lua") - -function ENT:Initialize() - self:PhysicsInit(SOLID_NONE) - self:SetMoveType(MOVETYPE_NONE) - self:SetSolid(SOLID_NONE) -end \ No newline at end of file diff --git a/fluffy_incoming/entities/entities/slope_prop_spawner/shared.lua b/fluffy_incoming/entities/entities/slope_prop_spawner/shared.lua deleted file mode 100644 index 598343e..0000000 --- a/fluffy_incoming/entities/entities/slope_prop_spawner/shared.lua +++ /dev/null @@ -1,2 +0,0 @@ -ENT.Type = "anim" -ENT.Base = "base_entity" \ No newline at end of file diff --git a/fluffy_incoming/entities/entities/slope_winners_area.lua b/fluffy_incoming/entities/entities/slope_winners_area.lua new file mode 100644 index 0000000..a15f4be --- /dev/null +++ b/fluffy_incoming/entities/entities/slope_winners_area.lua @@ -0,0 +1 @@ +ENT.Base = "inc_winners_area" \ No newline at end of file diff --git a/fluffy_incoming/entities/entities/slope_winners_area/init.lua b/fluffy_incoming/entities/entities/slope_winners_area/init.lua deleted file mode 100644 index d5fa626..0000000 --- a/fluffy_incoming/entities/entities/slope_winners_area/init.lua +++ /dev/null @@ -1,47 +0,0 @@ -ENT.Base = "base_entity" -ENT.Type = "brush" - ---[[--------------------------------------------------------- - Name: Initialize ----------------------------------------------------------]] -function ENT:Initialize() -end - ---[[--------------------------------------------------------- - Name: Touch ----------------------------------------------------------]] -function ENT:StartTouch(entity) - if IsValid(self) and entity:IsPlayer() then - self:Remove() - GAMEMODE:EndRound(entity) - end -end - ---[[--------------------------------------------------------- - Name: PassesTriggerFilters - Desc: Return true if this object should trigger us ----------------------------------------------------------]] -function ENT:PassesTriggerFilters(entity) - return true -end - ---[[--------------------------------------------------------- - Name: KeyValue - Desc: Called when a keyvalue is added to us ----------------------------------------------------------]] -function ENT:KeyValue(key, value) -end - ---[[--------------------------------------------------------- - Name: Think - Desc: Entity's think function. ----------------------------------------------------------]] -function ENT:Think() -end - ---[[--------------------------------------------------------- - Name: OnRemove - Desc: Called just before entity is deleted ----------------------------------------------------------]] -function ENT:OnRemove() -end \ No newline at end of file From f1b5c30026c2e3d93157f1b5727167f3ab03ec15 Mon Sep 17 00:00:00 2001 From: Robert Fraser Date: Wed, 14 Oct 2020 15:23:20 +1000 Subject: [PATCH 14/38] Incoming: Prop material changes --- fluffy_incoming/gamemode/init.lua | 42 ++++++++++++++++--------------- 1 file changed, 22 insertions(+), 20 deletions(-) diff --git a/fluffy_incoming/gamemode/init.lua b/fluffy_incoming/gamemode/init.lua index a1f4c70..70e90a9 100644 --- a/fluffy_incoming/gamemode/init.lua +++ b/fluffy_incoming/gamemode/init.lua @@ -21,26 +21,37 @@ function GM:EndingPoint() end GM.CurrentPropsCategory = "Both" --- Prop spawn timer loop --- Spawns props at the top of the slope at a fixed interval -INCPropSpawnTimer = 0 +GM.PropSpawnTimer = 0 +-- Spawn props at appropiate times hook.Add("Tick", "TickPropSpawn", function() if not GAMEMODE:InRound() then return end + -- Get information from the currently selected props category -- See sv_maps for the prop data local data = GAMEMODE.DefaultProps[GAMEMODE.CurrentPropsCategory] local props = data.models - local delay = data.delay or 2 - if INCPropSpawnTimer < CurTime() then + -- Choose material + local material = data.materials + if istable(data.materials) then + material = table.Random(materials) + elseif not material then + material = "plastic" + end + + if GAMEMODE.PropSpawnTimer < CurTime() then -- Spawn a prop at every spawner for k, v in pairs(ents.FindByClass("inc_prop_spawner")) do local ent = ents.Create("prop_physics") ent:SetModel(props[math.random(1, #props)]) ent:SetPos(v:GetPos()) ent:Spawn() - ent:GetPhysicsObject():SetMass(40000) + + -- Set physical properties + local phys = ent:GetPhysicsObject() + phys:SetMass(40000) + phys:SetMaterial(material) -- Call the data function on every entity if data.func then @@ -48,7 +59,7 @@ hook.Add("Tick", "TickPropSpawn", function() end end - INCPropSpawnTimer = CurTime() + delay + GAMEMODE.PropSpawnTimer = CurTime() + (data.delay or 2) end end) @@ -56,15 +67,14 @@ end) hook.Add("PreRoundStart", "IncomingPropsChange", function() -- If the map has a category restriction, pay attention to that local category - if GAMEMODE.MapInfo[game.GetMap()].categories then category = table.Random(GAMEMODE.MapInfo[game.GetMap()].categories) else category = table.Random(table.GetKeys(GAMEMODE.DefaultProps)) end - GAMEMODE.CurrentPropsCategory = category + -- Reset distances for k, v in pairs(player.GetAll()) do v.BestDistance = nil end @@ -75,8 +85,10 @@ end) function GM:GetDistanceToEnd(ply) local endpos = GAMEMODE:EndingPoint() if not endpos then return end + local distance = ply:GetPos():Distance(endpos) local maxdist = GAMEMODE.MapInfo[game.GetMap()].distance + local percent = 1 - (distance / maxdist) if percent < 0 then return end @@ -95,15 +107,6 @@ hook.Add("DoPlayerDeath", "IncomingDistanceCheck", function(ply) GAMEMODE:GetDistanceToEnd(ply) end) -hook.Add("EntityTakeDamage", "CrowbarKnockback", function(ent, dmg) - if not ent:IsPlayer() then return true end - if not dmg:GetAttacker():IsPlayer() then return end - dmg:SetDamage(0) - ent:SetGroundEntity(NULL) - local v = dmg:GetDamageForce() + Vector(0, 0, 5) - ent:SetVelocity(v * 25) -end) - -- Add scoring based on distance at the end of a round -- Takes the best distance, rounds down to the nearest 10% and adds 1 point per 10% -- eg. 48% -> 40% -> 4 points @@ -131,8 +134,7 @@ end -- Network resources function IncludeResFolder(dir) local files = file.Find(dir .. "*", "GAME") - - local FindFileTypes = {".mdl", ".vmt", ".vtf", ".dx90", ".dx80", ".phy", ".sw", ".vvd", ".wav", ".mp3",} + local FindFileTypes = {".mdl", ".vmt", ".vtf", ".dx90", ".dx80", ".phy", ".sw", ".vvd", ".wav", ".mp3"} for k, v in pairs(files) do for k2, v2 in pairs(FindFileTypes) do From 988dc9dd7255366db7c899b5347baf39bb8d3e25 Mon Sep 17 00:00:00 2001 From: Robert Fraser Date: Wed, 14 Oct 2020 15:55:44 +1000 Subject: [PATCH 15/38] Incoming: End point is now calculated instead of stored --- fluffy_incoming/gamemode/init.lua | 6 ------ fluffy_incoming/gamemode/shared.lua | 22 ++++++++++++++++++++++ fluffy_incoming/gamemode/sv_maps.lua | 17 ----------------- 3 files changed, 22 insertions(+), 23 deletions(-) diff --git a/fluffy_incoming/gamemode/init.lua b/fluffy_incoming/gamemode/init.lua index 70e90a9..dfbf84f 100644 --- a/fluffy_incoming/gamemode/init.lua +++ b/fluffy_incoming/gamemode/init.lua @@ -14,12 +14,6 @@ function GM:PlayerLoadout(ply) --ply:Give("weapon_crowbar") end --- Get the winning position of this map --- This is hardcoded into sv_maps.lua because entities are weird for some reason -function GM:EndingPoint() - return GAMEMODE.MapInfo[game.GetMap()].endpos or Vector(0, 0, 0) -end - GM.CurrentPropsCategory = "Both" GM.PropSpawnTimer = 0 diff --git a/fluffy_incoming/gamemode/shared.lua b/fluffy_incoming/gamemode/shared.lua index e901b42..c699a02 100644 --- a/fluffy_incoming/gamemode/shared.lua +++ b/fluffy_incoming/gamemode/shared.lua @@ -16,4 +16,26 @@ GM.ThirdpersonEnabled = true GM.DeathSounds = true function GM:Initialize() +end + +function GM:EndingPoint() + if SERVER then + local p = GetGlobalVector("WinningPosition", Vector(-1, -1, -1)) + if p ~= Vector(-1, -1, -1) then + return p + else + local win = ents.FindByClass("*_winners_area")[1] + if not win then + ErrorNoHalt("No winning area in map!") + return + end + + local mins, maxs = win:GetModelBounds() + local point = (mins+maxs)/2 + SetGlobalVector("WinningPosition", point) + return point + end + else + return GetGlobalVector("WinningPosition", nil) + end end \ No newline at end of file diff --git a/fluffy_incoming/gamemode/sv_maps.lua b/fluffy_incoming/gamemode/sv_maps.lua index f9ad585..ec7f6a7 100644 --- a/fluffy_incoming/gamemode/sv_maps.lua +++ b/fluffy_incoming/gamemode/sv_maps.lua @@ -110,21 +110,4 @@ GM.DefaultProps["CubesAndSpheres"] = { local c = HSVToColor(math.random(360),1,1) e:SetColor(c) end -} - -GM.MapInfo = {} - -GM.MapInfo["inc_duo"] = { - endpos = Vector(-1650,5950,6656), - distance = 9000 -} - -GM.MapInfo["inc_rectangular"] = { - endpos = Vector(158,1027,3815), - distance = 8420 -} - -GM.MapInfo["inc_linear"] = { - endpos = Vector(0,4991,3456), - distance = 12500 } \ No newline at end of file From cc733c868afbb3b903e5e3101af24a624fc1fe40 Mon Sep 17 00:00:00 2001 From: Robert Fraser Date: Wed, 14 Oct 2020 16:01:30 +1000 Subject: [PATCH 16/38] Incoming: Fix distance check --- fluffy_incoming/gamemode/init.lua | 30 +++++++++++++----------------- 1 file changed, 13 insertions(+), 17 deletions(-) diff --git a/fluffy_incoming/gamemode/init.lua b/fluffy_incoming/gamemode/init.lua index dfbf84f..f83d4b0 100644 --- a/fluffy_incoming/gamemode/init.lua +++ b/fluffy_incoming/gamemode/init.lua @@ -3,17 +3,6 @@ AddCSLuaFile("shared.lua") include("shared.lua") include("sv_maps.lua") --- Nobody wins in Incoming ? --- Used to override default functionality on FFA round end -function GM:GetWinningPlayer() - return nil -end - --- No weapons -function GM:PlayerLoadout(ply) - --ply:Give("weapon_crowbar") -end - GM.CurrentPropsCategory = "Both" GM.PropSpawnTimer = 0 @@ -74,16 +63,23 @@ hook.Add("PreRoundStart", "IncomingPropsChange", function() end end) +-- Record starting distances +hook.Add("PlayerSpawn", "IncomingCheckDistance", function(ply) + ply.StartingDistance = GAMEMODE:GetDistanceToEnd(ply) +end) + -- Get the distance the player has to the end -- This function also tracks the current best distance function GM:GetDistanceToEnd(ply) local endpos = GAMEMODE:EndingPoint() - if not endpos then return end + return ply:GetPos():Distance(endpos) +end - local distance = ply:GetPos():Distance(endpos) - local maxdist = GAMEMODE.MapInfo[game.GetMap()].distance +function GM:CheckBestDistance(ply) + if not ply.StartingDistance then return end + local distance = GAMEMODE:GetDistanceToEnd(ply) - local percent = 1 - (distance / maxdist) + local percent = 1 - (distance / ply.StartingDistance) if percent < 0 then return end if ply.BestDistance then @@ -98,7 +94,7 @@ end -- Get a % of how close the player got to the ending -- This is used for better scoring than all-or-nothing hook.Add("DoPlayerDeath", "IncomingDistanceCheck", function(ply) - GAMEMODE:GetDistanceToEnd(ply) + GAMEMODE:CheckBestDistance(ply) end) -- Add scoring based on distance at the end of a round @@ -106,7 +102,7 @@ end) -- eg. 48% -> 40% -> 4 points hook.Add("RoundEnd", "IncomingDistancePoints", function() for k, v in pairs(player.GetAll()) do - GAMEMODE:GetDistanceToEnd(v) + GAMEMODE:CheckBestDistance(v) if v.BestDistance then local p = math.floor(v.BestDistance * 100) From e68d9a3123b73bf5e5b6cd0ff8743a59ad724280 Mon Sep 17 00:00:00 2001 From: Robert Fraser Date: Wed, 14 Oct 2020 16:06:18 +1000 Subject: [PATCH 17/38] Incoming: Split up spawning functionality --- fluffy_incoming/gamemode/init.lua | 76 ++-------- fluffy_incoming/gamemode/sv_maps.lua | 151 ++++++------------- fluffy_incoming/gamemode/sv_prop_presets.lua | 113 ++++++++++++++ 3 files changed, 169 insertions(+), 171 deletions(-) create mode 100644 fluffy_incoming/gamemode/sv_prop_presets.lua diff --git a/fluffy_incoming/gamemode/init.lua b/fluffy_incoming/gamemode/init.lua index f83d4b0..7234ccf 100644 --- a/fluffy_incoming/gamemode/init.lua +++ b/fluffy_incoming/gamemode/init.lua @@ -3,78 +3,25 @@ AddCSLuaFile("shared.lua") include("shared.lua") include("sv_maps.lua") -GM.CurrentPropsCategory = "Both" -GM.PropSpawnTimer = 0 - --- Spawn props at appropiate times -hook.Add("Tick", "TickPropSpawn", function() - if not GAMEMODE:InRound() then return end - - -- Get information from the currently selected props category - -- See sv_maps for the prop data - local data = GAMEMODE.DefaultProps[GAMEMODE.CurrentPropsCategory] - local props = data.models - - -- Choose material - local material = data.materials - if istable(data.materials) then - material = table.Random(materials) - elseif not material then - material = "plastic" - end - - if GAMEMODE.PropSpawnTimer < CurTime() then - -- Spawn a prop at every spawner - for k, v in pairs(ents.FindByClass("inc_prop_spawner")) do - local ent = ents.Create("prop_physics") - ent:SetModel(props[math.random(1, #props)]) - ent:SetPos(v:GetPos()) - ent:Spawn() - - -- Set physical properties - local phys = ent:GetPhysicsObject() - phys:SetMass(40000) - phys:SetMaterial(material) - - -- Call the data function on every entity - if data.func then - data.func(ent) - end - end - - GAMEMODE.PropSpawnTimer = CurTime() + (data.delay or 2) - end +-- Record starting distances +hook.Add("PlayerSpawn", "IncomingCheckSpawnDistance", function(ply) + ply.StartingDistance = GAMEMODE:GetDistanceToEnd(ply) end) --- Randomly pick a group of props -hook.Add("PreRoundStart", "IncomingPropsChange", function() - -- If the map has a category restriction, pay attention to that - local category - if GAMEMODE.MapInfo[game.GetMap()].categories then - category = table.Random(GAMEMODE.MapInfo[game.GetMap()].categories) - else - category = table.Random(table.GetKeys(GAMEMODE.DefaultProps)) - end - GAMEMODE.CurrentPropsCategory = category - - -- Reset distances +-- Reset best distances on round start +hook.Add("PreRoundStart", "IncomingResetBestDistance", function() for k, v in pairs(player.GetAll()) do v.BestDistance = nil end end) --- Record starting distances -hook.Add("PlayerSpawn", "IncomingCheckDistance", function(ply) - ply.StartingDistance = GAMEMODE:GetDistanceToEnd(ply) -end) - -- Get the distance the player has to the end --- This function also tracks the current best distance function GM:GetDistanceToEnd(ply) local endpos = GAMEMODE:EndingPoint() return ply:GetPos():Distance(endpos) end +-- Check if a player has set their new best distance to the end goal function GM:CheckBestDistance(ply) if not ply.StartingDistance then return end local distance = GAMEMODE:GetDistanceToEnd(ply) @@ -121,7 +68,13 @@ function GM:IncomingVictory(ply) GAMEMODE:EntityCameraAnnouncement(ply, GAMEMODE.RoundCooldown or 5) end +-- Equivalent of 1XP for every 100% of distance travelled +hook.Add("RegisterStatsConversions", "AddIncomingStatConversions", function() + GAMEMODE:AddStatConversion("Distance", "Distance Travelled", 0.01) +end) + -- Network resources +-- todo: workshop this! function IncludeResFolder(dir) local files = file.Find(dir .. "*", "GAME") local FindFileTypes = {".mdl", ".vmt", ".vtf", ".dx90", ".dx80", ".phy", ".sw", ".vvd", ".wav", ".mp3"} @@ -135,11 +88,6 @@ function IncludeResFolder(dir) end end --- Equivalent of 1XP for every 100% of distance travelled -hook.Add("RegisterStatsConversions", "AddIncomingStatConversions", function() - GAMEMODE:AddStatConversion("Distance", "Distance Travelled", 0.01) -end) - IncludeResFolder("materials/models/clannv/incoming/") IncludeResFolder("models/clannv/incoming/box/") IncludeResFolder("models/clannv/incoming/cone/") diff --git a/fluffy_incoming/gamemode/sv_maps.lua b/fluffy_incoming/gamemode/sv_maps.lua index ec7f6a7..f6fc249 100644 --- a/fluffy_incoming/gamemode/sv_maps.lua +++ b/fluffy_incoming/gamemode/sv_maps.lua @@ -1,113 +1,50 @@ -GM.DefaultProps = {} +include("sv_prop_presets.lua") -GM.DefaultProps["Geometric"] = { - models = { - "models/clannv/incoming/box/box1.mdl", - "models/clannv/incoming/box/box2.mdl", - "models/clannv/incoming/box/box3.mdl", - "models/clannv/incoming/cone/cone1.mdl", - "models/clannv/incoming/cone/cone2.mdl", - "models/clannv/incoming/cone/cone3.mdl", - "models/clannv/incoming/cylinder/cylinder1.mdl", - "models/clannv/incoming/cylinder/cylinder2.mdl", - "models/clannv/incoming/cylinder/cylinder3.mdl", - "models/clannv/incoming/hexagon/hexagon1.mdl", - "models/clannv/incoming/hexagon/hexagon2.mdl", - "models/clannv/incoming/hexagon/hexagon3.mdl", - "models/clannv/incoming/pentagon/pentagon1.mdl", - "models/clannv/incoming/pentagon/pentagon2.mdl", - "models/clannv/incoming/pentagon/pentagon3.mdl", - "models/clannv/incoming/sphere/sphere1.mdl", - "models/clannv/incoming/sphere/sphere2.mdl", - "models/clannv/incoming/sphere/sphere3.mdl", - "models/clannv/incoming/triangle/triangle1.mdl", - "models/clannv/incoming/triangle/triangle2.mdl", - "models/clannv/incoming/triangle/triangle3.mdl" - } -} +GM.CurrentPropsCategory = "Both" +GM.PropSpawnTimer = 0 -GM.DefaultProps["Vehicles"] = { - models = { - "models/props_vehicles/van001a_physics.mdl", - "models/props_vehicles/car001a_hatchback.mdl", - "models/props_vehicles/car001b_hatchback.mdl", - "models/props_vehicles/car002a_physics.mdl", - "models/props_vehicles/car002b_physics.mdl", - "models/props_vehicles/car003a_physics.mdl", - "models/props_vehicles/car003b_physics.mdl", - "models/props_vehicles/car004a_physics.mdl", - "models/props_vehicles/car004b_physics.mdl", - "models/props_vehicles/car005a_physics.mdl", - "models/props_vehicles/car005b_physics.mdl", - "models/props_vehicles/apc001.mdl", - "models/props_vehicles/trailer001a.mdl", - "models/props_vehicles/trailer002a.mdl", - "models/props_vehicles/truck001a.mdl", - "models/props_vehicles/truck003a.mdl" - } -} +-- Spawn props at appropiate times +hook.Add("Tick", "TickPropSpawn", function() + if not GAMEMODE:InRound() then return end -GM.DefaultProps["Both"] = { - models = { - "models/props_vehicles/van001a_physics.mdl", - "models/props_vehicles/car001a_hatchback.mdl", - "models/props_vehicles/car001b_hatchback.mdl", - "models/props_vehicles/car002a_physics.mdl", - "models/props_vehicles/car002b_physics.mdl", - "models/props_vehicles/car003a_physics.mdl", - "models/props_vehicles/car003b_physics.mdl", - "models/props_vehicles/car004a_physics.mdl", - "models/props_vehicles/car004b_physics.mdl", - "models/props_vehicles/car005a_physics.mdl", - "models/props_vehicles/car005b_physics.mdl", - "models/props_vehicles/apc001.mdl", - "models/props_vehicles/trailer001a.mdl", - "models/props_vehicles/trailer002a.mdl", - "models/props_vehicles/truck001a.mdl", - "models/props_vehicles/truck003a.mdl", - "models/clannv/incoming/box/box1.mdl", - "models/clannv/incoming/box/box2.mdl", - "models/clannv/incoming/box/box3.mdl", - "models/clannv/incoming/cone/cone1.mdl", - "models/clannv/incoming/cone/cone2.mdl", - "models/clannv/incoming/cone/cone3.mdl", - "models/clannv/incoming/cylinder/cylinder1.mdl", - "models/clannv/incoming/cylinder/cylinder2.mdl", - "models/clannv/incoming/cylinder/cylinder3.mdl", - "models/clannv/incoming/hexagon/hexagon1.mdl", - "models/clannv/incoming/hexagon/hexagon2.mdl", - "models/clannv/incoming/hexagon/hexagon3.mdl", - "models/clannv/incoming/pentagon/pentagon1.mdl", - "models/clannv/incoming/pentagon/pentagon2.mdl", - "models/clannv/incoming/pentagon/pentagon3.mdl", - "models/clannv/incoming/sphere/sphere1.mdl", - "models/clannv/incoming/sphere/sphere2.mdl", - "models/clannv/incoming/sphere/sphere3.mdl", - "models/clannv/incoming/triangle/triangle1.mdl", - "models/clannv/incoming/triangle/triangle2.mdl", - "models/clannv/incoming/triangle/triangle3.mdl" - } -} + -- Get information from the currently selected props category + -- See sv_maps for the prop data + local data = GAMEMODE.DefaultProps[GAMEMODE.CurrentPropsCategory] + local props = data.models -GM.DefaultProps["CubesAndSpheres"] = { - models = { - "models/hunter/blocks/cube05x05x05.mdl", - "models/hunter/blocks/cube075x075x075.mdl", - "models/hunter/blocks/cube1x1x1.mdl", - "models/hunter/blocks/cube1x150x1.mdl", - "models/hunter/blocks/cube1x6x1.mdl", - "models/hunter/blocks/cube2x2x2.mdl", - "models/hunter/blocks/cube2x4x1.mdl", - "models/hunter/blocks/cube2x6x1.mdl", - "models/hunter/blocks/cube4x4x4.mdl", - "models/hunter/misc/sphere175x175.mdl", - "models/hunter/misc/sphere1x1.mdl", - "models/hunter/misc/sphere2x2.mdl", - "models/hunter/misc/sphere375x375.mdl" - }, + -- Choose material + local material = data.materials + if istable(data.materials) then + material = table.Random(materials) + elseif not material then + material = "plastic" + end + + if GAMEMODE.PropSpawnTimer < CurTime() then + -- Spawn a prop at every spawner + for k, v in pairs(ents.FindByClass("inc_prop_spawner")) do + local ent = ents.Create("prop_physics") + ent:SetModel(props[math.random(1, #props)]) + ent:SetPos(v:GetPos()) + ent:Spawn() + + -- Set physical properties + local phys = ent:GetPhysicsObject() + phys:SetMass(40000) + phys:SetMaterial(material) - func = function(e) - local c = HSVToColor(math.random(360),1,1) - e:SetColor(c) + -- Call the data function on every entity + if data.func then + data.func(ent) + end + end + + GAMEMODE.PropSpawnTimer = CurTime() + (data.delay or 2) end -} \ No newline at end of file +end) + +-- Randomly pick a group of props +-- Todo: Map flexibility +hook.Add("PreRoundStart", "IncomingPropsChange", function() + GAMEMODE.CurrentPropsCategory = table.Random(table.GetKeys(GAMEMODE.PropPresets)) +end) \ No newline at end of file diff --git a/fluffy_incoming/gamemode/sv_prop_presets.lua b/fluffy_incoming/gamemode/sv_prop_presets.lua new file mode 100644 index 0000000..601c547 --- /dev/null +++ b/fluffy_incoming/gamemode/sv_prop_presets.lua @@ -0,0 +1,113 @@ +-- If you're adding new prop presets here, please remember to update the .fgd! +GM.PropPresets = {} +GM.PropPresets["Geometric"] = { + models = { + "models/clannv/incoming/box/box1.mdl", + "models/clannv/incoming/box/box2.mdl", + "models/clannv/incoming/box/box3.mdl", + "models/clannv/incoming/cone/cone1.mdl", + "models/clannv/incoming/cone/cone2.mdl", + "models/clannv/incoming/cone/cone3.mdl", + "models/clannv/incoming/cylinder/cylinder1.mdl", + "models/clannv/incoming/cylinder/cylinder2.mdl", + "models/clannv/incoming/cylinder/cylinder3.mdl", + "models/clannv/incoming/hexagon/hexagon1.mdl", + "models/clannv/incoming/hexagon/hexagon2.mdl", + "models/clannv/incoming/hexagon/hexagon3.mdl", + "models/clannv/incoming/pentagon/pentagon1.mdl", + "models/clannv/incoming/pentagon/pentagon2.mdl", + "models/clannv/incoming/pentagon/pentagon3.mdl", + "models/clannv/incoming/sphere/sphere1.mdl", + "models/clannv/incoming/sphere/sphere2.mdl", + "models/clannv/incoming/sphere/sphere3.mdl", + "models/clannv/incoming/triangle/triangle1.mdl", + "models/clannv/incoming/triangle/triangle2.mdl", + "models/clannv/incoming/triangle/triangle3.mdl" + } +} + +GM.PropPresets["Vehicles"] = { + models = { + "models/props_vehicles/van001a_physics.mdl", + "models/props_vehicles/car001a_hatchback.mdl", + "models/props_vehicles/car001b_hatchback.mdl", + "models/props_vehicles/car002a_physics.mdl", + "models/props_vehicles/car002b_physics.mdl", + "models/props_vehicles/car003a_physics.mdl", + "models/props_vehicles/car003b_physics.mdl", + "models/props_vehicles/car004a_physics.mdl", + "models/props_vehicles/car004b_physics.mdl", + "models/props_vehicles/car005a_physics.mdl", + "models/props_vehicles/car005b_physics.mdl", + "models/props_vehicles/apc001.mdl", + "models/props_vehicles/trailer001a.mdl", + "models/props_vehicles/trailer002a.mdl", + "models/props_vehicles/truck001a.mdl", + "models/props_vehicles/truck003a.mdl" + } +} + +GM.PropPresets["Geometric and Vehicles"] = { + models = { + "models/props_vehicles/van001a_physics.mdl", + "models/props_vehicles/car001a_hatchback.mdl", + "models/props_vehicles/car001b_hatchback.mdl", + "models/props_vehicles/car002a_physics.mdl", + "models/props_vehicles/car002b_physics.mdl", + "models/props_vehicles/car003a_physics.mdl", + "models/props_vehicles/car003b_physics.mdl", + "models/props_vehicles/car004a_physics.mdl", + "models/props_vehicles/car004b_physics.mdl", + "models/props_vehicles/car005a_physics.mdl", + "models/props_vehicles/car005b_physics.mdl", + "models/props_vehicles/apc001.mdl", + "models/props_vehicles/trailer001a.mdl", + "models/props_vehicles/trailer002a.mdl", + "models/props_vehicles/truck001a.mdl", + "models/props_vehicles/truck003a.mdl", + "models/clannv/incoming/box/box1.mdl", + "models/clannv/incoming/box/box2.mdl", + "models/clannv/incoming/box/box3.mdl", + "models/clannv/incoming/cone/cone1.mdl", + "models/clannv/incoming/cone/cone2.mdl", + "models/clannv/incoming/cone/cone3.mdl", + "models/clannv/incoming/cylinder/cylinder1.mdl", + "models/clannv/incoming/cylinder/cylinder2.mdl", + "models/clannv/incoming/cylinder/cylinder3.mdl", + "models/clannv/incoming/hexagon/hexagon1.mdl", + "models/clannv/incoming/hexagon/hexagon2.mdl", + "models/clannv/incoming/hexagon/hexagon3.mdl", + "models/clannv/incoming/pentagon/pentagon1.mdl", + "models/clannv/incoming/pentagon/pentagon2.mdl", + "models/clannv/incoming/pentagon/pentagon3.mdl", + "models/clannv/incoming/sphere/sphere1.mdl", + "models/clannv/incoming/sphere/sphere2.mdl", + "models/clannv/incoming/sphere/sphere3.mdl", + "models/clannv/incoming/triangle/triangle1.mdl", + "models/clannv/incoming/triangle/triangle2.mdl", + "models/clannv/incoming/triangle/triangle3.mdl" + } +} + +GM.PropPresets["Cubes And Spheres"] = { + models = { + "models/hunter/blocks/cube05x05x05.mdl", + "models/hunter/blocks/cube075x075x075.mdl", + "models/hunter/blocks/cube1x1x1.mdl", + "models/hunter/blocks/cube1x150x1.mdl", + "models/hunter/blocks/cube1x6x1.mdl", + "models/hunter/blocks/cube2x2x2.mdl", + "models/hunter/blocks/cube2x4x1.mdl", + "models/hunter/blocks/cube2x6x1.mdl", + "models/hunter/blocks/cube4x4x4.mdl", + "models/hunter/misc/sphere175x175.mdl", + "models/hunter/misc/sphere1x1.mdl", + "models/hunter/misc/sphere2x2.mdl", + "models/hunter/misc/sphere375x375.mdl" + }, + + func = function(e) + local c = HSVToColor(math.random(360),1,1) + e:SetColor(c) + end +} \ No newline at end of file From ab44fd47554dc2f29b44f88d61ab690237c624fb Mon Sep 17 00:00:00 2001 From: Robert Fraser Date: Wed, 14 Oct 2020 16:06:53 +1000 Subject: [PATCH 18/38] Fix --- fluffy_incoming/gamemode/sv_maps.lua | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/fluffy_incoming/gamemode/sv_maps.lua b/fluffy_incoming/gamemode/sv_maps.lua index f6fc249..ba3163e 100644 --- a/fluffy_incoming/gamemode/sv_maps.lua +++ b/fluffy_incoming/gamemode/sv_maps.lua @@ -9,7 +9,7 @@ hook.Add("Tick", "TickPropSpawn", function() -- Get information from the currently selected props category -- See sv_maps for the prop data - local data = GAMEMODE.DefaultProps[GAMEMODE.CurrentPropsCategory] + local data = GAMEMODE.PropPresets[GAMEMODE.CurrentPropsCategory] local props = data.models -- Choose material From a50157ec22d2bdd5461673a0eb08c592ffed8db6 Mon Sep 17 00:00:00 2001 From: Robert Fraser Date: Wed, 14 Oct 2020 16:18:23 +1000 Subject: [PATCH 19/38] Base: Improve header comments --- fluffy_duckhunt/gamemode/shared.lua | 8 +----- fluffy_mg_base/gamemode/cl_announcements.lua | 1 + fluffy_mg_base/gamemode/cl_chat.lua | 6 +++- fluffy_mg_base/gamemode/cl_crosshair.lua | 1 + fluffy_mg_base/gamemode/cl_endgame.lua | 11 +++++++- fluffy_mg_base/gamemode/cl_hud.lua | 2 +- fluffy_mg_base/gamemode/cl_init.lua | 1 + fluffy_mg_base/gamemode/cl_killfeed.lua | 5 +++- fluffy_mg_base/gamemode/cl_playerpanel.lua | 8 +++++- fluffy_mg_base/gamemode/cl_round_state.lua | 29 ++++++++++++-------- fluffy_mg_base/gamemode/cl_scoreboard.lua | 6 ++-- fluffy_mg_base/gamemode/cl_thirdperson.lua | 1 + fluffy_mg_base/gamemode/gametype_hunter.lua | 1 + fluffy_mg_base/gamemode/init.lua | 1 - fluffy_mg_base/gamemode/shared.lua | 12 ++++---- fluffy_mg_base/gamemode/sv_announcements.lua | 1 + fluffy_mg_base/gamemode/sv_database.lua | 10 +++++-- fluffy_mg_base/gamemode/sv_levels.lua | 1 + fluffy_mg_base/gamemode/sv_mapedits.lua | 2 ++ fluffy_mg_base/gamemode/sv_round.lua | 3 +- fluffy_mg_base/gamemode/sv_spectating.lua | 5 ++-- fluffy_mg_base/gamemode/sv_stats.lua | 4 +-- fluffy_mg_base/gamemode/sv_teams.lua | 7 ++++- fluffy_mg_base/gamemode/sv_voting.lua | 3 +- fluffy_suicidebarrels/gamemode/shared.lua | 8 +----- 25 files changed, 86 insertions(+), 51 deletions(-) diff --git a/fluffy_duckhunt/gamemode/shared.lua b/fluffy_duckhunt/gamemode/shared.lua index bf21886..76a9d9c 100644 --- a/fluffy_duckhunt/gamemode/shared.lua +++ b/fluffy_duckhunt/gamemode/shared.lua @@ -1,10 +1,4 @@ ---[[ - Robert A Fraser 2018 - Duck Hunt - Originally by Niandra Lades -]] --- -DeriveGamemode("fluffy_mg_base") +DeriveGamemode("fluffy_mg_base") GM.Name = "Duck Hunt" GM.Author = "FluffyXVI" GM.HelpText = [[ diff --git a/fluffy_mg_base/gamemode/cl_announcements.lua b/fluffy_mg_base/gamemode/cl_announcements.lua index 4d7ef61..4e82e93 100644 --- a/fluffy_mg_base/gamemode/cl_announcements.lua +++ b/fluffy_mg_base/gamemode/cl_announcements.lua @@ -7,6 +7,7 @@ - Pulse - Pulse w/ subtext --]] + -- Draw text that can be scaled -- Useful for cool animations without creating lost of different font sizes local function drawScaledText(x, y, text, font, color, scale) diff --git a/fluffy_mg_base/gamemode/cl_chat.lua b/fluffy_mg_base/gamemode/cl_chat.lua index 5d16a64..f506e88 100644 --- a/fluffy_mg_base/gamemode/cl_chat.lua +++ b/fluffy_mg_base/gamemode/cl_chat.lua @@ -1,4 +1,8 @@ -local minigames_chat_commands = {} +--[[ + Handle clientside chat commands +--]] + +local minigames_chat_commands = {} minigames_chat_commands["!crosshair"] = "mg_crosshair_editor" minigames_chat_commands["!help"] = "mg_info" minigames_chat_commands["!team"] = "mg_team" diff --git a/fluffy_mg_base/gamemode/cl_crosshair.lua b/fluffy_mg_base/gamemode/cl_crosshair.lua index ea6ccf7..5a01964 100644 --- a/fluffy_mg_base/gamemode/cl_crosshair.lua +++ b/fluffy_mg_base/gamemode/cl_crosshair.lua @@ -3,6 +3,7 @@ Creates the convars that are in charge of the crosshairs Also adds the crosshair editor --]] + -- Custom crosshair convars local crosshair_outlined = CreateClientConVar("crosshair_outlined", 1, true, false) local crosshair_image = CreateClientConVar("crosshair_image", "crosshair012.png", true, false) diff --git a/fluffy_mg_base/gamemode/cl_endgame.lua b/fluffy_mg_base/gamemode/cl_endgame.lua index 7397062..dbdfecf 100644 --- a/fluffy_mg_base/gamemode/cl_endgame.lua +++ b/fluffy_mg_base/gamemode/cl_endgame.lua @@ -6,7 +6,16 @@ - Map vote screen - Stats / leaderboard overview --]] -local sounds = {"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/coast/odessa/female01/nlo_cheer01.wav", "vo/coast/odessa/female01/nlo_cheer02.wav", "vo/coast/odessa/female01/nlo_cheer03.wav",} + +local sounds = { + "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/coast/odessa/female01/nlo_cheer01.wav", + "vo/coast/odessa/female01/nlo_cheer02.wav", + "vo/coast/odessa/female01/nlo_cheer03.wav" +} function GM:OpenEndGamePanel() local frame = vgui.Create("DFrame") diff --git a/fluffy_mg_base/gamemode/cl_hud.lua b/fluffy_mg_base/gamemode/cl_hud.lua index 042d8ee..dfc1f6b 100644 --- a/fluffy_mg_base/gamemode/cl_hud.lua +++ b/fluffy_mg_base/gamemode/cl_hud.lua @@ -1,5 +1,5 @@ --[[ - Welcome to the Minigames HUD v2! + Welcome to the Minigames HUD v3! This file has been pretty much completely made for lots of improvements around the board! Note: this HUD isn't the most efficient thing ever created, but the latest updates have improved framerates significantly. --]] diff --git a/fluffy_mg_base/gamemode/cl_init.lua b/fluffy_mg_base/gamemode/cl_init.lua index 86e037a..1caf1ef 100644 --- a/fluffy_mg_base/gamemode/cl_init.lua +++ b/fluffy_mg_base/gamemode/cl_init.lua @@ -3,6 +3,7 @@ This mostly just registers fonts and colors Most other HUD stuff is in the other client files --]] + -- Include useful files include("shared.lua") include("cl_announcements.lua") diff --git a/fluffy_mg_base/gamemode/cl_killfeed.lua b/fluffy_mg_base/gamemode/cl_killfeed.lua index 0bd6f1b..a7e37bc 100644 --- a/fluffy_mg_base/gamemode/cl_killfeed.lua +++ b/fluffy_mg_base/gamemode/cl_killfeed.lua @@ -1,4 +1,7 @@ --- I stole this from sandbox/base which is why the variable naming sucks so much +--[[ + Handle everything to do with the killfeed + This is blatantly stolen from the base gamemode, so apologies for the terrible naming +--]] local hud_deathnotice_time_cvar = CreateClientConVar("mg_deathnotice_time", "6", true, false, "Amount of time to show death notice") local have_killsound_cvar = CreateClientConVar("mg_killsound_enabled", 1, true, false, "Enable a sound effect when you get a kill") diff --git a/fluffy_mg_base/gamemode/cl_playerpanel.lua b/fluffy_mg_base/gamemode/cl_playerpanel.lua index fe3cc6d..ca8a869 100644 --- a/fluffy_mg_base/gamemode/cl_playerpanel.lua +++ b/fluffy_mg_base/gamemode/cl_playerpanel.lua @@ -1,4 +1,10 @@ -local lightblue = Color(0, 168, 255) +--[[ + Draw the player panel, also known as the MOTD + This is the first thing the player sees upon joining + and contains Rules, Teams, etc. +--]] + +local lightblue = Color(0, 168, 255) local darkblue = Color(0, 151, 230) local white = Color(241, 242, 246) local offwhite = Color(223, 228, 234) diff --git a/fluffy_mg_base/gamemode/cl_round_state.lua b/fluffy_mg_base/gamemode/cl_round_state.lua index 719bdd5..b9a6bcd 100644 --- a/fluffy_mg_base/gamemode/cl_round_state.lua +++ b/fluffy_mg_base/gamemode/cl_round_state.lua @@ -1,15 +1,20 @@ --- HUD enums so the numbers make actual sense -HUD_STYLE_DEFAULT = 1 -- Simple clock with round counter attached -HUD_STYLE_TIMER = 2 -- Simple clock with game timer attached -HUD_STYLE_TIMER_ONLY = 3 -- Large timer instead of clock -HUD_STYLE_TEAM_SCORE = 4 -- Large timer, with team scores underneath -HUD_STYLE_TEAM_SCORE_ROUNDS = 5 -- Large timer, with team round wins underneath -HUD_STYLE_TEAM_SCORE_SINGLE = 6 -- Large timer, with single team score underneath -HUD_STYLE_CLOCK_TEAM_SCORE = 7 -- Simple clock, with team scores underneath -HUD_STYLE_CLOCK_TEAM_SCORE_ROUNDS = 8 -- Simple clock, with team round wins underneath -HUD_STYLE_CLOCK_TEAM_SCORE_SINGLE = 9 -- Simple clock, with single team score underneath -HUD_STYLE_CLOCK_ALIVE = 10 -- Simple clock, with number of alive players underneath -HUD_STYLE_CLOCK_TIMER_ALIVE = 11 -- Simple clock, with game timer attached + number of alive players underneath +--[[ + Rounds are complicated - this contains all the round state options that can be used +--]] + +-- HUD enums so the numbers make actual sense +HUD_STYLE_DEFAULT = 1 -- Simple clock with round counter attached +HUD_STYLE_TIMER = 2 -- Simple clock with game timer attached +HUD_STYLE_TIMER_ONLY = 3 -- Large timer instead of clock +HUD_STYLE_TEAM_SCORE = 4 -- Large timer, with team scores underneath +HUD_STYLE_TEAM_SCORE_ROUNDS = 5 -- Large timer, with team round wins underneath +HUD_STYLE_TEAM_SCORE_SINGLE = 6 -- Large timer, with single team score underneath +HUD_STYLE_CLOCK_TEAM_SCORE = 7 -- Simple clock, with team scores underneath +HUD_STYLE_CLOCK_TEAM_SCORE_ROUNDS = 8 -- Simple clock, with team round wins underneath +HUD_STYLE_CLOCK_TEAM_SCORE_SINGLE = 9 -- Simple clock, with single team score underneath +HUD_STYLE_CLOCK_ALIVE = 10 -- Simple clock, with number of alive players underneath +HUD_STYLE_CLOCK_TIMER_ALIVE = 11 -- Simple clock, with game timer attached + number of alive players underneath + -- These should match cl_hud local c_pos = 72 local seg = 36 diff --git a/fluffy_mg_base/gamemode/cl_scoreboard.lua b/fluffy_mg_base/gamemode/cl_scoreboard.lua index 290bbf6..e7fea65 100644 --- a/fluffy_mg_base/gamemode/cl_scoreboard.lua +++ b/fluffy_mg_base/gamemode/cl_scoreboard.lua @@ -1,9 +1,7 @@ --[[ - This file was originally not part of the gamemode - It has not been adapted to use GM: functions yet - This file is a bit of messy - I'll get around to reworking it one day I promise + Draw the scoreboard --]] + function GM:CreateScoreboard(force) if IsValid(GAMEMODE.Scoreboard) and not force then return end local scoreboard = vgui.Create("DFrame") diff --git a/fluffy_mg_base/gamemode/cl_thirdperson.lua b/fluffy_mg_base/gamemode/cl_thirdperson.lua index a408800..41f91db 100644 --- a/fluffy_mg_base/gamemode/cl_thirdperson.lua +++ b/fluffy_mg_base/gamemode/cl_thirdperson.lua @@ -2,6 +2,7 @@ Handler for the thirdperson code Set the shared variable GM.ThirdpersonEnabled to use this file --]] + -- Thirdperson toggle when F3 (default) is pressed hook.Add("PlayerBindPress", "ThirdpersonToggle", function(ply, bind, pressed) if bind == "gm_showspare1" and pressed then diff --git a/fluffy_mg_base/gamemode/gametype_hunter.lua b/fluffy_mg_base/gamemode/gametype_hunter.lua index 7ecd72f..1a57db7 100644 --- a/fluffy_mg_base/gamemode/gametype_hunter.lua +++ b/fluffy_mg_base/gamemode/gametype_hunter.lua @@ -2,6 +2,7 @@ Useful functions that are used for TeamSurvival gamemodes Examples: Suicide Barrels --]] + -- Make new players join the Hunter team on connection hook.Add("PlayerInitialSpawn", "HunterTeamAssignment", function(ply) if GAMEMODE.TeamSurvival and GAMEMODE.HunterTeam then diff --git a/fluffy_mg_base/gamemode/init.lua b/fluffy_mg_base/gamemode/init.lua index a501750..aa79d26 100644 --- a/fluffy_mg_base/gamemode/init.lua +++ b/fluffy_mg_base/gamemode/init.lua @@ -1,6 +1,5 @@ --[[ The core of the gamemode - Probably needs to be split into some more files at this point --]] -- Send all the required files to the client diff --git a/fluffy_mg_base/gamemode/shared.lua b/fluffy_mg_base/gamemode/shared.lua index 40190cf..7dc3a8a 100644 --- a/fluffy_mg_base/gamemode/shared.lua +++ b/fluffy_mg_base/gamemode/shared.lua @@ -1,10 +1,10 @@ --[[ - Robert A Fraser 2018 - Minigames Reborn - - Base file for the gamemode which is loaded on both client and server -]] --- + Shared file for the base gamemode + + This file lists all the settings that can be added + This also adds some team functions, and a bunch of other utilities +--]] + -- Load the other shared files DeriveGamemode("base") include("sound_tables.lua") diff --git a/fluffy_mg_base/gamemode/sv_announcements.lua b/fluffy_mg_base/gamemode/sv_announcements.lua index e1d82bb..ea6de8f 100644 --- a/fluffy_mg_base/gamemode/sv_announcements.lua +++ b/fluffy_mg_base/gamemode/sv_announcements.lua @@ -3,6 +3,7 @@ Mostly just a net handler See cl_announcements.lua for more information --]] + -- Serverside function for making a countdown announcement function GM:CountdownAnnouncement(length, endtext, location, endsound, ticksound) local tbl = { diff --git a/fluffy_mg_base/gamemode/sv_database.lua b/fluffy_mg_base/gamemode/sv_database.lua index bb7690e..02f42a9 100644 --- a/fluffy_mg_base/gamemode/sv_database.lua +++ b/fluffy_mg_base/gamemode/sv_database.lua @@ -1,6 +1,12 @@ --- Database configuration is stored in db_config --- This means I can upload this file to github or whatever without leaking my DB password +--[[ + Handles the database connection and running queries +--]] + +-- Database configuration is loaded from this file +-- This file is not included in the Git repository +-- See the documentation for what should go in this file include("db_config.lua") + GM.MinigamesPQueries = {} CreateConVar("mg_db_enabled", 1, FCVAR_NONE, "Should the Minigames DB be enabled?") diff --git a/fluffy_mg_base/gamemode/sv_levels.lua b/fluffy_mg_base/gamemode/sv_levels.lua index f40674a..c667144 100644 --- a/fluffy_mg_base/gamemode/sv_levels.lua +++ b/fluffy_mg_base/gamemode/sv_levels.lua @@ -2,6 +2,7 @@ Serverside handling of levels This includes the database interface for XP --]] + -- Prepare some prepared queries to make database stuff faster and more secure hook.Add("InitPostEntity", "PrepareLevelStuff", function() local db = GAMEMODE:CheckDBConnection() diff --git a/fluffy_mg_base/gamemode/sv_mapedits.lua b/fluffy_mg_base/gamemode/sv_mapedits.lua index 2d5c48a..7f76b72 100644 --- a/fluffy_mg_base/gamemode/sv_mapedits.lua +++ b/fluffy_mg_base/gamemode/sv_mapedits.lua @@ -3,6 +3,8 @@ This allows for server owners to update maps to suit various gamemodes This data is stored locally in server data files --]] + +-- Spawnpoint classes that can be added by the spawn tool local spawnpoint_classes = {"info_player_start", "info_player_terrorist", "info_player_counterterrorist"} -- Load configured map override properties from a file diff --git a/fluffy_mg_base/gamemode/sv_round.lua b/fluffy_mg_base/gamemode/sv_round.lua index 5daa140..40164e1 100644 --- a/fluffy_mg_base/gamemode/sv_round.lua +++ b/fluffy_mg_base/gamemode/sv_round.lua @@ -4,9 +4,10 @@ - PreRoundStart - RoundStart - RoundEnd - Please don't override the functions unless absolutely critical + Please don't override the functions unless absolutely critical - use hooks! Some functions regarding winning conditions are designed to be overridden --]] + -- Thinking for round coordination -- Usually check for round start and end conditions hook.Add("Think", "MinigamesRoundThink", function() diff --git a/fluffy_mg_base/gamemode/sv_spectating.lua b/fluffy_mg_base/gamemode/sv_spectating.lua index ba7a5d5..675747d 100644 --- a/fluffy_mg_base/gamemode/sv_spectating.lua +++ b/fluffy_mg_base/gamemode/sv_spectating.lua @@ -1,8 +1,9 @@ --[[ - Spectating functionality is contained in this file + Spectating functionality is handled in this file - Pending reworks! + This handles moving players to spectator upon death, and also moving around as spectator --]] + -- Fairly self-explanatory function GM:PlayerSpawnAsSpectator(ply, mode, target) if ply:Alive() then diff --git a/fluffy_mg_base/gamemode/sv_stats.lua b/fluffy_mg_base/gamemode/sv_stats.lua index d0d3595..38268d9 100644 --- a/fluffy_mg_base/gamemode/sv_stats.lua +++ b/fluffy_mg_base/gamemode/sv_stats.lua @@ -3,8 +3,8 @@ Useful for tracking kills, round wins, damage dealt, etc. Ties in with sv_levels.lua to convert these stats to XP at the end of the game Use this wherever possible! Stats are always fun to have! -]] --- +--]] + GM.StatsTracking = {} -- Prepare some prepared queries to make database stuff faster and more secure diff --git a/fluffy_mg_base/gamemode/sv_teams.lua b/fluffy_mg_base/gamemode/sv_teams.lua index b0ca425..d22f110 100644 --- a/fluffy_mg_base/gamemode/sv_teams.lua +++ b/fluffy_mg_base/gamemode/sv_teams.lua @@ -1,4 +1,9 @@ -function GM:PlayerRequestTeam(ply, teamid) +--[[ + Handles player management of teams + This controls when and how players are allowed to change teams +--]] + +function GM:PlayerRequestTeam(ply, teamid) -- If players are spectating, they can change to Unassigned (and vice versa) -- This only applies in some cases where general team switching won't fly -- tidy this up at some point diff --git a/fluffy_mg_base/gamemode/sv_voting.lua b/fluffy_mg_base/gamemode/sv_voting.lua index 52ea125..aa97c9f 100644 --- a/fluffy_mg_base/gamemode/sv_voting.lua +++ b/fluffy_mg_base/gamemode/sv_voting.lua @@ -1,7 +1,8 @@ --[[ Handles the map and gamemode rotation system - Map icons are delivered via. webserver + Map icons are delivered via. webserver (todo: add convar for this) --]] + -- List of gamemodes in rotation -- This sanity checks the keys provided in the rotation file + provides nice names -- is there a better way to store this? diff --git a/fluffy_suicidebarrels/gamemode/shared.lua b/fluffy_suicidebarrels/gamemode/shared.lua index 4f56712..4640617 100644 --- a/fluffy_suicidebarrels/gamemode/shared.lua +++ b/fluffy_suicidebarrels/gamemode/shared.lua @@ -1,10 +1,4 @@ ---[[ - Robert A Fraser 2018 - Suicide Barrels - Inspired by countless prior gmod gamemodes -]] --- -DeriveGamemode("fluffy_mg_base") +DeriveGamemode("fluffy_mg_base") GM.Name = "Suicide Barrels" GM.Author = "FluffyXVI" GM.HelpText = [[ From 1f8076b856c03e76458ebc7cbf5efbeba77cb31d Mon Sep 17 00:00:00 2001 From: Robert Fraser Date: Wed, 14 Oct 2020 22:08:46 +1000 Subject: [PATCH 20/38] Move convars to shared file wip --- fluffy_mg_base/gamemode/sh_convars.lua | 13 +++++++++++++ fluffy_mg_base/gamemode/sh_scorehelper.lua | 4 ++-- 2 files changed, 15 insertions(+), 2 deletions(-) create mode 100644 fluffy_mg_base/gamemode/sh_convars.lua diff --git a/fluffy_mg_base/gamemode/sh_convars.lua b/fluffy_mg_base/gamemode/sh_convars.lua new file mode 100644 index 0000000..d5178f6 --- /dev/null +++ b/fluffy_mg_base/gamemode/sh_convars.lua @@ -0,0 +1,13 @@ +--[[ + All convars are created in this file +--]] + +-- Shared convars + +if SERVER then + -- Server-specific convars + +elseif CLIENT then + -- Client-specific convars + +end \ No newline at end of file diff --git a/fluffy_mg_base/gamemode/sh_scorehelper.lua b/fluffy_mg_base/gamemode/sh_scorehelper.lua index 1e8b94a..a7978da 100644 --- a/fluffy_mg_base/gamemode/sh_scorehelper.lua +++ b/fluffy_mg_base/gamemode/sh_scorehelper.lua @@ -1,7 +1,7 @@ --[[ A small handful of score-related utility functions -]] --- +--]] + -- Return a table of {player, score} pairs, sorted by highest score -- Can specify an optional scoring function, defaults to frags function GM:GetSortedScores(func) From e2d8b689dabef85853222954d3170233b6eb6dbe Mon Sep 17 00:00:00 2001 From: Robert Fraser Date: Wed, 14 Oct 2020 22:31:29 +1000 Subject: [PATCH 21/38] Incoming: Checkpoint entities --- .../entities/inc_checkpoint_activator.lua | 16 ++++++++++++++++ .../entities/entities/inc_checkpoint_spawn.lua | 7 +++++++ fluffy_incoming/gamemode/init.lua | 12 ++++++++++++ fluffy_incoming/gamemode/sv_maps.lua | 2 +- 4 files changed, 36 insertions(+), 1 deletion(-) create mode 100644 fluffy_incoming/entities/entities/inc_checkpoint_activator.lua create mode 100644 fluffy_incoming/entities/entities/inc_checkpoint_spawn.lua diff --git a/fluffy_incoming/entities/entities/inc_checkpoint_activator.lua b/fluffy_incoming/entities/entities/inc_checkpoint_activator.lua new file mode 100644 index 0000000..af71468 --- /dev/null +++ b/fluffy_incoming/entities/entities/inc_checkpoint_activator.lua @@ -0,0 +1,16 @@ +ENT.Type = "brush" + +function ENT:StartTouch(ent) + if not ent:IsPlayer() then return end + if not GAMEMODE:InRound() then return end + + GAMEMODE:CheckpointTriggered(ent, self.CheckpointStage, self.CheckpointMessage) +end + +function ENT:KeyValue(key, value) + if key == "stage" then + self.CheckpointStage = tonumber(value) + elseif key == "message" then + self.CheckpointMessage = value + end +end \ No newline at end of file diff --git a/fluffy_incoming/entities/entities/inc_checkpoint_spawn.lua b/fluffy_incoming/entities/entities/inc_checkpoint_spawn.lua new file mode 100644 index 0000000..39702e2 --- /dev/null +++ b/fluffy_incoming/entities/entities/inc_checkpoint_spawn.lua @@ -0,0 +1,7 @@ +ENT.Type = "point" + +function ENT:KeyValue(key, value) + if key == "stage" then + self.CheckpointStage = value + end +end \ No newline at end of file diff --git a/fluffy_incoming/gamemode/init.lua b/fluffy_incoming/gamemode/init.lua index 7234ccf..f1953c5 100644 --- a/fluffy_incoming/gamemode/init.lua +++ b/fluffy_incoming/gamemode/init.lua @@ -15,6 +15,18 @@ hook.Add("PreRoundStart", "IncomingResetBestDistance", function() end end) +-- Trigger checkpoints +function GM:CheckpointTriggered(ply, stage, message) + if ply.CheckpointStage and stage < ply.CheckpointStage then return end + ply.CheckpointStage = stage + + if message then + GAMEMODE:PulseAnnouncementTwoLine(3, "Checkpoint!", message) + else + GAMEMODE:PulseAnnouncement(3, "Checkpoint!") + end +end + -- Get the distance the player has to the end function GM:GetDistanceToEnd(ply) local endpos = GAMEMODE:EndingPoint() diff --git a/fluffy_incoming/gamemode/sv_maps.lua b/fluffy_incoming/gamemode/sv_maps.lua index ba3163e..283b31d 100644 --- a/fluffy_incoming/gamemode/sv_maps.lua +++ b/fluffy_incoming/gamemode/sv_maps.lua @@ -1,6 +1,6 @@ include("sv_prop_presets.lua") -GM.CurrentPropsCategory = "Both" +GM.CurrentPropsCategory = "Geometric" GM.PropSpawnTimer = 0 -- Spawn props at appropiate times From 3c5c581f7d37275e88726f960b293683d61c9197 Mon Sep 17 00:00:00 2001 From: Robert Fraser Date: Wed, 14 Oct 2020 22:57:45 +1000 Subject: [PATCH 22/38] Incoming: Checkpoint spawns --- .../entities/inc_checkpoint_spawn.lua | 2 +- fluffy_incoming/gamemode/init.lua | 32 ++++++++++++++++++- 2 files changed, 32 insertions(+), 2 deletions(-) diff --git a/fluffy_incoming/entities/entities/inc_checkpoint_spawn.lua b/fluffy_incoming/entities/entities/inc_checkpoint_spawn.lua index 39702e2..7bb9f5f 100644 --- a/fluffy_incoming/entities/entities/inc_checkpoint_spawn.lua +++ b/fluffy_incoming/entities/entities/inc_checkpoint_spawn.lua @@ -2,6 +2,6 @@ ENT.Type = "point" function ENT:KeyValue(key, value) if key == "stage" then - self.CheckpointStage = value + self.CheckpointStage = tonumber(value) end end \ No newline at end of file diff --git a/fluffy_incoming/gamemode/init.lua b/fluffy_incoming/gamemode/init.lua index f1953c5..ff5d6e3 100644 --- a/fluffy_incoming/gamemode/init.lua +++ b/fluffy_incoming/gamemode/init.lua @@ -5,19 +5,21 @@ include("sv_maps.lua") -- Record starting distances hook.Add("PlayerSpawn", "IncomingCheckSpawnDistance", function(ply) + if ply.CheckpointStage and ply.CheckpointStage > 0 then return end ply.StartingDistance = GAMEMODE:GetDistanceToEnd(ply) end) -- Reset best distances on round start hook.Add("PreRoundStart", "IncomingResetBestDistance", function() for k, v in pairs(player.GetAll()) do + v.CheckpointStage = 0 v.BestDistance = nil end end) -- Trigger checkpoints function GM:CheckpointTriggered(ply, stage, message) - if ply.CheckpointStage and stage < ply.CheckpointStage then return end + if ply.CheckpointStage and stage <= ply.CheckpointStage then return end ply.CheckpointStage = stage if message then @@ -27,6 +29,34 @@ function GM:CheckpointTriggered(ply, stage, message) end end +-- Select player spawn based on checkpoint stage +function GM:PlayerSelectSpawn(ply) + local stage = ply.CheckpointStage + if not stage or stage < 1 then + return GAMEMODE.BaseClass:PlayerSelectSpawn(ply) + end + + -- Sort checkpoint spawns by stage + if not GAMEMODE.CheckpointSpawns then GAMEMODE.CheckpointSpawns = {} end + if not GAMEMODE.CheckpointSpawns[stage] or not IsTableOfEntitiesValid(GAMEMODE.CheckpointSpawns[stage]) then + local spawns = ents.FindByClass("inc_checkpoint_spawn") + for _,v in pairs(spawns) do + local spawnStage = v.CheckpointStage + if not GAMEMODE.CheckpointSpawns[spawnStage] then GAMEMODE.CheckpointSpawns[spawnStage] = {} end + + table.insert(GAMEMODE.CheckpointSpawns[spawnStage], v) + end + end + + -- Get checkpoint spawns for this level + local stageSpawns = GAMEMODE.CheckpointSpawns[spawnStage] + if not stageSpawns then + return GAMEMODE.BaseClass:PlayerSelectSpawn(ply) + end + + return GAMEMODE:AttemptSpawnPoint(ply, stageSpawns) +end + -- Get the distance the player has to the end function GM:GetDistanceToEnd(ply) local endpos = GAMEMODE:EndingPoint() From 0178461b4fbd5581a0e1afe0d4d8e26b3ec89119 Mon Sep 17 00:00:00 2001 From: Robert Fraser Date: Wed, 14 Oct 2020 22:58:23 +1000 Subject: [PATCH 23/38] Stop missing models from smothering servers with a pillow --- fluffy_incoming/gamemode/sv_maps.lua | 2 ++ 1 file changed, 2 insertions(+) diff --git a/fluffy_incoming/gamemode/sv_maps.lua b/fluffy_incoming/gamemode/sv_maps.lua index 283b31d..fedffaf 100644 --- a/fluffy_incoming/gamemode/sv_maps.lua +++ b/fluffy_incoming/gamemode/sv_maps.lua @@ -30,6 +30,8 @@ hook.Add("Tick", "TickPropSpawn", function() -- Set physical properties local phys = ent:GetPhysicsObject() + if not IsValid(phys) then return end + phys:SetMass(40000) phys:SetMaterial(material) From cc429c40bb09a60ab20420a779ca474269fc60b2 Mon Sep 17 00:00:00 2001 From: Robert Fraser Date: Wed, 14 Oct 2020 23:06:29 +1000 Subject: [PATCH 24/38] Incoming: Fix bug in checkpoint spawning --- fluffy_incoming/gamemode/init.lua | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/fluffy_incoming/gamemode/init.lua b/fluffy_incoming/gamemode/init.lua index ff5d6e3..4331e58 100644 --- a/fluffy_incoming/gamemode/init.lua +++ b/fluffy_incoming/gamemode/init.lua @@ -49,7 +49,7 @@ function GM:PlayerSelectSpawn(ply) end -- Get checkpoint spawns for this level - local stageSpawns = GAMEMODE.CheckpointSpawns[spawnStage] + local stageSpawns = GAMEMODE.CheckpointSpawns[stage] if not stageSpawns then return GAMEMODE.BaseClass:PlayerSelectSpawn(ply) end From d46ce9878ffcf9947323872aa556f7748b5587f5 Mon Sep 17 00:00:00 2001 From: Robert Fraser Date: Wed, 14 Oct 2020 23:09:55 +1000 Subject: [PATCH 25/38] Props now spawn in pre-round phase --- fluffy_incoming/gamemode/sv_maps.lua | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/fluffy_incoming/gamemode/sv_maps.lua b/fluffy_incoming/gamemode/sv_maps.lua index fedffaf..5017117 100644 --- a/fluffy_incoming/gamemode/sv_maps.lua +++ b/fluffy_incoming/gamemode/sv_maps.lua @@ -5,7 +5,8 @@ GM.PropSpawnTimer = 0 -- Spawn props at appropiate times hook.Add("Tick", "TickPropSpawn", function() - if not GAMEMODE:InRound() then return end + local roundstate = GAMEMODE:GetRoundState() + if roundstate ~= "InRound" and roundstate ~= "PreRound" then return end -- Get information from the currently selected props category -- See sv_maps for the prop data @@ -31,7 +32,7 @@ hook.Add("Tick", "TickPropSpawn", function() -- Set physical properties local phys = ent:GetPhysicsObject() if not IsValid(phys) then return end - + phys:SetMass(40000) phys:SetMaterial(material) From cf161d90e5df25effe9b7654b154be0ee8f7b173 Mon Sep 17 00:00:00 2001 From: Robert Fraser Date: Wed, 14 Oct 2020 23:44:59 +1000 Subject: [PATCH 26/38] Incoming: Model control entity --- .../entities/entities/inc_model_control.lua | 17 +++++++++++++ fluffy_incoming/gamemode/sv_maps.lua | 24 ++++++++++++++++++- 2 files changed, 40 insertions(+), 1 deletion(-) create mode 100644 fluffy_incoming/entities/entities/inc_model_control.lua diff --git a/fluffy_incoming/entities/entities/inc_model_control.lua b/fluffy_incoming/entities/entities/inc_model_control.lua new file mode 100644 index 0000000..1085013 --- /dev/null +++ b/fluffy_incoming/entities/entities/inc_model_control.lua @@ -0,0 +1,17 @@ +ENT.Type = "point" + +ENT.CustomPreset = {} + +function ENT:KeyValue(key, value) + if key == "preset" then + if value == "Custom" then value = "Custom" .. self:EntIndex() end + self.Preset = value + elseif key == "delay" then + self.CustomPreset.delay = tonumber(value) + elseif key == "material" then + self.CustomPreset.material = value + elseif string.StartWith(key, "model") then + if not self.CustomPreset.models then self.CustomPreset.models = {} end + table.insert(self.CustomPreset.models, value) + end +end \ No newline at end of file diff --git a/fluffy_incoming/gamemode/sv_maps.lua b/fluffy_incoming/gamemode/sv_maps.lua index 5017117..47e4473 100644 --- a/fluffy_incoming/gamemode/sv_maps.lua +++ b/fluffy_incoming/gamemode/sv_maps.lua @@ -11,6 +11,9 @@ hook.Add("Tick", "TickPropSpawn", function() -- Get information from the currently selected props category -- See sv_maps for the prop data local data = GAMEMODE.PropPresets[GAMEMODE.CurrentPropsCategory] + if not data then + ErrorNoHalt("Invalid prop preset specified - this is probably a map issue!") + end local props = data.models -- Choose material @@ -49,5 +52,24 @@ end) -- Randomly pick a group of props -- Todo: Map flexibility hook.Add("PreRoundStart", "IncomingPropsChange", function() - GAMEMODE.CurrentPropsCategory = table.Random(table.GetKeys(GAMEMODE.PropPresets)) + GAMEMODE.CurrentPropsCategory = table.Random(GAMEMODE.MapPresets) +end) + +-- Handle custom model control +GM.MapPresets = GM.MapPresets or {"Geometric", "Vehicles", "Geometric and Vehicles", "Cubes And Spheres"} + +hook.Add("InitPostEntity", "IncomingCustomProps", function() + local controls = ents.FindByClass("inc_model_control") + if not controls or #controls < 1 then return end + + GAMEMODE.MapPresets = {} + for _, v in pairs(controls) do + if string.StartWith(v.Preset, "Custom") then + GAMEMODE.PropPresets[v.Preset] = v.CustomPreset + end + table.insert(GAMEMODE.MapPresets, v.Preset) + end + + print("Loaded custom presets!") + PrintTable(GAMEMODE.MapPresets) end) \ No newline at end of file From b649983eeff218a1ebf68a34aa8a56cc71dae9fb Mon Sep 17 00:00:00 2001 From: Robert Fraser Date: Wed, 14 Oct 2020 23:52:13 +1000 Subject: [PATCH 27/38] Base: PlayerOnlyTwoLineAnnouncement --- fluffy_mg_base/gamemode/sv_announcements.lua | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/fluffy_mg_base/gamemode/sv_announcements.lua b/fluffy_mg_base/gamemode/sv_announcements.lua index ea6de8f..2d87902 100644 --- a/fluffy_mg_base/gamemode/sv_announcements.lua +++ b/fluffy_mg_base/gamemode/sv_announcements.lua @@ -69,6 +69,23 @@ function GM:PlayerOnlyAnnouncement(ply, duration, text, size, location, sound) net.Send(ply) end +-- Send a two-line announcement to only one player +function GM:PlayerOnlyTwoLineAnnouncement(ply, duration, text, subtext, size, location, sound) + local tbl = { + type = 'pulse_subtext', + duration = duration, + sound = sound, + text = text, + subtext = subtext, + size = size, + location = location or 'center' + } + + net.Start('MinigamesAnnouncement') + net.WriteTable(tbl) + net.Send(ply) +end + -- Send a pulse announcement to many players function GM:TableOnlyAnnouncement(recipients, duration, text, size, location, sound) local tbl = { From 8c2c0976503af3b21f750357ba8a73423ab5c0cf Mon Sep 17 00:00:00 2001 From: Robert Fraser Date: Wed, 14 Oct 2020 23:52:25 +1000 Subject: [PATCH 28/38] Checkpoint announcements no longer display for everyone --- fluffy_incoming/gamemode/init.lua | 4 ++-- fluffy_incoming/gamemode/sv_maps.lua | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/fluffy_incoming/gamemode/init.lua b/fluffy_incoming/gamemode/init.lua index 4331e58..f41dd07 100644 --- a/fluffy_incoming/gamemode/init.lua +++ b/fluffy_incoming/gamemode/init.lua @@ -23,9 +23,9 @@ function GM:CheckpointTriggered(ply, stage, message) ply.CheckpointStage = stage if message then - GAMEMODE:PulseAnnouncementTwoLine(3, "Checkpoint!", message) + GAMEMODE:PlayerOnlyTwoLineAnnouncement(ply, 3, "Checkpoint!", message) else - GAMEMODE:PulseAnnouncement(3, "Checkpoint!") + GAMEMODE:PlayerOnlyAnnouncement(ply, 3, "Checkpoint!") end end diff --git a/fluffy_incoming/gamemode/sv_maps.lua b/fluffy_incoming/gamemode/sv_maps.lua index 47e4473..8214f08 100644 --- a/fluffy_incoming/gamemode/sv_maps.lua +++ b/fluffy_incoming/gamemode/sv_maps.lua @@ -1,6 +1,6 @@ include("sv_prop_presets.lua") -GM.CurrentPropsCategory = "Geometric" +GM.CurrentPropsCategory = GM.CurrentPropsCategory or "Geometric" GM.PropSpawnTimer = 0 -- Spawn props at appropiate times From 22006649f94dd67b48229d03f10c2de8755ec509 Mon Sep 17 00:00:00 2001 From: Robert Fraser Date: Thu, 15 Oct 2020 00:22:29 +1000 Subject: [PATCH 29/38] Update .fgd to include new Incoming entities --- minigames.fgd | 39 +++++++++++++++++++++++++++++++++++++++ 1 file changed, 39 insertions(+) diff --git a/minigames.fgd b/minigames.fgd index ca8af4b..36286b3 100644 --- a/minigames.fgd +++ b/minigames.fgd @@ -180,6 +180,45 @@ [ ] +@SolidClass = inc_checkpoint_trigger: + "Trigger zone for checkpoint stages." +[ + stage(integer) : "Checkpoint Stage" : 1 : "Stage of this checkpoint" +] + +@PointClass base(Angles) studio("models/editor/playerstart.mdl") = inc_checkpoint_spawn: + "Spawnpoints for a given checkpoint stage. Players will spawn here after passing the corresponding inc_checkpoint_trigger" +[ + stage(integer) : "Checkpoint Stage" : 1 : "Stage of this checkpoint" +] + +@PointClass = inc_model_control: + "Control each model preset for this level. Each preset will need one single control entity. This can either be one of the pre-defined presets, or you can add your own models." +[ + preset(choices): "Preset" : "Custom" : "Preset to use. Other settings have no effect, unless this is Custom." = + [ + "Custom" : "Custom" + "Geometric" : "Geometric" + "Vehicles" : "Vehicles" + "Geometric and Vehicles" : "Geometric and Vehicles" + "Cubes And Spheres" : "Cubes And Spheres" + ] + + delay(integer) : "Spawn Delay" : 2 : "Number of seconds between prop spawns. This may need to be adjusted for larger props, but try and keep this the same." + material(string) : "Material Override" : "" : "Material override to use. Defaults to plastic. You might consider gmod_ice or gmod_bouncy." + + model0(studio) : "Custom Model 1" : "" : "Model for custom presets" + model1(studio) : "Custom Model 2" : "" : "Model for custom presets" + model2(studio) : "Custom Model 3" : "" : "Model for custom presets" + model3(studio) : "Custom Model 4" : "" : "Model for custom presets" + model4(studio) : "Custom Model 5" : "" : "Model for custom presets" + model5(studio) : "Custom Model 6" : "" : "Model for custom presets" + model6(studio) : "Custom Model 7" : "" : "Model for custom presets" + model7(studio) : "Custom Model 8" : "" : "Model for custom presets" + model8(studio) : "Custom Model 9" : "" : "Model for custom presets" + model9(studio) : "Custom Model 10" : "" : "Model for custom presets. If you need more than 10 models, you can add more without SmartEdit." +] + // INFECTION @PointClass base(Angles) studio("models/editor/playerstart.mdl") = info_player_zombie: "This is a team spawnpoint for INFECTED. This only works in Infection." From fbcac98b342e504e4a618962efaad0746ed089f7 Mon Sep 17 00:00:00 2001 From: Robert Fraser Date: Thu, 15 Oct 2020 00:22:40 +1000 Subject: [PATCH 30/38] Add inc_advanced_example.vmf --- minigames_vmfs/inc_advanced_example.vmf | 3 +++ 1 file changed, 3 insertions(+) create mode 100644 minigames_vmfs/inc_advanced_example.vmf diff --git a/minigames_vmfs/inc_advanced_example.vmf b/minigames_vmfs/inc_advanced_example.vmf new file mode 100644 index 0000000..c98ded4 --- /dev/null +++ b/minigames_vmfs/inc_advanced_example.vmf @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:6d17da6715738b20ff007cd4b5ed3000558e30f4b10c0f669d415f5929799fda +size 60863 From e3acf1e14e3445ae9e7db303727fc81e85433b85 Mon Sep 17 00:00:00 2001 From: Robert Fraser Date: Thu, 15 Oct 2020 12:12:22 +1000 Subject: [PATCH 31/38] Pitfall: Fix some levels going below the boundary --- fluffy_pitfall/gamemode/init.lua | 23 ----------------- fluffy_pitfall/gamemode/sv_levelgen.lua | 33 +++++++++++++++++++++---- 2 files changed, 28 insertions(+), 28 deletions(-) diff --git a/fluffy_pitfall/gamemode/init.lua b/fluffy_pitfall/gamemode/init.lua index ff2dc78..17b435f 100644 --- a/fluffy_pitfall/gamemode/init.lua +++ b/fluffy_pitfall/gamemode/init.lua @@ -3,29 +3,6 @@ AddCSLuaFile("shared.lua") include("shared.lua") include("sv_levelgen.lua") --- Backwards compatibility for Pitfall maps -GM.PlatformPositions = {} -GM.PlatformPositions["pf_ocean"] = Vector(0, 0, 1000) -GM.PlatformPositions["pf_ocean_d"] = Vector(0, 0, 0) -GM.PlatformPositions["gm_flatgrass"] = Vector(0, 0, 0) -GM.PlatformPositions["pf_midnight_v1_fix"] = Vector(0, 0, 0) -GM.PlatformPositions["pf_midnight_v1"] = Vector(0, 0, 0) - --- Color properties --- pf_settings can edit these -GM.PColorStart = Color(0, 255, 128) -GM.PColorEnd = Color(255, 0, 128) -GM.PDR = GM.PColorEnd.r - GM.PColorStart.r -GM.PDG = GM.PColorEnd.g - GM.PColorStart.g -GM.PDB = GM.PColorEnd.b - GM.PColorStart.b - --- Update the above settings -function GM:UpdatePDColors() - GAMEMODE.PDR = GAMEMODE.PColorEnd.r - GAMEMODE.PColorStart.r - GAMEMODE.PDG = GAMEMODE.PColorEnd.g - GAMEMODE.PColorStart.g - GAMEMODE.PDB = GAMEMODE.PColorEnd.b - GAMEMODE.PColorStart.b -end - -- Players start with a platform breaker weapon function GM:PlayerLoadout(ply) ply:SetWalkSpeed(350) diff --git a/fluffy_pitfall/gamemode/sv_levelgen.lua b/fluffy_pitfall/gamemode/sv_levelgen.lua index c2a8f9b..6caaa12 100644 --- a/fluffy_pitfall/gamemode/sv_levelgen.lua +++ b/fluffy_pitfall/gamemode/sv_levelgen.lua @@ -1,3 +1,25 @@ +-- Backwards compatibility for Pitfall maps +-- Otherwise, defaults to pf_origin location +-- If entity does not exist, then defaults to Vector(0, 0, 0) +GM.PlatformPositions = {} +GM.PlatformPositions["pf_ocean"] = Vector(0, 0, 16) + +-- Color properties +-- pf_settings can edit these +GM.PColorStart = Color(0, 255, 128) +GM.PColorEnd = Color(255, 0, 128) +GM.PDR = GM.PColorEnd.r - GM.PColorStart.r +GM.PDG = GM.PColorEnd.g - GM.PColorStart.g +GM.PDB = GM.PColorEnd.b - GM.PColorStart.b + +-- Update the above settings +function GM:UpdatePDColors() + GAMEMODE.PDR = GAMEMODE.PColorEnd.r - GAMEMODE.PColorStart.r + GAMEMODE.PDG = GAMEMODE.PColorEnd.g - GAMEMODE.PColorStart.g + GAMEMODE.PDB = GAMEMODE.PColorEnd.b - GAMEMODE.PColorStart.b +end + + local block_options = { "circle", "square" @@ -113,7 +135,7 @@ function GM:ApproximateCentre(basepos, psize, rows, cols, levels) if not cols then cols = rows end local px = basepos.x - (psize * rows)/2 local py = basepos.y - (psize * cols)/2 - local pz = basepos.z + 150 * ((levels or 0)-1) + local pz = basepos.z + 150 * ((levels or 0) - 1) return px, py, pz end @@ -159,18 +181,19 @@ function GM:GenerateIncreasingPyramid(basepos, layerfunc) rows = rows + 1 end - local model = table.Random(block_options) - local psize = 96 - local px, py, pz = GAMEMODE:ApproximateCentre(basepos, psize, rows, columns, levels) - -- Ensure we have at least three levels if levels <= 3 then levels = 3 end + local model = table.Random(block_options) + local psize = 96 + local px, py, pz = GAMEMODE:ApproximateCentre(basepos, psize, rows, columns, levels) + -- Generate layers increasing in size for level = 1, levels do layerfunc(Vector(px, py, pz), model, level, {rows, columns, psize}) + print(level, pz) pz = pz - 150 rows = rows + math.random(1, 3) From 7ad68281b78394cc3d033426dae0b8d2cb031977 Mon Sep 17 00:00:00 2001 From: Robert Fraser Date: Thu, 15 Oct 2020 12:15:02 +1000 Subject: [PATCH 32/38] Pitfall: Make sure the gun gets removed properly --- fluffy_pitfall/gamemode/init.lua | 1 + 1 file changed, 1 insertion(+) diff --git a/fluffy_pitfall/gamemode/init.lua b/fluffy_pitfall/gamemode/init.lua index 17b435f..9b35bbc 100644 --- a/fluffy_pitfall/gamemode/init.lua +++ b/fluffy_pitfall/gamemode/init.lua @@ -8,6 +8,7 @@ function GM:PlayerLoadout(ply) ply:SetWalkSpeed(350) ply:SetRunSpeed(360) ply:SetJumpPower(200) + ply:StripWeapons() -- Give weapons after the safe period has ended timer.Simple(GAMEMODE.RoundCooldown + GAMEMODE.SafeTime, function() From f5e32adf79dad4010f1ec00ab5079b95a3deead1 Mon Sep 17 00:00:00 2001 From: Robert Fraser Date: Thu, 15 Oct 2020 12:20:55 +1000 Subject: [PATCH 33/38] Support for info_player_deathmatch --- fluffy_mg_base/gamemode/sv_player.lua | 2 ++ 1 file changed, 2 insertions(+) diff --git a/fluffy_mg_base/gamemode/sv_player.lua b/fluffy_mg_base/gamemode/sv_player.lua index 750cf38..e8b6b3a 100644 --- a/fluffy_mg_base/gamemode/sv_player.lua +++ b/fluffy_mg_base/gamemode/sv_player.lua @@ -65,6 +65,8 @@ function GM:PlayerSelectSpawn(ply) -- Find FFA spawn entities if not IsTableOfEntitiesValid(GAMEMODE.SpawnPoints) or #GAMEMODE.SpawnPoints < 1 then GAMEMODE.SpawnPoints = ents.FindByClass("info_player_start") + GAMEMODE.SpawnPoints = table.Add(GAMEMODE.SpawnPoints, ents.FindByClass("info_player_deathmatch")) + if #GAMEMODE.SpawnPoints < 2 then GAMEMODE.SpawnPoints = table.Add(GAMEMODE.SpawnPoints, ents.FindByClass("info_player_terrorist")) GAMEMODE.SpawnPoints = table.Add(GAMEMODE.SpawnPoints, ents.FindByClass("info_player_counterterrorist")) From dc877dea9d7db4b7ee2086f8aa5e765a6b9138b0 Mon Sep 17 00:00:00 2001 From: Robert Fraser Date: Thu, 15 Oct 2020 14:19:11 +1000 Subject: [PATCH 34/38] Poltergeist: Minor cleanup --- .../entities/entities/prop_spawner.lua | 10 +- fluffy_poltergeist/gamemode/shared.lua | 14 +- fluffy_poltergeist/gamemode/tables.lua | 174 +++++++++++++++++- 3 files changed, 182 insertions(+), 16 deletions(-) diff --git a/fluffy_poltergeist/entities/entities/prop_spawner.lua b/fluffy_poltergeist/entities/entities/prop_spawner.lua index e23218c..089c896 100644 --- a/fluffy_poltergeist/entities/entities/prop_spawner.lua +++ b/fluffy_poltergeist/entities/entities/prop_spawner.lua @@ -15,8 +15,8 @@ function ENT:Think() end function ENT:SpawnProp() - if table.Count(ents.FindByClass("prop_phys*")) > 100 then return end - local prop = self:CreateProp(self:GetPos(), self:GetAngles(), table.Random(GAMEMODE.PropModels)) + 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 @@ -24,10 +24,10 @@ function ENT:SpawnProp() end end -function ENT:CreateProp(pos, ang, model) +function ENT:CreateProp(model) local prop = ents.Create("prop_physics") - prop:SetPos(pos) - prop:SetAngles(ang) + prop:SetPos(self:GetPos()) + prop:SetAngles(self:GetAngles()) prop:SetModel(model) prop:Spawn() diff --git a/fluffy_poltergeist/gamemode/shared.lua b/fluffy_poltergeist/gamemode/shared.lua index cd88401..6a4119d 100644 --- a/fluffy_poltergeist/gamemode/shared.lua +++ b/fluffy_poltergeist/gamemode/shared.lua @@ -18,29 +18,31 @@ GM.HelpText = [[ Shoot the props to destroy them Don't get killed ]] + GM.TeamBased = true -- Is the gamemode FFA or Teams? GM.TeamSurvival = true GM.SurvivorTeam = TEAM_BLUE GM.HunterTeam = TEAM_RED -GM.RoundNumber = 10 -- How many rounds? -GM.RoundTime = 60 -- Seconds each round lasts for -GM.ForceFFAColors = true -- Force team gamemodes to use FFA colors +GM.ForceFFAColors = true + +GM.RoundNumber = 10 +GM.RoundTime = 60 GM.HUDStyle = HUD_STYLE_CLOCK_ALIVE + +GM.MaxProps = 100 + TEAM_RED = 1 TEAM_BLUE = 2 function GM:CreateTeams() if not GAMEMODE.TeamBased then return end team.SetUp(TEAM_RED, "Poltergeists", TEAM_COLORS["red"], true) - team.SetSpawnPoint(TEAM_RED, {"info_player_start", "info_player_counterterrorist", "info_player_combine"}, true) team.SetUp(TEAM_BLUE, "Humans", TEAM_COLORS["blue"], true) - team.SetSpawnPoint(TEAM_BLUE, {"info_player_start", "info_player_terrorist", "info_player_rebel", "info_player_deathmatch"}) team.SetUp(TEAM_SPECTATOR, "Spectators", Color(255, 255, 80), true) - team.SetSpawnPoint(TEAM_SPECTATOR, {"info_player_start", "info_player_terrorist", "info_player_combine"}) end diff --git a/fluffy_poltergeist/gamemode/tables.lua b/fluffy_poltergeist/gamemode/tables.lua index 19d84d9..3c5605a 100644 --- a/fluffy_poltergeist/gamemode/tables.lua +++ b/fluffy_poltergeist/gamemode/tables.lua @@ -1,13 +1,177 @@ -GM.PropModels = {"models/props_borealis/borealis_door001a.mdl", "models/props_c17/FurnitureChair001a.mdl", "models/props_c17/FurnitureCouch001a.mdl", "models/props_c17/FurnitureCouch001a.mdl", "models/props_c17/FurnitureDrawer001a.mdl", "models/props_c17/FurnitureDrawer002a.mdl", "models/props_c17/FurnitureDrawer003a.mdl", "models/props_c17/FurnitureDresser001a.mdl", "models/props_c17/FurnitureFridge001a.mdl", "models/props_c17/FurnitureShelf001a.mdl", "models/props_c17/furnitureStove001a.mdl", "models/props_c17/FurnitureTable002a.mdl", "models/props_c17/FurnitureTable003a.mdl", "models/props_c17/FurnitureWashingmachine001a.mdl", "models/props_c17/gravestone001a.mdl", "models/props_c17/gravestone002a.mdl", "models/props_combine/breendesk.mdl", "models/props_interiors/Furniture_Couch01a.mdl", "models/props_interiors/Furniture_Couch02a.mdl", "models/props_interiors/Furniture_Desk01a.mdl", "models/props_interiors/Furniture_Lamp01a.mdl", "models/props_interiors/Furniture_shelf01a.mdl", "models/props_interiors/Furniture_Vanity01a.mdl", "models/props_interiors/Radiator01a.mdl", "models/props_interiors/refrigerator01a.mdl", "models/props_interiors/SinkKitchen01a.mdl", "models/props_junk/wood_crate001a.mdl", "models/props_junk/wood_crate002a.mdl", "models/props_lab/blastdoor001b.mdl", "models/props_lab/filecabinet02.mdl", "models/props_trainstation/trashcan_indoor001a.mdl", "models/props_trainstation/trashcan_indoor001b.mdl", "models/props_wasteland/barricade001a.mdl", "models/props_wasteland/barricade002a.mdl", "models/props_wasteland/cafeteria_bench001a.mdl", "models/props_wasteland/cafeteria_table001a.mdl", "models/props_wasteland/controlroom_desk001a.mdl", "models/props_wasteland/controlroom_chair001a.mdl", "models/props_wasteland/kitchen_counter001c.mdl", "models/props_wasteland/laundry_basket001.mdl", "models/props_wasteland/laundry_cart001.mdl", "models/props_wasteland/laundry_cart002.mdl", "models/props_wasteland/prison_bedframe001b.mdl", "models/props_wasteland/wheel01a.mdl", "models/props_wasteland/wheel03b.mdl", "models/props_c17/traffic_light001a.mdl", "models/props_c17/utilityconducter001.mdl", "models/props_c17/substation_transformer01d.mdl", "models/props_c17/lockers001a.mdl", "models/props_vehicles/tire001a_tractor.mdl", "models/props_vehicles/apc_tire001.mdl", "models/props_wasteland/prison_shelf002a.mdl", "models/props_wasteland/prison_sink001b.mdl", "models/props_wasteland/prison_toilet01.mdl", "models/props_wasteland/rockgranite02a.mdl", "models/props_wasteland/rockgranite02c.mdl", "models/props_rooftop/sign_letter_h001.mdl", "models/props_rooftop/sign_letter02_e002.mdl", "models/props_rooftop/sign_letter02_k002.mdl", "models/props_rooftop/sign_letter_t001.mdl", "models/xqm/airplanewheel1huge.mdl", "models/xeon133/offroad/off-road-80.mdl", "models/xeon133/offroad/off-road-60.mdl", "models/props_phx/wheels/wooden_wheel2.mdl", "models/xqm/jetenginebig.mdl", "models/hunter/blocks/cube1x1x1.mdl", "models/hunter/misc/sphere2x2.mdl"} +GM.PropModels = { + "models/props_borealis/borealis_door001a.mdl", + "models/props_c17/FurnitureChair001a.mdl", + "models/props_c17/FurnitureCouch001a.mdl", + "models/props_c17/FurnitureCouch001a.mdl", + "models/props_c17/FurnitureDrawer001a.mdl", + "models/props_c17/FurnitureDrawer002a.mdl", + "models/props_c17/FurnitureDrawer003a.mdl", + "models/props_c17/FurnitureDresser001a.mdl", + "models/props_c17/FurnitureFridge001a.mdl", + "models/props_c17/FurnitureShelf001a.mdl", + "models/props_c17/furnitureStove001a.mdl", + "models/props_c17/FurnitureTable002a.mdl", + "models/props_c17/FurnitureTable003a.mdl", + "models/props_c17/FurnitureWashingmachine001a.mdl", + "models/props_c17/gravestone001a.mdl", + "models/props_c17/gravestone002a.mdl", + "models/props_combine/breendesk.mdl", + "models/props_interiors/Furniture_Couch01a.mdl", + "models/props_interiors/Furniture_Couch02a.mdl", + "models/props_interiors/Furniture_Desk01a.mdl", + "models/props_interiors/Furniture_Lamp01a.mdl", + "models/props_interiors/Furniture_shelf01a.mdl", + "models/props_interiors/Furniture_Vanity01a.mdl", + "models/props_interiors/Radiator01a.mdl", + "models/props_interiors/refrigerator01a.mdl", + "models/props_interiors/SinkKitchen01a.mdl", + "models/props_junk/wood_crate001a.mdl", + "models/props_junk/wood_crate002a.mdl", + "models/props_lab/blastdoor001b.mdl", + "models/props_lab/filecabinet02.mdl", + "models/props_trainstation/trashcan_indoor001a.mdl", + "models/props_trainstation/trashcan_indoor001b.mdl", + "models/props_wasteland/barricade001a.mdl", + "models/props_wasteland/barricade002a.mdl", + "models/props_wasteland/cafeteria_bench001a.mdl", + "models/props_wasteland/cafeteria_table001a.mdl", + "models/props_wasteland/controlroom_desk001a.mdl", + "models/props_wasteland/controlroom_chair001a.mdl", + "models/props_wasteland/kitchen_counter001c.mdl", + "models/props_wasteland/laundry_basket001.mdl", + "models/props_wasteland/laundry_cart001.mdl", + "models/props_wasteland/laundry_cart002.mdl", + "models/props_wasteland/prison_bedframe001b.mdl", + "models/props_wasteland/wheel01a.mdl", + "models/props_wasteland/wheel03b.mdl", + "models/props_c17/traffic_light001a.mdl", + "models/props_c17/utilityconducter001.mdl", + "models/props_c17/substation_transformer01d.mdl", + "models/props_c17/lockers001a.mdl", + "models/props_vehicles/tire001a_tractor.mdl", + "models/props_vehicles/apc_tire001.mdl", + "models/props_wasteland/prison_shelf002a.mdl", + "models/props_wasteland/prison_sink001b.mdl", + "models/props_wasteland/prison_toilet01.mdl", + "models/props_wasteland/rockgranite02a.mdl", + "models/props_wasteland/rockgranite02c.mdl", + "models/props_rooftop/sign_letter_h001.mdl", + "models/props_rooftop/sign_letter02_e002.mdl", + "models/props_rooftop/sign_letter02_k002.mdl", + "models/props_rooftop/sign_letter_t001.mdl", + "models/xqm/airplanewheel1huge.mdl", + "models/xeon133/offroad/off-road-80.mdl", + "models/xeon133/offroad/off-road-60.mdl", + "models/props_phx/wheels/wooden_wheel2.mdl", + "models/xqm/jetenginebig.mdl", + "models/hunter/blocks/cube1x1x1.mdl", + "models/hunter/misc/sphere2x2.mdl" +} for k, v in pairs(GM.PropModels) do util.PrecacheModel(v) 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", "ambient/levels/labs/electric_explosion5.wav"} +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" + "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/rics/ric5.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/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_disintegrate4.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_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/streetwar/sniper/ba_overhere.wav"} \ No newline at end of file +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/streetwar/sniper/ba_overhere.wav" +} \ No newline at end of file From 41f1acfcc942617fa57683e73e385d4fd5296749 Mon Sep 17 00:00:00 2001 From: Robert Fraser Date: Thu, 15 Oct 2020 14:23:13 +1000 Subject: [PATCH 35/38] Poltergeist: Random skins on props --- fluffy_poltergeist/entities/entities/prop_spawner.lua | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/fluffy_poltergeist/entities/entities/prop_spawner.lua b/fluffy_poltergeist/entities/entities/prop_spawner.lua index 089c896..5d339df 100644 --- a/fluffy_poltergeist/entities/entities/prop_spawner.lua +++ b/fluffy_poltergeist/entities/entities/prop_spawner.lua @@ -30,7 +30,7 @@ function ENT:CreateProp(model) prop:SetAngles(self:GetAngles()) prop:SetModel(model) prop:Spawn() - + prop:SetSkin(math.random(0, self:SkinCount()-1)) return prop end From f0683424e1690783f21522d28580a81e50a1b4a9 Mon Sep 17 00:00:00 2001 From: Robert Fraser Date: Thu, 15 Oct 2020 14:26:41 +1000 Subject: [PATCH 36/38] SB model quickfix --- fluffy_suicidebarrels/gamemode/init.lua | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/fluffy_suicidebarrels/gamemode/init.lua b/fluffy_suicidebarrels/gamemode/init.lua index e105d76..e75ed96 100644 --- a/fluffy_suicidebarrels/gamemode/init.lua +++ b/fluffy_suicidebarrels/gamemode/init.lua @@ -30,7 +30,7 @@ end function GM:ApplyBarrelModel(ply) local idx = math.random(#GAMEMODE.BarrelModels) ply:SetModel(GAMEMODE.BarrelModels[idx]) - ply:SetSkin(GAMEMODE.BarrelSkins[idx]) + ply:SetSkin(GAMEMODE.BarrelSkins[idx] or 0) end -- Pick player models From 979d4b0657d60aa6b03313464c12798aa28b71bd Mon Sep 17 00:00:00 2001 From: Robert Fraser Date: Thu, 15 Oct 2020 14:30:25 +1000 Subject: [PATCH 37/38] Poltergeist: Model control entity --- .../entities/entities/pg_model_control.lua | 18 ++++++++ minigames.fgd | 41 ++++++++++++++++++- 2 files changed, 58 insertions(+), 1 deletion(-) create mode 100644 fluffy_poltergeist/entities/entities/pg_model_control.lua diff --git a/fluffy_poltergeist/entities/entities/pg_model_control.lua b/fluffy_poltergeist/entities/entities/pg_model_control.lua new file mode 100644 index 0000000..aa929c9 --- /dev/null +++ b/fluffy_poltergeist/entities/entities/pg_model_control.lua @@ -0,0 +1,18 @@ +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 string.StartWith(key, "model") then + table.insert(GAMEMODE.PropModels, value) + end +end \ No newline at end of file diff --git a/minigames.fgd b/minigames.fgd index 36286b3..063c300 100644 --- a/minigames.fgd +++ b/minigames.fgd @@ -291,6 +291,31 @@ frequency(integer) : "Spawn Frequency" : 3 : "How often to respawn props at this location?" ] +@PointClass = pg_model_control: + "Control the models that can be spawned in this map. If this entity exists in the map, none of the default models will spawn!" +[ + model0(studio) : "Custom Model 1" : "" : "Model option for prop spawns" + model1(studio) : "Custom Model 2" : "" : "Model option for prop spawns" + model2(studio) : "Custom Model 3" : "" : "Model option for prop spawns" + model3(studio) : "Custom Model 4" : "" : "Model option for prop spawns" + model4(studio) : "Custom Model 5" : "" : "Model option for prop spawns" + model5(studio) : "Custom Model 6" : "" : "Model option for prop spawns" + model6(studio) : "Custom Model 7" : "" : "Model option for prop spawns" + model7(studio) : "Custom Model 8" : "" : "Model option for prop spawns" + model8(studio) : "Custom Model 9" : "" : "Model option for prop spawns" + model9(studio) : "Custom Model 10" : "" : "Model option for prop spawns" + model10(studio) : "Custom Model 11" : "" : "Model option for prop spawns" + model11(studio) : "Custom Model 12" : "" : "Model option for prop spawns" + model12(studio) : "Custom Model 13" : "" : "Model option for prop spawns" + model13(studio) : "Custom Model 14" : "" : "Model option for prop spawns" + model14(studio) : "Custom Model 15" : "" : "Model option for prop spawns" + model15(studio) : "Custom Model 16" : "" : "Model option for prop spawns" + model16(studio) : "Custom Model 17" : "" : "Model option for prop spawns" + model17(studio) : "Custom Model 18" : "" : "Model option for prop spawns" + model18(studio) : "Custom Model 19" : "" : "Model option for prop spawns" + model19(studio) : "Custom Model 20" : "" : "Model option for prop spawns. If you need more, you can add so without SmartEdit." +] + // SUPER SHOTGUNS // No entities applicable. @@ -301,4 +326,18 @@ // No entities applicable. // SUICIDE BARRELS -// No entities applicable. \ No newline at end of file +// No entities applicable. +@PointClass = sb_model_control: + "Control the models & skins used for barrels in this map. Barrels are randomly picked from these options." +[ + model0(studio) : "Custom Model 1" : "" : "1st barrel model." + skin0(integer) : "Custom Skin 1" : "" : "1st barrel skin. Defaults to 0." + model1(studio) : "Custom Model 2" : "" : "2nd barrel model" + skin1(integer) : "Custom Skin 1" : "" : "2st barrel skin. Defaults to 0." + model2(studio) : "Custom Model 3" : "" : "3rd barrel model" + skin2(integer) : "Custom Skin 1" : "" : "3st barrel skin. Defaults to 0." + model3(studio) : "Custom Model 4" : "" : "4th barrel model" + skin3(integer) : "Custom Skin 1" : "" : "4st barrel skin. Defaults to 0." + model4(studio) : "Custom Model 5" : "" : "5th barrel model. If you need more than 5 models, you can add more without SmartEdit." + skin4(integer) : "Custom Skin 1" : "" : "5st barrel skin. Defaults to 0." +] \ No newline at end of file From 78227609ec8e95b5a35d86a07cbba4665633cd1c Mon Sep 17 00:00:00 2001 From: Robert Fraser Date: Thu, 15 Oct 2020 15:05:33 +1000 Subject: [PATCH 38/38] Fix all the bugs I added in the previous commits --- .../entities/entities/pg_model_control.lua | 15 +- .../entities/entities/pg_spawner.lua | 39 ++++ .../entities/entities/prop_spawner.lua | 40 +--- fluffy_poltergeist/gamemode/tables.lua | 176 +++++++++--------- 4 files changed, 133 insertions(+), 137 deletions(-) create mode 100644 fluffy_poltergeist/entities/entities/pg_spawner.lua diff --git a/fluffy_poltergeist/entities/entities/pg_model_control.lua b/fluffy_poltergeist/entities/entities/pg_model_control.lua index aa929c9..af665f4 100644 --- a/fluffy_poltergeist/entities/entities/pg_model_control.lua +++ b/fluffy_poltergeist/entities/entities/pg_model_control.lua @@ -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 diff --git a/fluffy_poltergeist/entities/entities/pg_spawner.lua b/fluffy_poltergeist/entities/entities/pg_spawner.lua new file mode 100644 index 0000000..d1cdb1a --- /dev/null +++ b/fluffy_poltergeist/entities/entities/pg_spawner.lua @@ -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 \ No newline at end of file diff --git a/fluffy_poltergeist/entities/entities/prop_spawner.lua b/fluffy_poltergeist/entities/entities/prop_spawner.lua index 5d339df..c020629 100644 --- a/fluffy_poltergeist/entities/entities/prop_spawner.lua +++ b/fluffy_poltergeist/entities/entities/prop_spawner.lua @@ -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 \ No newline at end of file +ENT.Base = "pg_spawner" \ No newline at end of file diff --git a/fluffy_poltergeist/gamemode/tables.lua b/fluffy_poltergeist/gamemode/tables.lua index 3c5605a..9a78791 100644 --- a/fluffy_poltergeist/gamemode/tables.lua +++ b/fluffy_poltergeist/gamemode/tables.lua @@ -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" } \ No newline at end of file