From: Mario Date: Mon, 20 Apr 2015 00:53:27 +0000 (+1000) Subject: Don't enforce classname on items, also add an option to func_breakable to only break... X-Git-Url: https://git.rm.cloudns.org/?a=commitdiff_plain;h=00c3fffa7b14fd75395ae75a4ab855101b725718;p=xonotic%2Fxonotic-data.pk3dir.git Don't enforce classname on items, also add an option to func_breakable to only break on trigger (potentially useful for assault and SMB style maps) --- diff --git a/qcsrc/common/triggers/func/breakable.qc b/qcsrc/common/triggers/func/breakable.qc index 94b70d96c..caf44cabd 100644 --- a/qcsrc/common/triggers/func/breakable.qc +++ b/qcsrc/common/triggers/func/breakable.qc @@ -29,6 +29,7 @@ // spawnflags: // 1 = start disabled (needs to be triggered to activate) // 2 = indicate damage +// 4 = don't take direct damage (needs to be triggered to 'explode', then triggered again to restore) // notes: // for mdl_dead to work, origin must be set (using a common/origin brush). // Otherwise mdl_dead will be displayed at the map origin, and nobody would @@ -128,6 +129,8 @@ void func_breakable_behave_destroyed() self.bot_attack = false; self.event_damage = func_null; self.state = 1; + if(self.spawnflags & 4) + self.use = func_null; func_breakable_colormod(); if (self.noise1) stopsound (self, CH_TRIGGER_SINGLE); @@ -141,9 +144,12 @@ void func_breakable_behave_restore() WaypointSprite_UpdateMaxHealth(self.sprite, self.max_health); WaypointSprite_UpdateHealth(self.sprite, self.health); } - self.takedamage = DAMAGE_AIM; - self.bot_attack = true; - self.event_damage = func_breakable_damage; + if(!(self.spawnflags & 4)) + { + self.takedamage = DAMAGE_AIM; + self.bot_attack = true; + self.event_damage = func_breakable_damage; + } self.state = 0; self.nextthink = 0; // cancel auto respawn func_breakable_colormod(); @@ -284,7 +290,17 @@ void spawnfunc_func_breakable() self.mdl = self.model; SetBrushEntityModel(); - self.use = func_breakable_restore; + if(self.spawnflags & 4) + self.use = func_breakable_destroy; + else + self.use = func_breakable_restore; + + if(self.spawnflags & 4) + { + self.takedamage = DAMAGE_NO; + self.event_damage = func_null; + self.bot_attack = false; + } // precache all the models if (self.mdl_dead) diff --git a/qcsrc/server/t_items.qc b/qcsrc/server/t_items.qc index b1d3d4f37..0fd1f6bc0 100644 --- a/qcsrc/server/t_items.qc +++ b/qcsrc/server/t_items.qc @@ -1288,7 +1288,6 @@ void spawnfunc_item_armor_medium (void) { } void spawnfunc_item_armor_big (void) { - self.classname = "item_armor_big"; if(!self.armorvalue) self.armorvalue = g_pickup_armorbig; if(!self.max_armorvalue) @@ -1299,7 +1298,6 @@ void spawnfunc_item_armor_big (void) { } void spawnfunc_item_armor_large (void) { - self.classname = "item_armor_large"; if(!self.armorvalue) self.armorvalue = g_pickup_armorlarge; if(!self.max_armorvalue) @@ -1310,7 +1308,6 @@ void spawnfunc_item_armor_large (void) { } void spawnfunc_item_health_small (void) { - self.classname = "item_health_small"; if(!self.max_health) self.max_health = g_pickup_healthsmall_max; if(!self.health) @@ -1321,7 +1318,6 @@ void spawnfunc_item_health_small (void) { } void spawnfunc_item_health_medium (void) { - self.classname = "item_health_medium"; if(!self.max_health) self.max_health = g_pickup_healthmedium_max; if(!self.health) @@ -1332,7 +1328,6 @@ void spawnfunc_item_health_medium (void) { } void spawnfunc_item_health_large (void) { - self.classname = "item_health_large"; if(!self.max_health) self.max_health = g_pickup_healthlarge_max; if(!self.health)