]> git.xonotic.org Git - xonotic/xonotic-data.pk3dir.git/blobdiff - qcsrc/common/mapobjects/func/breakable.qc
Merge branch 'master' into Mario/monsters
[xonotic/xonotic-data.pk3dir.git] / qcsrc / common / mapobjects / func / breakable.qc
index bf482b73a2f9dc27fd9aea6c61a4620b49b74e99..6064603591492332ac4089011059b7e6f708bcbd 100644 (file)
@@ -311,8 +311,7 @@ void func_breakable_reset(entity this)
                func_breakable_behave_restore(this);
 }
 
-// destructible walls that can be used to trigger target_objective_decrease
-spawnfunc(func_breakable)
+void func_breakable_setup(entity this)
 {
        float n, i;
        if(!GetResource(this, RES_HEALTH))
@@ -355,6 +354,7 @@ spawnfunc(func_breakable)
                this.takedamage = DAMAGE_NO;
                this.event_damage = func_null;
                this.bot_attack = false;
+               this.monster_attack = false;
        }
 
        // precache all the models
@@ -375,6 +375,9 @@ spawnfunc(func_breakable)
        this.reset = func_breakable_reset;
        this.reset(this);
 
+       if(this.monster_attack)
+               IL_PUSH(g_monster_targets, this);
+
        IL_PUSH(g_initforplayer, this);
        this.init_for_player = func_breakable_init_for_player;
 
@@ -382,7 +385,8 @@ spawnfunc(func_breakable)
 }
 
 // for use in maps with a "model" key set
-spawnfunc(misc_breakablemodel) {
-       spawnfunc_func_breakable(this);
-}
+spawnfunc(misc_breakablemodel) { func_breakable_setup(this); }
+
+// destructible walls that can be used to trigger target_objective_decrease
+spawnfunc(func_breakable) { func_breakable_setup(this); }
 #endif