Skip to content
This repository has been archived by the owner on Mar 23, 2024. It is now read-only.

Commit

Permalink
csdm_spawn_manager: better spawns placement for Z coord (#53)
Browse files Browse the repository at this point in the history
* Add ducking detection

* Fix: index of bounds error

* ADD_Z_POSITION to 2.0
  • Loading branch information
SergeyShorokhov authored Oct 16, 2021
1 parent fa4e860 commit 6b666b6
Showing 1 changed file with 7 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ const Float:MIN_SPAWN_RADIUS = 450.0 // beta

// spawn editor options
const MAX_SEARCH_DISTANCE = 2500
const Float:ADD_Z_POSITION = 15.0
const Float:ADD_Z_POSITION = 2.0

new const Float:g_flGravityValues[] = {1.0, 0.5, 0.25, 0.15, 0.05}

Expand Down Expand Up @@ -175,7 +175,7 @@ RandomSpawn(const pPlayer)
if(!g_iTotalPoints || g_bFirstSpawn[pPlayer])
return false

new iRand = random(g_iTotalPoints), iAttempts, iLast = g_iLastSpawnIndex[pPlayer]
new iRand = random(g_iTotalPoints - 1), iAttempts, iLast = g_iLastSpawnIndex[pPlayer]
do
{
iAttempts++
Expand All @@ -188,8 +188,8 @@ RandomSpawn(const pPlayer)
return true
}

if(iRand++ > g_iTotalPoints) {
iRand = random(g_iTotalPoints)
if(iRand++ >= g_iTotalPoints) {
iRand = random(g_iTotalPoints - 1)
}

} while(iAttempts <= g_iTotalPoints)
Expand Down Expand Up @@ -575,6 +575,9 @@ GetPosition(const pEntity, Float:vecOrigin[coord_e], Float:vecAngles[coord_e], F
get_entvar(pEntity, var_origin, vecOrigin)
get_entvar(pEntity, var_angles, vecAngles)
get_entvar(pEntity, var_v_angle, vecVAngles)

if(get_entvar(pEntity, var_flags) & FL_DUCKING)
vecOrigin[2] += 18.0
}

bool:SetAimedEntity(const pPlayer, pEntity = NULLENT, bool:bPrint = true)
Expand Down

0 comments on commit 6b666b6

Please sign in to comment.