New PropData API function: BreakModel_Entity(NSSurfacePropEntity target, vector dir, float speed);
This commit is contained in:
parent
a8f454dd2c
commit
159756889f
4 changed files with 34 additions and 3 deletions
|
@ -88,7 +88,6 @@ var bool autocvar_mp_flashlight = true;
|
|||
|
||||
void FX_Impact(impactType_t, vector, vector);
|
||||
void FX_Explosion(vector);
|
||||
void FX_GibHuman(vector vecOrigin, vector vecDir, float flForce);
|
||||
|
||||
void TraceAttack_FireBullets(int, vector, int, vector, int);
|
||||
#ifdef BULLETPENETRATION
|
||||
|
|
|
@ -625,11 +625,11 @@ NSSurfacePropEntity::SpawnKey(string strKey, string strValue)
|
|||
m_oldHealth = health;
|
||||
break;
|
||||
case "propdata":
|
||||
SetPropData(strValue);
|
||||
m_strPropData = ReadString(strValue);
|
||||
break;
|
||||
case "surfdata":
|
||||
case "materialdata":
|
||||
SetSurfaceData(strValue);
|
||||
m_strSurfData = ReadString(strValue);
|
||||
break;
|
||||
/* entityDef */
|
||||
case "blood_color":
|
||||
|
@ -695,12 +695,15 @@ void
|
|||
NSSurfacePropEntity::SetSurfaceData(string type)
|
||||
{
|
||||
m_strSurfData = type;
|
||||
_SurfaceDataFinish();
|
||||
}
|
||||
void
|
||||
NSSurfacePropEntity::SetPropData(string type)
|
||||
{
|
||||
m_strPropData = type;
|
||||
_PropDataFinish();
|
||||
}
|
||||
|
||||
void
|
||||
NSSurfacePropEntity::_SurfaceDataFinish(void)
|
||||
{
|
||||
|
|
|
@ -134,6 +134,7 @@ void BreakModel_SpawnID(vector smins, vector smaxs, vector dir, float speed, int
|
|||
void BreakModel_Receive(void);
|
||||
#else
|
||||
void BreakModel_Spawn(vector pos, vector dir, vector spread, float speed, int count, string type);
|
||||
void BreakModel_Entity(NSSurfacePropEntity target, vector dir, float speed);
|
||||
#endif
|
||||
|
||||
/* necessary API functions */
|
||||
|
|
|
@ -639,4 +639,32 @@ BreakModel_Spawn(vector smins, vector smaxs, vector dir, float speed, int count,
|
|||
WriteByte(MSG_MULTICAST, count);
|
||||
multicast((smins - smaxs), MULTICAST_PVS);
|
||||
}
|
||||
|
||||
void
|
||||
BreakModel_Entity(NSSurfacePropEntity target, vector dir, float speed)
|
||||
{
|
||||
string type = Prop_GetInfo(target.m_iPropData, PROPINFO_BREAKMODEL);
|
||||
int count = Prop_GetInfo(target.m_iPropData, PROPINFO_BREAKCOUNT);
|
||||
int index = (int)hash_get(g_hashbreakmodel, type, -1);
|
||||
vector pos = target.GetOrigin();
|
||||
|
||||
if not (index)
|
||||
return;
|
||||
|
||||
WriteByte(MSG_MULTICAST, SVC_CGAMEPACKET);
|
||||
WriteByte(MSG_MULTICAST, EV_BREAKMODEL);
|
||||
WriteByte(MSG_MULTICAST, index);
|
||||
WriteCoord(MSG_MULTICAST, pos[0] + target.mins[0]);
|
||||
WriteCoord(MSG_MULTICAST, pos[1] + target.mins[1]);
|
||||
WriteCoord(MSG_MULTICAST, pos[2] + target.mins[2]);
|
||||
WriteCoord(MSG_MULTICAST, pos[0] + target.maxs[0]);
|
||||
WriteCoord(MSG_MULTICAST, pos[1] + target.maxs[1]);
|
||||
WriteCoord(MSG_MULTICAST, pos[2] + target.maxs[2]);
|
||||
WriteCoord(MSG_MULTICAST, dir[0]);
|
||||
WriteCoord(MSG_MULTICAST, dir[1]);
|
||||
WriteCoord(MSG_MULTICAST, dir[2]);
|
||||
WriteFloat(MSG_MULTICAST, speed);
|
||||
WriteByte(MSG_MULTICAST, count);
|
||||
multicast(pos, MULTICAST_PVS);
|
||||
}
|
||||
#endif
|
Loading…
Reference in a new issue