Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Potential fix for Spawn cap on maps
#1
I have noticed that there was issues on some maps that cause upon spawning of players to cause overlap and crushing that kills x amount of players over spawn limit.  I have a pretty simple fix to suggest.  Delay the spawning of hunters by 4 seconds.  Since hunters are blinded they do not lose out on any gameplay opportunities and this will free up spawn locations on smaller maps (i.e. Gas Station) which would allow for a larger pool of popular maps to be added while keeping the server slots high.

I can always help with the fixing of the issue if there is a way I can get the LUA prophunt file that you use to look over the code and edit it on my side and see if you like the change.
#2
The blinding coding would need to be modified too so that hunters couldn't see the props moving about.
#3
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":
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.
[Image: horizontal-design-element-3.png]
  Angel I CRAHSED MY CAR
find out more at https://russefarmer.com/
Garry's Mod Performance Tuning Guide
#4
(05-02-2020, 08:34 PM)RussEfarmer Wrote: 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":
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.

I came from a server where they had delayed hunter spawns and that seemed to work to expand the spawn limits without adding spawn points.  Idk if he also added a way to clear up available spawn points within that code, but from my experience its just when two player entities spawn on each other, one has to give way.


Forum Jump:


Users browsing this thread: 1 Guest(s)

About Us
    This is Dinkleberg's GMod, a gaming community based in Garry's Mod. We have a Trouble in Terrorist Town, Prop Hunt, Murder, and Deathrun Server. Come check them out sometime.