Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 10 additions & 0 deletions reactivedrop/fgd/reactivedrop.fgd
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,11 @@
@PointClass base(Targetname, Parentname, Angles, Studiomodel) studioprop("models/sentry_gun/flame_top.mdl") = asw_sentry_top_flamer
[
TurretRange(float) : "Turret Range" : "375" : "Maximum distance that it will pick targets."
friendlyfire(choices) : "Do Friendly Fire" : 1 : "Whether the sentry will inflict friendly fire to marines." =
[
0 : "No"
1 : "Yes"
]
]

@PointClass base(Targetname, Parentname, Angles, Studiomodel) studioprop("models/sentry_gun/freeze_top.mdl") = asw_sentry_top_icer
Expand All @@ -56,6 +61,11 @@
[
TurretRange(float) : "Turret Range" : "1000" : "Maximum distance that it will pick targets."
FireRate(float) : "Fire Rate" : "1.75" : "Time in seconds between each shot"
friendlyfire(choices) : "Do Friendly Fire" : 1 : "Whether the sentry will inflict friendly fire to marines." =
[
0 : "No"
1 : "Yes"
]
]

@SolidClass base(Trigger) = trigger_rd_marine_jumpjet :
Expand Down
5 changes: 5 additions & 0 deletions reactivedrop/fgd/swarm.fgd
Original file line number Diff line number Diff line change
Expand Up @@ -3824,6 +3824,11 @@
@PointClass base(Targetname, Parentname, Angles, Studiomodel) studioprop("models/sentry_gun/machinegun_top.mdl") = asw_sentry_top_machinegun
[
TurretRange(float) : "Turret Range" : "525" : "Maximum distance that it will pick targets."
friendlyfire(choices) : "Do Friendly Fire" : 1 : "Whether the sentry will inflict friendly fire to marines." =
[
0 : "No"
1 : "Yes"
]
]

@PointClass sphere() iconsprite("editor/env_shake.vmt") base(Targetname, Parentname) = asw_env_shake :
Expand Down
7 changes: 5 additions & 2 deletions src/game/server/swarm/asw_marine.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,7 @@
#include "ammodef.h"
#include "asw_shareddefs.h"
#include "asw_sentry_base.h"
#include "asw_sentry_top.h"
#include "asw_button_area.h"
#include "asw_equipment_list.h"
#include "asw_weapon_parse.h"
Expand Down Expand Up @@ -1365,13 +1366,15 @@ int CASW_Marine::OnTakeDamage_Alive( const CTakeDamageInfo &info )
CTakeDamageInfo newInfo(info);

CBaseEntity* pAttacker = newInfo.GetAttacker();
CBaseEntity* pWeapon = newInfo.GetWeapon();
if ( asw_debug_marine_damage.GetBool() )
Msg( "Marine taking premodified damage of %f\n", newInfo.GetDamage() );

// scale sentry gun damage
if ( pAttacker && IsSentryClass( pAttacker->Classify() ) )
if ( pWeapon && IsSentryClass( pWeapon->Classify() ) )
{
if ( asw_sentry_friendly_fire_scale.GetFloat() <= 0 )
CASW_Sentry_Top *pSentry = dynamic_cast< CASW_Sentry_Top* >( pWeapon );
if ( asw_sentry_friendly_fire_scale.GetFloat() <= 0 || ( pSentry && !pSentry->m_bFriendlyFire ) )
return 0;

newInfo.ScaleDamage( asw_sentry_friendly_fire_scale.GetFloat() );
Expand Down
2 changes: 2 additions & 0 deletions src/game/server/swarm/asw_sentry_top.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,7 @@ BEGIN_DATADESC( CASW_Sentry_Top )
DEFINE_FIELD( m_iSentryAngle, FIELD_INTEGER ),
DEFINE_KEYFIELD( m_flShootRange, FIELD_FLOAT, "TurretRange" ),
DEFINE_FIELD( m_bLowAmmo, FIELD_BOOLEAN ),
DEFINE_KEYFIELD( m_bFriendlyFire, FIELD_BOOLEAN, "friendlyfire" ),
END_DATADESC()

BEGIN_ENT_SCRIPTDESC( CASW_Sentry_Top, CBaseCombatCharacter, "sentry top" )
Expand All @@ -78,6 +79,7 @@ CASW_Sentry_Top::CASW_Sentry_Top()
m_iBaseTurnRate = ASW_SENTRY_TURNRATE / 2;
m_iEnemyTurnRate = ASW_SENTRY_TURNRATE;
m_iSentryAngle = ASW_SENTRY_ANGLE;
m_bFriendlyFire = true;

m_iPoseParamPitch = -2;
m_iPoseParamYaw = -2;
Expand Down
1 change: 1 addition & 0 deletions src/game/server/swarm/asw_sentry_top.h
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,7 @@ class CASW_Sentry_Top : public CBaseCombatCharacter
int m_iBaseTurnRate; // angles per second
int m_iEnemyTurnRate;
CNetworkVar( int, m_iSentryAngle );
bool m_bFriendlyFire;

float m_flTimeFirstFired;

Expand Down
4 changes: 4 additions & 0 deletions src/game/shared/baseentity_shared.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
#include "model_types.h"
#include "gamestringpool.h"
#include "ammodef.h"
#include "asw_shareddefs.h"
#include "takedamageinfo.h"
#include "shot_manipulator.h"
#include "ai_debug_shared.h"
Expand Down Expand Up @@ -1991,6 +1992,9 @@ void CBaseEntity::FireBullets( const FireBulletsInfo_t &info )
{
// Damage specified by function parameter
CTakeDamageInfo dmgInfo( this, pAttacker, flActualDamage, nActualDamageType );
if ( IsSentryClass( Classify() ) )
dmgInfo.SetWeapon( this );

CalculateBulletDamageForce( &dmgInfo, info.m_iAmmoType, vecDir, tr.endpos );
dmgInfo.ScaleDamageForce( info.m_flDamageForceScale );
dmgInfo.SetAmmoType( info.m_iAmmoType );
Expand Down