05-02-2020, 08:34 PM
(This post was last modified: 05-02-2020, 08:48 PM by RussEfarmer.)
This is the code that is called on the start of every round, pulled from the latest version of Enhanced Prophunt in "prop_hunt\gamemode\init.lua":
The function we're looking for is UTIL_SpawnAllPlayers(), which is declared in "fretta\gamemode\utility.lua":
Theoretically all you would have to do is modify this routine in init.lua where hunters have a delay. I don't think the blinding would be affected, since a separate routine places hunter cameras out into the void at the start of every round anyway. I don't actually know how to code this in myself, nor do I really want to fire up a test server and go through the trouble knowing that most likely nothing will come of it, but here's the crust to the pie I suppose.
Edit: it's not even a guarantee that delaying hunter spawns would even solve this "crushing". After reading your post a bit more closely, it sounds like you're talking about player dying after the game spawns players above the hard limit of spawnpoints on the map. If that's the case, this problem is only solvable by increasing the number of spawnpoints , which requires rebuilding the map.
Code:
function GM:OnPreRoundStart(num)
game.CleanUpMap()
if GetGlobalInt("RoundNumber") != 1 && (GetConVar("ph_swap_teams_every_round"):GetInt() == 1 || ((team.GetScore(TEAM_PROPS) + team.GetScore(TEAM_HUNTERS)) > 0)) then
for _, pl in pairs(player.GetAll()) do
if pl:Team() == TEAM_PROPS || pl:Team() == TEAM_HUNTERS then
if pl:Team() == TEAM_PROPS then
pl:SetTeam(TEAM_HUNTERS)
else
pl:SetTeam(TEAM_PROPS)
if GetConVar("ph_notice_prop_rotation"):GetBool() then
timer.Simple(0.5, function() pl:SendLua( [[notification.AddLegacy("You are in Prop Team with Rotate support! You can rotate the prop around by moving your mouse.", NOTIFY_UNDO, 20 )]] ) end)
pl:SendLua( [[notification.AddLegacy("Additionally you can toggle lock rotation by pressing R key!", NOTIFY_GENERIC, 18 )]] )
pl:SendLua( [[surface.PlaySound("garrysmod/content_downloaded.wav")]] )
end
end
pl:ChatPrint(PHE.LANG.CHAT.SWAP)
end
end
-- Props will gain a Bonus Armor points Hunter teams has more than 4 players in it. The more player, the more armor they get.
timer.Simple(1, function()
local NumHunter = table.Count(team.GetPlayers(TEAM_HUNTERS))
if NumHunter >= 4 && NumHunter <= 8 then
for _,prop in pairs(team.GetPlayers(TEAM_PROPS)) do
if IsValid(prop) then prop:SetArmor(math.random(1,3) * 15) end
end
elseif NumHunter > 8 then
for _,prop in pairs(team.GetPlayers(TEAM_PROPS)) do
if IsValid(prop) then prop:SetArmor(math.random(3,7) * 15) end
end
end
end)
hook.Call("PH_OnPreRoundStart", nil, GetConVar("ph_swap_teams_every_round"):GetInt())
end
-- Balance teams?
if GetConVar("ph_autoteambalance"):GetBool() then
GAMEMODE:CheckTeamBalance()
end
UTIL_StripAllPlayers()
UTIL_SpawnAllPlayers()
UTIL_FreezeAllPlayers()
end
The function we're looking for is UTIL_SpawnAllPlayers(), which is declared in "fretta\gamemode\utility.lua":
Code:
function UTIL_SpawnAllPlayers()
for k,v in pairs( player.GetAll() ) do
if ( v:CanRespawn() && v:Team() != TEAM_SPECTATOR && v:Team() != TEAM_CONNECTING ) then
v:Spawn()
end
end
end
Theoretically all you would have to do is modify this routine in init.lua where hunters have a delay. I don't think the blinding would be affected, since a separate routine places hunter cameras out into the void at the start of every round anyway. I don't actually know how to code this in myself, nor do I really want to fire up a test server and go through the trouble knowing that most likely nothing will come of it, but here's the crust to the pie I suppose.
Edit: it's not even a guarantee that delaying hunter spawns would even solve this "crushing". After reading your post a bit more closely, it sounds like you're talking about player dying after the game spawns players above the hard limit of spawnpoints on the map. If that's the case, this problem is only solvable by increasing the number of spawnpoints , which requires rebuilding the map.