]> git.rm.cloudns.org Git - xonotic/xonotic-data.pk3dir.git/commitdiff
Don't enforce classname on items, also add an option to func_breakable to only break...
authorMario <zacjardine@y7mail.com>
Mon, 20 Apr 2015 00:53:27 +0000 (10:53 +1000)
committerMario <zacjardine@y7mail.com>
Mon, 20 Apr 2015 00:53:27 +0000 (10:53 +1000)
qcsrc/common/triggers/func/breakable.qc
qcsrc/server/t_items.qc

index 94b70d96c5ba24e75604736f669660dc15dc1231..caf44cabd5b31de350ee03ba6ec7bd6ffe194c9b 100644 (file)
@@ -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)
index b1d3d4f370425ebf813efc9d0836d390c80b76c3..0fd1f6bc0fa3f9fa7527afefe56e779f6ba98ac1 100644 (file)
@@ -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)