X-Git-Url: https://de.git.xonotic.org/?a=blobdiff_plain;f=qcsrc%2Fcommon%2Ftriggers%2Ffunc%2Fbreakable.qc;h=79c2feb4eab85b8115a0ddcd00270a26323d7c81;hb=ad968484aff56d9765a62a9428b99b6e0a508ac5;hp=2b7a1155f483b101c8b122a5986df60f8d270219;hpb=e424ba544c41fc40b241b17bd7c1d9c2fc930705;p=xonotic%2Fxonotic-data.pk3dir.git diff --git a/qcsrc/common/triggers/func/breakable.qc b/qcsrc/common/triggers/func/breakable.qc index 2b7a1155f..79c2feb4e 100644 --- a/qcsrc/common/triggers/func/breakable.qc +++ b/qcsrc/common/triggers/func/breakable.qc @@ -89,8 +89,6 @@ void func_breakable_colormod(entity this) this.colormod = '1 0 0' + '0 1 0' * (2 * h - 0.5); else this.colormod = '1 1 1'; - - CSQCMODEL_AUTOUPDATE(this); } void func_breakable_look_destroyed(entity this) @@ -109,24 +107,22 @@ void func_breakable_look_destroyed(entity this) this.origin_z = floorZ; } _setmodel(this, this.mdl_dead); + ApplyMinMaxScaleAngles(this); this.effects &= ~EF_NODRAW; } - CSQCMODEL_AUTOUPDATE(this); - this.solid = SOLID_NOT; } void func_breakable_look_restore(entity this) { _setmodel(this, this.mdl); + ApplyMinMaxScaleAngles(this); this.effects &= ~EF_NODRAW; if(this.mdl_dead != "") // only do this if we use mdl_dead, to behave better with misc_follow setorigin(this, this.dropped_origin); - CSQCMODEL_AUTOUPDATE(this); - this.solid = SOLID_BSP; } @@ -134,6 +130,8 @@ void func_breakable_behave_destroyed(entity this) { this.health = this.max_health; this.takedamage = DAMAGE_NO; + if(this.bot_attack) + IL_REMOVE(g_bot_targets, this); this.bot_attack = false; this.event_damage = func_null; this.state = 1; @@ -144,6 +142,13 @@ void func_breakable_behave_destroyed(entity this) stopsound (this, CH_TRIGGER_SINGLE); } +void func_breakable_think(entity this) +{ + this.nextthink = time; + CSQCMODEL_AUTOUPDATE(this); +} + +void func_breakable_destroy(entity this, entity actor, entity trigger); void func_breakable_behave_restore(entity this) { this.health = this.max_health; @@ -155,11 +160,17 @@ void func_breakable_behave_restore(entity this) if(!(this.spawnflags & 4)) { this.takedamage = DAMAGE_AIM; + if(!this.bot_attack) + IL_PUSH(g_bot_targets, this); this.bot_attack = true; this.event_damage = func_breakable_damage; } + if(this.spawnflags & 4) + this.use = func_breakable_destroy; // don't need to set it usually, as .use isn't reset this.state = 0; - this.nextthink = 0; // cancel auto respawn + //this.nextthink = 0; // cancel auto respawn + setthink(this, func_breakable_think); + this.nextthink = time + 0.1; func_breakable_colormod(this); if (this.noise1) _sound (this, CH_TRIGGER_SINGLE, this.noise1, VOL_BASE, ATTEN_NORM); @@ -178,16 +189,12 @@ void func_breakable_destroyed(entity this) { func_breakable_look_destroyed(this); func_breakable_behave_destroyed(this); - - CSQCMODEL_AUTOUPDATE(this); } void func_breakable_restore(entity this, entity actor, entity trigger) { func_breakable_look_restore(this); func_breakable_behave_restore(this); - - CSQCMODEL_AUTOUPDATE(this); } void func_breakable_restore_self(entity this) @@ -222,6 +229,7 @@ void func_breakable_destroy(entity this, entity actor, entity trigger) if(this.respawntime) { + CSQCMODEL_AUTOUPDATE(this); setthink(this, func_breakable_restore_self); this.nextthink = time + this.respawntime + crandom() * this.respawntimejitter; } @@ -263,7 +271,7 @@ void func_breakable_damage(entity this, entity inflictor, entity attacker, float this.takedamage = DAMAGE_NO; this.event_damage = func_null; - if(IS_CLIENT(attacker) && this.classname == "func_assault_destructible") + if(IS_CLIENT(attacker)) //&& this.classname == "func_assault_destructible") { this.owner = attacker; this.realowner = attacker; @@ -272,6 +280,7 @@ void func_breakable_damage(entity this, entity inflictor, entity attacker, float // do not explode NOW but in the NEXT FRAME! // because recursive calls to RadiusDamage are not allowed this.nextthink = time; + CSQCMODEL_AUTOUPDATE(this); setthink(this, func_breakable_destroy_self); } } @@ -284,8 +293,6 @@ void func_breakable_reset(entity this) func_breakable_behave_destroyed(this); else func_breakable_behave_restore(this); - - CSQCMODEL_AUTOUPDATE(this); } // destructible walls that can be used to trigger target_objective_decrease @@ -346,12 +353,13 @@ spawnfunc(func_breakable) precache_sound(this.noise1); this.team_saved = this.team; + IL_PUSH(g_saved_team, this); this.dropped_origin = this.origin; this.reset = func_breakable_reset; this.reset(this); - this.init_for_player_needed = 1; + IL_PUSH(g_initforplayer, this); this.init_for_player = func_breakable_init_for_player; CSQCMODEL_AUTOINIT(this);