]> git.rm.cloudns.org Git - xonotic/xonotic-data.pk3dir.git/commitdiff
Add a property for item's default pickup_anyway value
authorMario <mario@smbclan.net>
Fri, 27 Jan 2017 01:58:34 +0000 (11:58 +1000)
committerMario <mario@smbclan.net>
Fri, 27 Jan 2017 01:58:34 +0000 (11:58 +1000)
qcsrc/common/items/item/ammo.qh
qcsrc/common/items/item/armor.qh
qcsrc/common/items/item/health.qh
qcsrc/common/items/item/pickup.qh
qcsrc/common/t_items.qc
qcsrc/server/miscfunctions.qh

index f240578b3295f7f7f50978245c123e01f61d3dfa..d7c3e9408c3e6786874eec9656d5f5ecde99f572 100644 (file)
@@ -1,11 +1,16 @@
 #pragma once
 
 #include "pickup.qh"
+#ifdef SVQC
+PROPERTY(float, g_pickup_ammo_anyway);
+#endif
+
 CLASS(Ammo, Pickup)
 #ifdef SVQC
     ATTRIB(Ammo, m_pickupevalfunc, float(entity player, entity item), ammo_pickupevalfunc);
     ATTRIB(Ammo, m_respawntime, float(), GET(g_pickup_respawntime_ammo));
     ATTRIB(Ammo, m_respawntimejitter, float(), GET(g_pickup_respawntimejitter_ammo));
+    ATTRIB(Ammo, m_pickupanyway, float(), GET(g_pickup_ammo_anyway));
 #endif
 ENDCLASS(Ammo)
 
index 9fcd076345213216f0c4d49fa6f2f8fbb6df1a08..f153bf06e3e64e681c1811a78561708f0e7965b8 100644 (file)
@@ -18,6 +18,9 @@ ENDCLASS(Armor)
 MODEL(ArmorSmall_ITEM, Item_Model("item_armor_small.md3"));
 SOUND(ArmorSmall, Item_Sound("armor1"));
 #endif
