From: TimePath Date: Mon, 21 Dec 2015 07:19:51 +0000 (+1100) Subject: Monsters: resolve assertion failures X-Git-Tag: xonotic-v0.8.2~1463 X-Git-Url: https://git.rm.cloudns.org/?a=commitdiff_plain;h=1bc6a948a2621113f4b766a5c371e2557e6572ab;p=xonotic%2Fxonotic-data.pk3dir.git Monsters: resolve assertion failures --- diff --git a/qcsrc/lib/spawnfunc.qh b/qcsrc/lib/spawnfunc.qh index 3f9ca0e94..ef0d68f00 100644 --- a/qcsrc/lib/spawnfunc.qh +++ b/qcsrc/lib/spawnfunc.qh @@ -140,7 +140,9 @@ noref bool require_spawnfunc_prefix; 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) \ diff --git a/qcsrc/server/weapons/tracing.qc b/qcsrc/server/weapons/tracing.qc index 2d9dd2388..a9dc4bd28 100644 --- a/qcsrc/server/weapons/tracing.qc +++ b/qcsrc/server/weapons/tracing.qc @@ -25,7 +25,7 @@ void W_SetupShot_Dir_ProjectileSize_Range(entity ent, vector s_forward, vector m 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; @@ -50,7 +50,7 @@ void W_SetupShot_Dir_ProjectileSize_Range(entity ent, vector s_forward, vector m 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); diff --git a/qcsrc/server/weapons/weaponsystem.qc b/qcsrc/server/weapons/weaponsystem.qc index 919c88809..2aa11b2c9 100644 --- a/qcsrc/server/weapons/weaponsystem.qc +++ b/qcsrc/server/weapons/weaponsystem.qc @@ -256,6 +256,7 @@ bool weapon_prepareattack_checkammo(Weapon thiswep, entity actor, bool secondary .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 @@ -283,6 +284,7 @@ bool weapon_prepareattack_check(Weapon thiswep, entity actor, .entity weaponenti 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 @@ -322,6 +324,7 @@ void weapon_thinkf(entity actor, .entity weaponentity, WFRAME fr, float t, void( .entity weaponentity, int fire) func) { entity this = actor.(weaponentity); + if (this == NULL) return; bool restartanim; if (fr == WFRAME_DONTCHANGE) { @@ -338,16 +341,13 @@ void weapon_thinkf(entity actor, .entity weaponentity, WFRAME fr, float t, void( 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;