mirror of
https://github.com/s1lentq/ReGameDLL_CS.git
synced 2025-02-05 18:20:33 +03:00
Fix: ammo
/weapons
respawn behavior (#982)
* `CBasePlayerAmmo`: check spawnflags on `Spawn()` * `CBasePlayerItem`: check spawnflags on `Materialize()` * `CBasePlayerItem`: Add `Respawn()` item when hasn't specific spawnflags * `CBasePlayerItem`: remove `SF_NORESPAWN` flag on `Respawn()` * Use forgotten `AMMO_RESPAWN_TIME`
This commit is contained in:
parent
576e967cbd
commit
a202425dd7
@ -10,7 +10,11 @@ void CBasePlayerAmmo::Spawn()
|
||||
|
||||
SetTouch(&CBasePlayerAmmo::DefaultTouch);
|
||||
|
||||
if (g_pGameRules->IsMultiplayer())
|
||||
if (g_pGameRules->IsMultiplayer()
|
||||
#ifdef REGAMEDLL_FIXES
|
||||
&& g_pGameRules->AmmoShouldRespawn(this) == GR_AMMO_RESPAWN_NO
|
||||
#endif
|
||||
)
|
||||
{
|
||||
SetThink(&CBaseEntity::SUB_Remove);
|
||||
pev->nextthink = gpGlobals->time + 2.0f;
|
||||
|
@ -4321,7 +4321,7 @@ int CHalfLifeMultiplay::AmmoShouldRespawn(CBasePlayerAmmo *pAmmo)
|
||||
|
||||
float CHalfLifeMultiplay::FlAmmoRespawnTime(CBasePlayerAmmo *pAmmo)
|
||||
{
|
||||
return gpGlobals->time + 20.0f;
|
||||
return gpGlobals->time + AMMO_RESPAWN_TIME;
|
||||
}
|
||||
|
||||
Vector CHalfLifeMultiplay::VecAmmoRespawnSpot(CBasePlayerAmmo *pAmmo)
|
||||
|
@ -518,7 +518,11 @@ void CBasePlayerItem::Materialize()
|
||||
UTIL_SetOrigin(pev, pev->origin);
|
||||
SetTouch(&CBasePlayerItem::DefaultTouch);
|
||||
|
||||
if (g_pGameRules->IsMultiplayer())
|
||||
if (g_pGameRules->IsMultiplayer()
|
||||
#ifdef REGAMEDLL_FIXES
|
||||
&& g_pGameRules->WeaponShouldRespawn(this) == GR_WEAPON_RESPAWN_NO
|
||||
#endif
|
||||
)
|
||||
{
|
||||
if (!CanDrop())
|
||||
{
|
||||
@ -555,8 +559,12 @@ void CBasePlayerItem::CheckRespawn()
|
||||
{
|
||||
switch (g_pGameRules->WeaponShouldRespawn(this))
|
||||
{
|
||||
case GR_WEAPON_RESPAWN_YES:
|
||||
case GR_WEAPON_RESPAWN_YES: {
|
||||
#ifdef REGAMEDLL_FIXES
|
||||
Respawn();
|
||||
#endif
|
||||
return;
|
||||
}
|
||||
case GR_WEAPON_RESPAWN_NO:
|
||||
return;
|
||||
}
|
||||
@ -575,6 +583,10 @@ CBaseEntity *CBasePlayerItem::Respawn()
|
||||
// invisible for now
|
||||
pNewWeapon->pev->effects |= EF_NODRAW;
|
||||
|
||||
#ifdef REGAMEDLL_ADD
|
||||
pNewWeapon->pev->spawnflags &= ~SF_NORESPAWN;
|
||||
#endif
|
||||
|
||||
// no touch
|
||||
pNewWeapon->SetTouch(nullptr);
|
||||
pNewWeapon->SetThink(&CBasePlayerItem::AttemptToMaterialize);
|
||||
|
Loading…
x
Reference in New Issue
Block a user