+#ifdef SVQC
+PROPERTY(float, g_pickup_armorsmall_anyway);
+#endif
 
 REGISTER_ITEM(ArmorSmall, Armor) {
 #ifdef GAMEQC
@@ -30,6 +33,7 @@ REGISTER_ITEM(ArmorSmall, Armor) {
     this.m_itemid               =   IT_ARMOR_SHARD;
     this.m_respawntime          =   GET(g_pickup_respawntime_short);
     this.m_respawntimejitter    =   GET(g_pickup_respawntimejitter_short);
+    this.m_pickupanyway         =   GET(g_pickup_armorsmall_anyway);
 #endif
 }
 
@@ -37,6 +41,9 @@ REGISTER_ITEM(ArmorSmall, Armor) {
 MODEL(ArmorMedium_ITEM, Item_Model("item_armor_medium.md3"));
 SOUND(ArmorMedium, Item_Sound("armor10"));
 #endif
+#ifdef SVQC
+PROPERTY(float, g_pickup_armormedium_anyway);
+#endif
 
 REGISTER_ITEM(ArmorMedium, Armor) {
 #ifdef GAMEQC
@@ -49,6 +56,7 @@ REGISTER_ITEM(ArmorMedium, Armor) {
     this.m_itemid               =   IT_ARMOR;
     this.m_respawntime          =   GET(g_pickup_respawntime_medium);
     this.m_respawntimejitter    =   GET(g_pickup_respawntimejitter_medium);
+    this.m_pickupanyway         =   GET(g_pickup_armormedium_anyway);
 #endif
 }
 
@@ -56,6 +64,9 @@ REGISTER_ITEM(ArmorMedium, Armor) {
 MODEL(ArmorBig_ITEM, Item_Model("item_armor_big.md3"));
 SOUND(ArmorBig, Item_Sound("armor17_5"));
 #endif
+#ifdef SVQC
+PROPERTY(float, g_pickup_armorbig_anyway);
+#endif
 
 REGISTER_ITEM(ArmorBig, Armor) {
 #ifdef GAMEQC
@@ -70,6 +81,7 @@ REGISTER_ITEM(ArmorBig, Armor) {
     this.m_itemid               =   IT_ARMOR;
     this.m_respawntime          =   GET(g_pickup_respawntime_long);
     this.m_respawntimejitter    =   GET(g_pickup_respawntimejitter_long);
+    this.m_pickupanyway         =   GET(g_pickup_armorbig_anyway);
 #endif
 }
 
@@ -77,6 +89,9 @@ REGISTER_ITEM(ArmorBig, Armor) {
 MODEL(ArmorMega_ITEM, Item_Model("item_armor_large.md3"));
 SOUND(ArmorMega, Item_Sound("armor25"));
 #endif
+#ifdef SVQC
+PROPERTY(float, g_pickup_armormega_anyway);
+#endif
 
 REGISTER_ITEM(ArmorMega, Armor) {
 #ifdef GAMEQC
@@ -93,5 +108,6 @@ REGISTER_ITEM(ArmorMega, Armor) {
     this.m_itemid               =   IT_ARMOR;
     this.m_respawntime          =   GET(g_pickup_respawntime_long);
     this.m_respawntimejitter    =   GET(g_pickup_respawntimejitter_long);
+    this.m_pickupanyway         =   GET(g_pickup_armormega_anyway);
 #endif
 }
index e32d0ebbdc0cc2f89cf2fd5309476ce1ef11cfa5..1fc544a40073e7a17b31ee327d394c5e01c603df 100644 (file)
@@ -18,6 +18,9 @@ ENDCLASS(Health)
 MODEL(HealthSmall_ITEM, Item_Model("g_h1.md3"));
 SOUND(HealthSmall, Item_Sound("minihealth"));
 #endif
+#ifdef SVQC
+PROPERTY(float, g_pickup_healthsmall_anyway);
+#endif
 
 REGISTER_ITEM(HealthSmall, Health) {
 #ifdef GAMEQC
@@ -30,6 +33,7 @@ REGISTER_ITEM(HealthSmall, Health) {
     this.m_itemid               =   IT_5HP;
     this.m_respawntime          =   GET(g_pickup_respawntime_short);
     this.m_respawntimejitter    =   GET(g_pickup_respawntimejitter_short);
+    this.m_pickupanyway         =   GET(g_pickup_healthsmall_anyway);
 #endif
 }
 
@@ -37,6 +41,9 @@ REGISTER_ITEM(HealthSmall, Health) {
 MODEL(HealthMedium_ITEM, Item_Model("g_h25.md3"));
 SOUND(HealthMedium, Item_Sound("mediumhealth"));
 #endif
+#ifdef SVQC
+PROPERTY(float, g_pickup_healthmedium_anyway);
+#endif
 
 REGISTER_ITEM(HealthMedium, Health) {
 #ifdef GAMEQC
@@ -49,6 +56,7 @@ REGISTER_ITEM(HealthMedium, Health) {
     this.m_itemid               =   IT_25HP;
     this.m_respawntime          =   GET(g_pickup_respawntime_short);
     this.m_respawntimejitter    =   GET(g_pickup_respawntimejitter_short);
+    this.m_pickupanyway         =   GET(g_pickup_healthmedium_anyway);
 #endif
 }
 
@@ -56,6 +64,9 @@ REGISTER_ITEM(HealthMedium, Health) {
 MODEL(HealthBig_ITEM, Item_Model("g_h50.md3"));
 SOUND(HealthBig, Item_Sound("mediumhealth"));
 #endif
+#ifdef SVQC
+PROPERTY(float, g_pickup_healthbig_anyway);
+#endif
 
 REGISTER_ITEM(HealthBig, Health) {
 #ifdef GAMEQC
@@ -70,6 +81,7 @@ REGISTER_ITEM(HealthBig, Health) {
     this.m_itemid               =   IT_25HP;
     this.m_respawntime          =   GET(g_pickup_respawntime_medium);
     this.m_respawntimejitter    =   GET(g_pickup_respawntimejitter_medium);
+    this.m_pickupanyway         =   GET(g_pickup_healthbig_anyway);
 #endif
 }
 
@@ -77,6 +89,9 @@ REGISTER_ITEM(HealthBig, Health) {
 MODEL(HealthMega_ITEM, Item_Model("g_h100.md3"));
 SOUND(HealthMega, Item_Sound("megahealth"));
 #endif
+#ifdef SVQC
+PROPERTY(float, g_pickup_healthmega_anyway);
+#endif
 
 REGISTER_ITEM(HealthMega, Health) {
 #ifdef GAMEQC
@@ -93,5 +108,6 @@ REGISTER_ITEM(HealthMega, Health) {
     this.m_itemid               =   IT_HEALTH;
     this.m_respawntime          =   GET(g_pickup_respawntime_long);
     this.m_respawntimejitter    =   GET(g_pickup_respawntimejitter_long);
+    this.m_pickupanyway         =   GET(g_pickup_healthmega_anyway);
 #endif
 }
index af83fb9c8127062292b3fb03546cb46deb8e8fe8..26771e68d09e2ef325bdf23cc8ec272ce275e51c 100644 (file)
@@ -42,6 +42,7 @@ CLASS(Pickup, GameItem)
     ATTRIB(Pickup, m_pickupevalfunc, float(entity player, entity item), generic_pickupevalfunc);
     ATTRIB(Pickup, m_respawntime, float());
     ATTRIB(Pickup, m_respawntimejitter, float());
+    ATTRIB(Pickup, m_pickupanyway, float());
     float Item_GiveTo(entity item, entity player);
     METHOD(Pickup, giveTo, bool(Pickup this, entity item, entity player))
     {
index 852a9281411f89f753bf039bc4895dc52d0e7939..9aab742d0198560e651cccc71c8bae12beadd517 100644 (file)
@@ -1083,6 +1083,9 @@ void _StartItem(entity this, entity def, float defaultrespawntime, float default
                this.respawntimejitter = defaultrespawntimejitter;
        }
 
+       if(!this.pickup_anyway && def.m_pickupanyway)
+               this.pickup_anyway = def.m_pickupanyway();
+
        int itemid = def.m_itemid;
        this.items = itemid;
        int weaponid = def.instanceOfWeaponPickup ? def.m_weapon.m_id : 0;
@@ -1282,8 +1285,6 @@ spawnfunc(item_rockets)
 {
        if(!this.ammo_rockets)
                this.ammo_rockets = g_pickup_rockets;
-       if(!this.pickup_anyway)
-               this.pickup_anyway = g_pickup_ammo_anyway;
     StartItem(this, ITEM_Rockets);
 }
 
@@ -1301,8 +1302,6 @@ spawnfunc(item_bullets)
 
        if(!this.ammo_nails)
                this.ammo_nails = g_pickup_nails;
-       if(!this.pickup_anyway)
-               this.pickup_anyway = g_pickup_ammo_anyway;
     StartItem(this, ITEM_Bullets);
 }
 
@@ -1310,8 +1309,6 @@ spawnfunc(item_cells)
 {
        if(!this.ammo_cells)
                this.ammo_cells = g_pickup_cells;
-       if(!this.pickup_anyway)
-               this.pickup_anyway = g_pickup_ammo_anyway;
        StartItem(this, ITEM_Cells);
 }
 
@@ -1319,8 +1316,6 @@ spawnfunc(item_plasma)
 {
        if(!this.ammo_plasma)
                this.ammo_plasma = g_pickup_plasma;
-       if(!this.pickup_anyway)
-               this.pickup_anyway = g_pickup_ammo_anyway;
        StartItem(this, ITEM_Plasma);
 }
 
@@ -1338,8 +1333,6 @@ spawnfunc(item_shells)
 
        if(!this.ammo_shells)
                this.ammo_shells = g_pickup_shells;
-       if(!this.pickup_anyway)
-               this.pickup_anyway = g_pickup_ammo_anyway;
        StartItem(this, ITEM_Shells);
 }
 
@@ -1349,8 +1342,6 @@ spawnfunc(item_armor_small)
                this.armorvalue = g_pickup_armorsmall;
        if(!this.max_armorvalue)
                this.max_armorvalue = g_pickup_armorsmall_max;
-       if(!this.pickup_anyway)
-               this.pickup_anyway = g_pickup_armorsmall_anyway;
        StartItem(this, ITEM_ArmorSmall);
 }
 
@@ -1360,8 +1351,6 @@ spawnfunc(item_armor_medium)
                this.armorvalue = g_pickup_armormedium;
        if(!this.max_armorvalue)
                this.max_armorvalue = g_pickup_armormedium_max;
-       if(!this.pickup_anyway)
-               this.pickup_anyway = g_pickup_armormedium_anyway;
        StartItem(this, ITEM_ArmorMedium);
 }
 
@@ -1371,8 +1360,6 @@ spawnfunc(item_armor_big)
                this.armorvalue = g_pickup_armorbig;
        if(!this.max_armorvalue)
                this.max_armorvalue = g_pickup_armorbig_max;
-       if(!this.pickup_anyway)
-               this.pickup_anyway = g_pickup_armorbig_anyway;
        StartItem(this, ITEM_ArmorBig);
 }
 
@@ -1382,8 +1369,6 @@ spawnfunc(item_armor_mega)
                this.armorvalue = g_pickup_armormega;
        if(!this.max_armorvalue)
                this.max_armorvalue = g_pickup_armormega_max;
-       if(!this.pickup_anyway)
-               this.pickup_anyway = g_pickup_armormega_anyway;
        StartItem(this, ITEM_ArmorMega);
 }
 
@@ -1393,8 +1378,6 @@ spawnfunc(item_health_small)
                this.max_health = g_pickup_healthsmall_max;
        if(!this.health)
                this.health = g_pickup_healthsmall;
-       if(!this.pickup_anyway)
-               this.pickup_anyway = g_pickup_healthsmall_anyway;
        StartItem(this, ITEM_HealthSmall);
 }
 
@@ -1404,8 +1387,6 @@ spawnfunc(item_health_medium)
                this.max_health = g_pickup_healthmedium_max;
        if(!this.health)
                this.health = g_pickup_healthmedium;
-       if(!this.pickup_anyway)
-               this.pickup_anyway = g_pickup_healthmedium_anyway;
     StartItem(this, ITEM_HealthMedium);
 }
 
@@ -1415,8 +1396,6 @@ spawnfunc(item_health_big)
                this.max_health = g_pickup_healthbig_max;
        if(!this.health)
                this.health = g_pickup_healthbig;
-       if(!this.pickup_anyway)
-               this.pickup_anyway = g_pickup_healthbig_anyway;
        StartItem(this, ITEM_HealthBig);
 }
 
@@ -1426,8 +1405,6 @@ spawnfunc(item_health_mega)
         this.max_health = g_pickup_healthmega_max;
     if(!this.health)
         this.health = g_pickup_healthmega;
-    if(!this.pickup_anyway)
-        this.pickup_anyway = g_pickup_healthmega_anyway;
     StartItem(this, ITEM_HealthMega);
 }
 
@@ -1591,8 +1568,6 @@ spawnfunc(item_fuel)
 {
        if(!this.ammo_fuel)
                this.ammo_fuel = g_pickup_fuel;
-       if(!this.pickup_anyway)
-               this.pickup_anyway = g_pickup_ammo_anyway;
        StartItem(this, ITEM_JetpackFuel);
 }
 
index eb0f3a910a80cb568c57d52212460d37057f2637..b6eab56bb85eddf6f2dc28bd85334d0e4399d248 100644 (file)
@@ -175,29 +175,20 @@ float g_pickup_fuel_jetpack;
 float g_pickup_fuel_max;
 float g_pickup_armorsmall;
 float g_pickup_armorsmall_max;
-float g_pickup_armorsmall_anyway;
 float g_pickup_armormedium;
 float g_pickup_armormedium_max;
-float g_pickup_armormedium_anyway;
 float g_pickup_armorbig;
 float g_pickup_armorbig_max;
-float g_pickup_armorbig_anyway;
 float g_pickup_armormega;
 float g_pickup_armormega_max;
-float g_pickup_armormega_anyway;
 float g_pickup_healthsmall;
 float g_pickup_healthsmall_max;
-float g_pickup_healthsmall_anyway;
 float g_pickup_healthmedium;
 float g_pickup_healthmedium_max;
-float g_pickup_healthmedium_anyway;
 float g_pickup_healthbig;
 float g_pickup_healthbig_max;
-float g_pickup_healthbig_anyway;
 float g_pickup_healthmega;
 float g_pickup_healthmega_max;
-float g_pickup_healthmega_anyway;
-float g_pickup_ammo_anyway;
 float g_pickup_weapons_anyway;
 float g_weaponarena;
 WepSet g_weaponarena_weapons;