diff --git a/fluffy_dodgeball/entities/entities/db_dodgeball.lua b/fluffy_dodgeball/entities/entities/db_dodgeball.lua index 0c3664d..25798cf 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() + + -- Attempt to unstuck balls in the world + if util.IsInWorld(self:GetPos() - Vector(0, 0, self.Size/2)) then + 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 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 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_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..7bb9f5f --- /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 = tonumber(value) + end +end \ No newline at end of file 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/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 diff --git a/fluffy_incoming/gamemode/init.lua b/fluffy_incoming/gamemode/init.lua index a1f4c70..f41dd07 100644 --- a/fluffy_incoming/gamemode/init.lua +++ b/fluffy_incoming/gamemode/init.lua @@ -3,81 +3,72 @@ 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 - --- 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" --- Prop spawn timer loop --- Spawns props at the top of the slope at a fixed interval -INCPropSpawnTimer = 0 - -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 - -- 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) - - -- Call the data function on every entity - if data.func then - data.func(ent) - end - end +-- 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) - INCPropSpawnTimer = CurTime() + delay +-- 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) --- Randomly pick a group of props -hook.Add("PreRoundStart", "IncomingPropsChange", function() - -- If the map has a category restriction, pay attention to that - local category +-- Trigger checkpoints +function GM:CheckpointTriggered(ply, stage, message) + if ply.CheckpointStage and stage <= ply.CheckpointStage then return end + ply.CheckpointStage = stage - if GAMEMODE.MapInfo[game.GetMap()].categories then - category = table.Random(GAMEMODE.MapInfo[game.GetMap()].categories) + if message then + GAMEMODE:PlayerOnlyTwoLineAnnouncement(ply, 3, "Checkpoint!", message) else - category = table.Random(table.GetKeys(GAMEMODE.DefaultProps)) + GAMEMODE:PlayerOnlyAnnouncement(ply, 3, "Checkpoint!") end +end - GAMEMODE.CurrentPropsCategory = category +-- 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 - for k, v in pairs(player.GetAll()) do - v.BestDistance = nil + -- 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 -end) + + -- Get checkpoint spawns for this level + local stageSpawns = GAMEMODE.CheckpointSpawns[stage] + 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 --- This function also tracks the current best distance 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) + 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) + + local percent = 1 - (distance / ply.StartingDistance) if percent < 0 then return end if ply.BestDistance then @@ -92,16 +83,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) -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) + GAMEMODE:CheckBestDistance(ply) end) -- Add scoring based on distance at the end of a round @@ -109,7 +91,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) @@ -128,11 +110,16 @@ 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",} + 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 @@ -143,11 +130,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/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..8214f08 100644 --- a/fluffy_incoming/gamemode/sv_maps.lua +++ b/fluffy_incoming/gamemode/sv_maps.lua @@ -1,130 +1,75 @@ -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 = GM.CurrentPropsCategory or "Geometric" +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() + local roundstate = GAMEMODE:GetRoundState() + if roundstate ~= "InRound" and roundstate ~= "PreRound" 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.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 + 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() -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" - }, + -- Set physical properties + local phys = ent:GetPhysicsObject() + if not IsValid(phys) then return end - func = function(e) - local c = HSVToColor(math.random(360),1,1) - e:SetColor(c) + 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 -} +end) -GM.MapInfo = {} +-- Randomly pick a group of props +-- Todo: Map flexibility +hook.Add("PreRoundStart", "IncomingPropsChange", function() + GAMEMODE.CurrentPropsCategory = table.Random(GAMEMODE.MapPresets) +end) -GM.MapInfo["inc_duo"] = { - endpos = Vector(-1650,5950,6656), - distance = 9000 -} +-- Handle custom model control +GM.MapPresets = GM.MapPresets or {"Geometric", "Vehicles", "Geometric and Vehicles", "Cubes And Spheres"} -GM.MapInfo["inc_rectangular"] = { - endpos = Vector(158,1027,3815), - distance = 8420 -} +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 -GM.MapInfo["inc_linear"] = { - endpos = Vector(0,4991,3456), - distance = 12500 -} \ No newline at end of file + print("Loaded custom presets!") + PrintTable(GAMEMODE.MapPresets) +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 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 c972a96..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 @@ -288,8 +293,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/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 7f4a0d4..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 @@ -135,7 +134,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()) 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) 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..2d87902 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 = { @@ -68,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 = { 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_player.lua b/fluffy_mg_base/gamemode/sv_player.lua index 0f6fe52..e8b6b3a 100644 --- a/fluffy_mg_base/gamemode/sv_player.lua +++ b/fluffy_mg_base/gamemode/sv_player.lua @@ -63,8 +63,10 @@ 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") + 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")) 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_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 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 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 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 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/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 e1e6235..9b35bbc 100644 --- a/fluffy_pitfall/gamemode/init.lua +++ b/fluffy_pitfall/gamemode/init.lua @@ -3,50 +3,17 @@ 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:Give("weapon_platformbreaker") ply:SetWalkSpeed(350) ply:SetRunSpeed(360) 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 + ply:StripWeapons() - return selected + -- Give weapons after the safe period has ended + timer.Simple(GAMEMODE.RoundCooldown + GAMEMODE.SafeTime, function() + ply:Give("weapon_platformbreaker") + end) end -- Credit damage to players for Knockbacks @@ -87,30 +54,27 @@ 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() - 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 + local classes = {"pf_platform", "info_player_start", "gmod_player_start", "info_player_terrorist", "info_player_counterterrorist"} - for k, v in pairs(ents.FindByClass("info_player_counterterrorist")) do - v:Remove() + for _, class in pairs(classes) do + for k,v in pairs(ents.FindByClass(class)) do + v:Remove() + end end end 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 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) 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..af665f4 --- /dev/null +++ b/fluffy_poltergeist/entities/entities/pg_model_control.lua @@ -0,0 +1,13 @@ +ENT.Type = "point" + +-- 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 +end \ No newline at end of file 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 e23218c..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*")) > 100 then return end - local prop = self:CreateProp(self:GetPos(), self:GetAngles(), 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(pos, ang, model) - local prop = ents.Create("prop_physics") - prop:SetPos(pos) - prop:SetAngles(ang) - prop:SetModel(model) - prop:Spawn() - - 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/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..9a78791 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 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 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 = [[ diff --git a/minigames.fgd b/minigames.fgd index 8203a9a..063c300 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." @@ -240,6 +279,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" @@ -247,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. @@ -257,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 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