Skip to content

Commit

Permalink
Merge pull request #59 from CFC-Servers/tweak-vars
Browse files Browse the repository at this point in the history
Old changes from coddle-newly-spawned.

    make players spawn further apart
    increase the size of the "dynamic center"
    increase randomness
    make minSpawns calculation give more spawns
  • Loading branch information
StrawWagen authored Mar 7, 2024
2 parents 1a58b47 + 1286c93 commit a80e9ac
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 7 deletions.
12 changes: 6 additions & 6 deletions lua/cfc_random_spawn/module/sv_player_spawning.lua
Original file line number Diff line number Diff line change
Expand Up @@ -13,10 +13,10 @@ local CLOSENESS_LIMIT = CFCRandomSpawn.Config.CLOSENESS_LIMIT ^ 2
local CENTER_UPDATE_INTERVAL = customSpawnConfigForMap.centerUpdateInterval or CFCRandomSpawn.Config.CENTER_UPDATE_INTERVAL
local IGNORE_BUILDERS = CFCRandomSpawn.Config.IGNORE_BUILDERS

local DYNAMIC_CENTER_MINSIZE = 1750 -- getDynamicPvpCenter starts at this radius
local DYNAMIC_CENTER_MAXSIZE = 3750 -- no bigger than this radius
local DYNAMIC_CENTER_MINSIZE = 2000 -- getDynamicPvpCenter starts at this radius
local DYNAMIC_CENTER_MAXSIZE = 4000 -- no bigger than this radius
local DYNAMIC_CENTER_MINSPAWNS = 10 -- getDynamicPvpCenter needs at least this many spawns inside the radius
local DYNAMIC_CENTER_MAXSPAWNS = 30 -- max possible spawns
local DYNAMIC_CENTER_MAXSPAWNS = 35 -- max possible spawns
local DYNAMIC_CENTER_SPAWNCOUNTMATCHPVPERS = true -- pvp center gets bigger when more people are pvping
local DYNAMIC_CENTER_IMPERFECT = true -- throw a bit of randomness in, makes pvp less stiff.

Expand Down Expand Up @@ -190,7 +190,7 @@ local function findFreeSpawnPoint( spawns, plys )
end
end

return customSpawnsForMap[math.random( 1, #customSpawnsForMap )] -- If all spawnpoints are full, just return a random spawn anywhere in the map. Super rare case.
return customSpawnsForMap[math.random( 1, #customSpawnsForMap )] -- If all spawnpoints are full, just return a random spawn anywhere in the map. Rare case.
end

local function getPlyAvg( plys, centerPos )
Expand Down Expand Up @@ -228,7 +228,7 @@ local function getDynamicPvpCenter( measurablePlayers )

-- add some randomness
if DYNAMIC_CENTER_IMPERFECT then
local offset = VectorRand() * 800
local offset = VectorRand() * 1000
offset.z = 0
playersAveragePos = playersAveragePos + offset
end
Expand All @@ -245,7 +245,7 @@ local function getDynamicPvpCenter( measurablePlayers )
-- allow this to adapt to pvper count
local minSpawns = DYNAMIC_CENTER_MINSPAWNS
if DYNAMIC_CENTER_SPAWNCOUNTMATCHPVPERS then
minSpawns = math.Clamp( measurablePlysCount, DYNAMIC_CENTER_MINSPAWNS, DYNAMIC_CENTER_MAXSPAWNS )
minSpawns = math.Clamp( DYNAMIC_CENTER_MINSPAWNS + measurablePlysCount, DYNAMIC_CENTER_MINSPAWNS, DYNAMIC_CENTER_MAXSPAWNS )
end

-- now determine the center's size
Expand Down
2 changes: 1 addition & 1 deletion lua/cfc_random_spawn/sv_config.lua
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
CFCRandomSpawn.Config.DEFAULT_CENTER_CUTOFF = 3000 -- Default cutoff range from the most popular pvp center, where players further away from this will be ignored. The system tries to place you closest to everyone else.
CFCRandomSpawn.Config.CLOSENESS_LIMIT = 100 -- Will not choose spawnpoints that are within this many units of a valid player (i.e. a living pvper).
CFCRandomSpawn.Config.CLOSENESS_LIMIT = 400 -- Will not choose spawnpoints that are within this many units of a valid player (i.e. a living pvper).
CFCRandomSpawn.Config.SELECTION_SIZE = 16 -- Max number of 'ideal' spawnpoints to select from randomly.
CFCRandomSpawn.Config.CENTER_UPDATE_INTERVAL = 120 -- The gap (in seconds) between each center popularity update. If set to 0, will update on every respawn.
CFCRandomSpawn.Config.IGNORE_BUILDERS = true -- Should 'center popularity' and player position average not care about builders? Requires a PvP addon which uses a function of the form PLAYER:IsInPvp()
Expand Down

0 comments on commit a80e9ac

Please sign in to comment.