Wiping all corpses after a round ends now

Fixed the EscapeZone ent I never commited properly
C4 Bombs now trigger the c4 target spots
Some more messages for equipment/weapon buying
Some more Rule tweaks that could cause issues with dead people buying guns via future binds
Hit locational damage now applied properly, derp
This commit is contained in:
Marco Cawthorne 2017-01-10 16:45:41 +01:00
parent 8d6a6477f9
commit 3d219d7fdb
11 changed files with 83 additions and 21 deletions

View file

@ -60,9 +60,6 @@ string Damage_GetHitLocation( int iSurface ) {
}
void Damage_Apply( entity eTarget, entity eAttacker, int iDamage, vector vHitPos ) {
eTarget.health = eTarget.health - iDamage; // TODO: Body part multipliers
// Special monetary punishment for hostage murderers
if ( eTarget.classname == "hostage_entity" ) {
if ( eTarget.health > 0 ) {
@ -72,8 +69,14 @@ void Damage_Apply( entity eTarget, entity eAttacker, int iDamage, vector vHitPos
}
}
// Modify the damage based on the location
if ( trace_surface_id == BODY_HEAD ) {
iDamage *= 4;
if ( eTarget.iEquipment & EQUIPMENT_HELMET ) {
iDamage *= 0.5;
eTarget.iEquipment -= EQUIPMENT_HELMET;
} else {
iDamage *= 4;
}
} else if ( trace_surface_id == BODY_STOMACH ) {
iDamage *= 0.9;
} else if ( trace_surface_id == BODY_LEGLEFT ) {
@ -82,6 +85,9 @@ void Damage_Apply( entity eTarget, entity eAttacker, int iDamage, vector vHitPos
iDamage *= 0.4;
}
// Apply the damage finally
eTarget.health = eTarget.health - iDamage;
dprint( sprintf( "[DEBUG] Hit Bodypart: %s\n", Damage_GetHitLocation( trace_surface_id ) ) );
// Target is dead and a client....

View file

@ -85,6 +85,7 @@ int iRescueZones;
int iBuyZones;
int iVIPZones;
int iBuyRestriction; // For info_map_parameters
int iBombRadius; // For info_map_parameters
int iHostagesRescued;
int iBombPlanted;
@ -134,6 +135,7 @@ void TraceAttack_FireBullets( int iShots, vector vPos );
void Damage_Radius( vector vOrigin, entity eAttacker, float fDamage, float fRadius );
void Damage_Apply( entity eTarget, entity eAttacker, int iDamage, vector vHitPos );
void Entities_UseTargets( void );
void Entities_InitRespawnable( void() vRespawnFunc );
void Entities_Respawn( void );

View file

@ -18,14 +18,32 @@ along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/
/*
TODO: This gamemode is odd about balancing, right now the last surviving terrorist
will decide the match. Still have to think about what rules to set up.
*/
/*
=================
func_escapezone_touch
=================
*/
void func_vip_safetyzone( void ) {
void func_escapezone_touch( void ) {
if ( ( other.classname == "player" ) && ( other.team == TEAM_T ) ) {
entity eOld = self;
self = other;
Spawn_MakeSpectator();
self.classname = "player";
forceinfokey( self, "*dead", "0" );
iAlivePlayers_T--;
self = eOld;
if ( iAlivePlayers_T == 0 ) {
Rules_RoundOver( TEAM_T, 2500, FALSE );
}
}
}
@ -36,7 +54,7 @@ SPAWN: func_escapezone
Entry function for the terrorist escape zone
=================
*/
void func_vip_safetyzone( void ) {
void func_escapezone( void ) {
self.angles = '0 0 0';
self.movetype = MOVETYPE_NONE;
self.solid = SOLID_TRIGGER;

View file

@ -376,4 +376,6 @@ void worldspawn( void ) {
pointerstat( STAT_GAMETIME, EV_FLOAT, &fGameTime );
pointerstat( STAT_WON_T, EV_INTEGER, &iWon_T );
pointerstat( STAT_WON_CT, EV_INTEGER, &iWon_CT );
iBombRadius = 1024;
}

View file

@ -66,6 +66,7 @@ void Player_Death( int iHitBody ) {
// Drop a corpse
entity eCorpse = spawn();
eCorpse.classname = "corpse";
setorigin( eCorpse, self.origin );
setmodel( eCorpse, self.model );
setsize( eCorpse, self.mins, self.maxs );

View file

@ -27,6 +27,10 @@ enum {
// Checks if it is possible for players to buy anything
float Rules_BuyingPossible( void ) {
if ( self.health <= 0 ) {
return FALSE;
}
if ( fGameState == GAME_ACTIVE ) {
if ( ( ( autocvar_mp_roundtime * 60 ) - fGameTime ) > autocvar_mp_buytime ) {
centerprint( self, sprintf( "%d seconds have passed...\nYou can't buy anything now!", autocvar_mp_buytime ) );
@ -68,6 +72,7 @@ void Rules_Restart( void ) {
entity eOld = self;
// Spawn/Respawn everyone at their team position and give them $$$
for ( entity eFind = world; ( eFind = find( eFind, classname, "player" ) ); ) {
self = eFind;
@ -80,7 +85,12 @@ void Rules_Restart( void ) {
Money_GiveTeamReward();
}
// Select a random Terrorist for the bomb thing
// Clear the corpses
for ( entity eFind = world; ( eFind = find( eFind, classname, "corpse" ) ); ) {
remove( eFind );
}
// Select a random Terrorist for the bomb, if needed
if ( iBombZones > 0 ) {
int iRandomT = floor( random( 1, (float)iAlivePlayers_T + 1 ) );
int iPickT = 0;
@ -119,7 +129,6 @@ void Rules_Restart( void ) {
}
// Respawn all the entities
for ( entity eFind = world; ( eFind = findfloat( eFind, fRespawns, TRUE ) ); ) {
self = eFind;
Entities_Respawn();
@ -180,10 +189,12 @@ Also allows people to set the bomb placing radius incase you want to use info_bo
=================
*/
.float buying;
void info_map_parameters( void ) {
if ( !self.buying ) {
self.buying = BUY_BOTH;
} else {
.float bombradius;
void info_map_parameters( void ) {
if ( self.bombradius ) {
iBombRadius = self.bombradius;
}
if ( self.buying ) {
iBuyRestriction = self.buying;
}
}

View file

@ -56,6 +56,7 @@ FuncPushable.c
FuncLadder.c
FuncHostageRescue.c
FuncVIPSafetyZone.c
FuncEscapeZone.c
FuncBombTarget.c
FuncBuyZone.c
FuncButton.c

View file

@ -37,7 +37,7 @@ void CSEv_PlayerBuyEquipment_f( float fID ) {
if ( ( self.fMoney - eqptTable[ fID ].iPrice ) >= 0 ) {
if ( eqptTable[ fID ].iID == EQUIPMENT_KEVLAR ) {
if ( self.armor == 100 ) {
// You already own armor etc.
// You already own kevlar etc.
centerprint( self, "You already have kevlar!" );
} else {
self.armor = 100;
@ -50,21 +50,21 @@ void CSEv_PlayerBuyEquipment_f( float fID ) {
} else if ( eqptTable[ fID ].iID == EQUIPMENT_HELMET ) {
if ( self.armor == 100 ) {
if ( self.iEquipment & EQUIPMENT_HELMET ) {
// You already have full armor and a helmet
// You already have full kevlar and a helmet
centerprint( self, "You already have kevlar and a helmet!" );
} else {
// You have full armor, but no helmet
centerprint( self, "You already have some kevlar,\nand now you've bought a helmet!" );
// You have full kevlar, but no helmet
Money_AddMoney( self, -350 );
sound( self, CHAN_ITEM, "items/tr_kevlar.wav", 1, ATTN_IDLE );
centerprint( self, "You already have some kevlar,\nand now you've bought a helmet!" );
}
} else {
if ( self.iEquipment & EQUIPMENT_HELMET ) {
// Only get armor
centerprint( self, "You already have a helmet,\nand now you're bought some kevlar!" );
// Only get kevlar
self.armor = 100;
Money_AddMoney( self, -650 );
sound( self, CHAN_ITEM, "items/tr_kevlar.wav", 1, ATTN_IDLE );
centerprint( self, "You already have a helmet,\nand now you're bought some kevlar!" );
} else {
// Get both
self.armor = 100;
@ -78,8 +78,10 @@ void CSEv_PlayerBuyEquipment_f( float fID ) {
return;
}
self.iEquipment = self.iEquipment | ( eqptTable[ fID ].iID );
Money_AddMoney( self, -eqptTable[ fID ].iPrice );
self.iEquipment = self.iEquipment | ( eqptTable[ fID ].iID );
} else {
centerprint( self, "You have insufficient funds!" );
}
self.fAttackFinished = time + 1.0;

View file

@ -72,11 +72,28 @@ void WeaponC4BOMB_Drop( vector vBombPos ) {
// If our time has passed, explode
if ( self.fAttackFinished < time ) {
// Terrorists win
Rules_RoundOver( TEAM_T, 3500, FALSE );
// Make it explode and hurt things
Damage_Radius( self.origin, self, 500, 1024 );
sound( self, CHAN_VOICE, "weapons/c4_explode1.wav", 1.0, ATTN_NONE );
Damage_Radius( self.origin, self.owner, 500, 1024 );
remove( self );
// Trigger all targets
entity eBombChain = findradius( self.origin, iBombRadius );
while ( eBombChain ) {
if ( ( eBombChain.classname == "func_bomb_target" ) ) {
entity eOld = self;
self = eBombChain;
Entities_UseTargets();
self = eOld;
}
eBombChain = eBombChain.chain;
}
iBombPlanted = FALSE;
remove( self );
return;
}

View file

@ -192,6 +192,8 @@ void CSEv_PlayerBuyWeapon_f( float fWeapon ) {
Money_AddMoney( self, -wptTable[ fWeapon ].iPrice );
sound( self, CHAN_ITEM, "items/gunpickup2.wav", 1, ATTN_IDLE );
} else {
centerprint( self, "You have insufficient funds!" );
}
self.fAttackFinished = time + 1.0;

Binary file not shown.