FIELD_SCALAR(fld, modelindex) \
FIELD_SCALAR(fld, modelscale) \
FIELD_SCALAR(fld, model) \
+ FIELD_SCALAR(fld, monsterid) \
FIELD_SCALAR(fld, monster_moveflags) \
+ FIELD_SCALAR(fld, monster_name) \
FIELD_SCALAR(fld, movetype) \
FIELD_SCALAR(fld, netname) \
FIELD_SCALAR(fld, nextthink) \
float oldsolid;
vector vecs, dv;
oldsolid = ent.dphitcontentsmask;
- if(PS(ent).m_weapon == WEP_RIFLE)
+ if (IS_PLAYER(ent) && PS(ent).m_weapon == WEP_RIFLE)
ent.dphitcontentsmask = DPCONTENTS_BODY | DPCONTENTS_CORPSE;
else
ent.dphitcontentsmask = DPCONTENTS_SOLID | DPCONTENTS_BODY | DPCONTENTS_CORPSE;
w_shotend = ent.origin + ent.view_ofs + s_forward * autocvar_g_trueaim_minrange;
// track max damage
- if(accuracy_canbegooddamage(ent))
+ if (IS_PLAYER(ent) && accuracy_canbegooddamage(ent))
accuracy_add(ent, PS(ent).m_weapon.m_id, maxdamage, 0);
W_HitPlotAnalysis(ent, v_forward, v_right, v_up);
.float race_penalty;
bool weapon_prepareattack_check(Weapon thiswep, entity actor, .entity weaponentity, bool secondary, float attacktime)
{
+ if (actor.weaponentity == NULL) return true;
if (!weapon_prepareattack_checkammo(thiswep, actor, secondary)) return false;
// if sv_ready_restart_after_countdown is set, don't allow the player to shoot
void weapon_prepareattack_do(entity actor, .entity weaponentity, bool secondary, float attacktime)
{
entity this = actor.(weaponentity);
+ if (this == NULL) return;
this.state = WS_INUSE;
actor.spawnshieldtime = min(actor.spawnshieldtime, time); // kill spawn shield when you fire
.entity weaponentity, int fire) func)
{
entity this = actor.(weaponentity);
+ if (this == NULL) return;
bool restartanim;
if (fr == WFRAME_DONTCHANGE)
{
vector ou = v_up;
vector a = '0 0 0';
- if (this)
- {
- this.wframe = fr;
- if (fr == WFRAME_IDLE) a = this.anim_idle;
- else if (fr == WFRAME_FIRE1) a = this.anim_fire1;
- else if (fr == WFRAME_FIRE2) a = this.anim_fire2;
- else // if (fr == WFRAME_RELOAD)
- a = this.anim_reload;
- a.z *= g_weaponratefactor;
- }
+ this.wframe = fr;
+ if (fr == WFRAME_IDLE) a = this.anim_idle;
+ else if (fr == WFRAME_FIRE1) a = this.anim_fire1;
+ else if (fr == WFRAME_FIRE2) a = this.anim_fire2;
+ else // if (fr == WFRAME_RELOAD)
+ a = this.anim_reload;
+ a.z *= g_weaponratefactor;
v_forward = of;
v_right = or;