Skip to content

Commit

Permalink
func_breakable gib speed
Browse files Browse the repository at this point in the history
  • Loading branch information
Mikk155 committed Aug 25, 2024
1 parent 19b5112 commit b859030
Show file tree
Hide file tree
Showing 4 changed files with 22 additions and 3 deletions.
4 changes: 4 additions & 0 deletions docs/src/sentences.json
Original file line number Diff line number Diff line change
Expand Up @@ -1938,6 +1938,10 @@
{
"english": "Direction (Gibs Direction 2)"
},
"Breakable::direction_speed":
{
"english": "Direction speed"
},
"Breakable::delay":
{
"english": "Delay before fire"
Expand Down
8 changes: 7 additions & 1 deletion src/data/base/Breakable.json
Original file line number Diff line number Diff line change
Expand Up @@ -83,11 +83,17 @@
"description": "Breakable::explosion::description"
},
"direction": {
"variable": "studio",
"variable": "vector",
"value": "",
"title": "Breakable::direction",
"description": "Breakable::direction::description"
},
"direction_speed": {
"variable": "float",
"value": "200",
"title": "Breakable::direction_speed",
"description": "Breakable::direction_speed::description"
},
"delay": {
"variable": "string",
"value": "0",
Expand Down
12 changes: 10 additions & 2 deletions src/game/server/entities/func_break.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,13 @@ bool CBreakable::KeyValue(KeyValueData* pkvd)
UTIL_StringToVector(m_VecDirection, pkvd->szValue);
return true;
}
else if (FStrEq(pkvd->szKeyName, "direction_speed"))
{
m_DirectionSpeed = atoi( pkvd->szValue );
if( m_DirectionSpeed < 10 )
m_DirectionSpeed = 10;
return true;
}
else if (FStrEq(pkvd->szKeyName, "material"))
{
int i = atoi(pkvd->szValue);
Expand Down Expand Up @@ -101,6 +108,7 @@ DEFINE_FIELD(m_Material, FIELD_INTEGER),
DEFINE_FIELD(m_iszGibModel, FIELD_STRING),
DEFINE_FIELD(m_iszSpawnObject, FIELD_STRING),
DEFINE_FIELD(m_VecDirection, FIELD_VECTOR),
DEFINE_FIELD(m_DirectionSpeed, FIELD_FLOAT),
DEFINE_FUNCTION(BreakTouch),
DEFINE_FUNCTION(Die),

Expand Down Expand Up @@ -641,9 +649,9 @@ void CBreakable::Die()


if (m_Explosion == expDirected)
vecVelocity = -g_vecAttackDir * 200;
vecVelocity = -g_vecAttackDir * m_DirectionSpeed;
else if (m_Explosion == expSpecific)
vecVelocity = m_VecDirection * 200;
vecVelocity = m_VecDirection * m_DirectionSpeed;
else
{
vecVelocity.x = 0;
Expand Down
1 change: 1 addition & 0 deletions src/game/server/entities/func_break.h
Original file line number Diff line number Diff line change
Expand Up @@ -98,4 +98,5 @@ class CBreakable : public CBaseDelay
string_t m_iszSpawnObject;

Vector m_VecDirection = g_vecZero;
float m_DirectionSpeed = 200;
};

0 comments on commit b859030

Please sign in to comment.