]> git.rm.cloudns.org Git - xonotic/xonotic-data.pk3dir.git/commitdiff
Fixed instagib powerups.
authorLyberta <lyberta@lyberta.net>
Sun, 8 Oct 2017 17:06:52 +0000 (20:06 +0300)
committerLyberta <lyberta@lyberta.net>
Sun, 8 Oct 2017 17:06:52 +0000 (20:06 +0300)
mutators.cfg
qcsrc/common/mutators/mutator/instagib/_mod.inc
qcsrc/common/mutators/mutator/instagib/items.qh
qcsrc/common/mutators/mutator/instagib/sv_items.qc [new file with mode: 0644]
qcsrc/common/t_items.qc
qcsrc/server/mutators/mutator/gamemode_lms.qc

index 2597d518b9dbb6964f5b75f934ce915aa9a4f449..1f989d30ddc7203a6cf93a9f83c420ffb942b263 100644 (file)
@@ -36,7 +36,9 @@ set g_instagib_ammo_convert_bullets 0 "convert bullet ammo packs to insta cell a
 set g_instagib_ammo_convert_cells 0 "convert normal cell ammo packs to insta cell ammo packs"
 set g_instagib_ammo_convert_rockets 0 "convert rocket ammo packs to insta cell ammo packs"
 set g_instagib_ammo_convert_shells 0 "convert shell ammo packs to insta cell ammo packs"
+set g_instagib_invisibility_time 30 "Time of ivisibility powerup in seconds."
 set g_instagib_invis_alpha 0.15
+set g_instagib_speed_time 30 "Time of speed powerup in seconds."
 set g_instagib_speed_highspeed 1.5 "speed-multiplier that applies while you carry the invincibility powerup"
 set g_instagib_damagedbycontents 1 "allow damage from lava pits in instagib"
 set g_instagib_blaster_keepdamage 0 "allow secondary fire to hurt players"
index 2195111f0f269e2903f767e3badf17644e0aa27d..55a67b1e38a95abcd62c87af38cd29425a308510 100644 (file)
@@ -1,5 +1,8 @@
 // generated file; do not modify
 #include <common/mutators/mutator/instagib/items.qc>
+#ifdef SVQC
+    #include <common/mutators/mutator/instagib/sv_items.qc>
+#endif
 #ifdef SVQC
     #include <common/mutators/mutator/instagib/sv_instagib.qc>
 #endif
index ac2761bd5e980909aefca5d62d399277bbbcdd6e..f0e18daab5aad3e3fa9f65b7473f5d80eda5ab83 100644 (file)
@@ -69,6 +69,13 @@ MODEL(Invisibility_ITEM, Item_Model("g_strength.md3"));
 SOUND(Invisibility, Item_Sound("powerup"));
 #endif
 
+#ifdef SVQC
+/// \brief Initializes the invisibility powerup.
+/// \param[in,out] item Item to initialize.
+/// \return No return.
+void powerup_invisibility_init(entity item);
+#endif
+
 REGISTER_ITEM(Invisibility, Powerup) {
     this.m_canonical_spawnfunc = "item_invisibility";
 #ifdef GAMEQC
@@ -82,6 +89,9 @@ REGISTER_ITEM(Invisibility, Powerup) {
     this.m_waypoint         =   _("Invisibility");
     this.m_waypointblink    =   2;
     this.m_itemid           =   IT_STRENGTH;
+#ifdef SVQC
+    this.m_iteminit         =   powerup_invisibility_init;
+#endif
 }
 
 #ifdef GAMEQC
@@ -89,6 +99,13 @@ MODEL(Speed_ITEM, Item_Model("g_invincible.md3"));
 SOUND(Speed, Item_Sound("powerup_shield"));
 #endif
 
+#ifdef SVQC
+/// \brief Initializes the speed powerup.
+/// \param[in,out] item Item to initialize.
+/// \return No return.
+void powerup_speed_init(entity item);
+#endif
+
 REGISTER_ITEM(Speed, Powerup) {
     this.m_canonical_spawnfunc = "item_speed";
 #ifdef GAMEQC
@@ -102,4 +119,7 @@ REGISTER_ITEM(Speed, Powerup) {
     this.m_waypoint         =   _("Speed");
     this.m_waypointblink    =   2;
     this.m_itemid           =   IT_INVINCIBLE;
+#ifdef SVQC
+    this.m_iteminit         =   powerup_speed_init;
+#endif
 }
diff --git a/qcsrc/common/mutators/mutator/instagib/sv_items.qc b/qcsrc/common/mutators/mutator/instagib/sv_items.qc
new file mode 100644 (file)
index 0000000..ffd9bfb
--- /dev/null
@@ -0,0 +1,23 @@
+#include "items.qh"
+
+/// \brief Time of ivisibility powerup in seconds.
+float autocvar_g_instagib_invisibility_time;
+/// \brief Time of speed powerup in seconds.
+float autocvar_g_instagib_speed_time;
+
+void powerup_invisibility_init(entity item)
+{
+       if(!item.strength_finished)
+       {
+               item.strength_finished = autocvar_g_instagib_invisibility_time;
+       }
+}
+
+
+void powerup_speed_init(entity item)
+{
+       if(!item.invincible_finished)
+       {
+               item.invincible_finished = autocvar_g_instagib_speed_time;
+       }
+}
index 97938e81d850d65b490aac9728cacb2c47da0e0e..70c462288637bfa0af4f90f178afaf113626443a 100644 (file)
@@ -909,22 +909,22 @@ void Item_Touch(entity this, entity toucher)
        // Expiring loot will have strength "ticking" will it's dropped.
        // Not expiring will not tick.
        // OTOH, do we really need expiring loot?
-       if (this.classname == "droppedweapon")
-       {
-               this.strength_finished = max(0, this.strength_finished - time);
-               this.invincible_finished = max(0, this.invincible_finished - time);
-               this.superweapons_finished = max(0, this.superweapons_finished - time);
-       }
+       //if (this.classname == "droppedweapon")
+       //{
+       //      this.strength_finished = max(0, this.strength_finished - time);
+       //      this.invincible_finished = max(0, this.invincible_finished - time);
+       //      this.superweapons_finished = max(0, this.superweapons_finished - time);
+       //}
        bool gave = ITEM_HANDLE(Pickup, this.itemdef, this, toucher);
        if (!gave)
        {
-               if (Item_IsLoot(this))
-               {
-                       // undo what we did above
-                       this.strength_finished += time;
-                       this.invincible_finished += time;
-                       this.superweapons_finished += time;
-               }
+               //if (this.classname == "droppedweapon")
+               //{
+               //      // undo what we did above
+               //      this.strength_finished += time;
+               //      this.invincible_finished += time;
+               //      this.superweapons_finished += time;
+               //}
                return;
        }
 
index 4d6f70438583b0f805b40070754e303b1a3f4726..cd8fb390d4726744ee117bbad21fffe5a2fcaa62 100644 (file)
@@ -1,6 +1,6 @@
 #include "gamemode_lms.qh"
 
-#include <common/mutators/mutator/instagib/items.qc>
+#include <common/mutators/mutator/instagib/items.qh>
 #include <server/campaign.qh>
 #include <server/command/_mod.qh>