diff --git a/MorbusGamemode/gamemodes/morbusgame/gamemode/init.lua b/MorbusGamemode/gamemodes/morbusgame/gamemode/init.lua index f8a1980..89d3a30 100644 --- a/MorbusGamemode/gamemodes/morbusgame/gamemode/init.lua +++ b/MorbusGamemode/gamemodes/morbusgame/gamemode/init.lua @@ -68,8 +68,11 @@ CreateConVar("morbus_mission_time_min", "120", FCVAR_NOTIFY) CreateConVar("morbus_mission_next_time_max", "80", FCVAR_NOTIFY) CreateConVar("morbus_mission_next_time_min", "220", FCVAR_NOTIFY) - CreateConVar("morbus_rpnames_optional", "0", FCVAR_NOTIFY) + +--This cvar sets the time swarms are spawn protected for after spawning +CreateConVar("morbus_swarm_protection_time", "3", FCVAR_NOTIFY) + ----------------------------------------------- util.AddNetworkString("RoundLog") diff --git a/MorbusGamemode/gamemodes/morbusgame/gamemode/server/player/sv_player.lua b/MorbusGamemode/gamemodes/morbusgame/gamemode/server/player/sv_player.lua index c976692..2ae7db5 100644 --- a/MorbusGamemode/gamemodes/morbusgame/gamemode/server/player/sv_player.lua +++ b/MorbusGamemode/gamemodes/morbusgame/gamemode/server/player/sv_player.lua @@ -39,8 +39,8 @@ function GM:PlayerInitialSpawn(ply) ply.DamageFactor = 1 ply:InitSanity() ply:SetNWInt("Mute_Status",0) - - + + ply:SpawnProtected = false --ply:SetForceRPName( 0 ) -- 0 = no, 1 = yes --ply:SetForceGender( 0 ) -- 0 = don't force, 1 = male, 2 = female @@ -215,6 +215,23 @@ function GM:PlayerSpawn(ply) end + --Enable spawn protection when a new swarn alien spawns + --Create a timer to disable it after the convar time + if ply:IsSwarm() then + --ply:PrintMessage(HUD_PRINTTALK, "Spawn protection activated!") + + ply.SpawnProtected = true + + local ProtectionTime = GetConVar("morbus_swarm_protection_time"):GetInt() + timer.Simple(ProtectionTime , function() + if IsValid(ply) && ply:IsGame() then + ply.SpawnProtected = false + end + end) + end + + + ply:ResetViewRoll() ply:SetNWBool("alienform", false) @@ -640,4 +657,4 @@ function WhoIsRemscar() end SendMsg("Remscar is not playing on this server") end -concommand.Add("remscar",WhoIsRemscar) \ No newline at end of file +concommand.Add("remscar",WhoIsRemscar) diff --git a/MorbusGamemode/gamemodes/morbusgame/gamemode/server/player/sv_player_damage.lua b/MorbusGamemode/gamemodes/morbusgame/gamemode/server/player/sv_player_damage.lua index 53597a4..1b5f7d7 100644 --- a/MorbusGamemode/gamemodes/morbusgame/gamemode/server/player/sv_player_damage.lua +++ b/MorbusGamemode/gamemodes/morbusgame/gamemode/server/player/sv_player_damage.lua @@ -73,6 +73,11 @@ function GM:PlayerTakeDamage(ent, infl, att, amount, dmginfo) end end + --if the entity taking damage is swarm & has spawn protection + if ent:IsSwarm() && ent.SpawnProtected == true then + --scale damage to almost nothing + dmginfo:ScaleDamage(0.01) + end end // Brood Alien damage reudction upgrades