]> de.git.xonotic.org Git - xonotic/xonotic-data.pk3dir.git/commitdiff
Merge branch 'master' into Lyberta/OffhandBlaster 534/head
authorLyberta <lyberta@lyberta.net>
Sat, 17 Feb 2018 05:21:25 +0000 (08:21 +0300)
committerLyberta <lyberta@lyberta.net>
Sat, 17 Feb 2018 05:21:25 +0000 (08:21 +0300)
defaultServer.cfg
mutators.cfg
qcsrc/common/mutators/mutator/_mod.inc
qcsrc/common/mutators/mutator/_mod.qh
qcsrc/common/mutators/mutator/offhand_blaster/_mod.inc [new file with mode: 0644]
qcsrc/common/mutators/mutator/offhand_blaster/_mod.qh [new file with mode: 0644]
qcsrc/common/mutators/mutator/offhand_blaster/sv_offhand_blaster.qc [new file with mode: 0644]
qcsrc/common/mutators/mutator/overkill/sv_overkill.qc
qcsrc/common/weapons/weapon/blaster.qc
qcsrc/common/weapons/weapon/blaster.qh
qcsrc/common/weapons/weapon/vaporizer.qc

index 4cabc2246ac608a760fa1fc596f576a54cf1e9a9..f9609e346c8e0e85d5bfd8846732e2cac286b3ae 100644 (file)
@@ -223,9 +223,6 @@ set g_balance_cloaked_alpha 0.25
 set g_playerclip_collisions 1 "0 = disable collision testing against playerclips, might be useful on some defrag maps"
 set g_botclip_collisions 1 "0 = disable collision testing against botclips, might be useful on some defrag maps"
 
-set g_grappling_hook 0 "let players spawn with the grappling hook which allows them to pull themselves up"
-set g_grappling_hook_useammo 0 "use ammunition with the off-hand grappling hook"
-
 set g_spawn_alloweffects 1 "allow clients to enable spawn point and event effects such as particles and sounds, see cl_spawn_ cvars for more info"
 set g_spawn_furthest 0.5 "this amount of the spawns shall be far away from any players"
 set g_spawn_useallspawns 0 "use all spawns, e.g. also team spawns in non-teamplay, and all spawns, even enemy spawns, in teamplay"
index af0fa9e68477e1b05e3366e6dddb57a1f3547677..2fd56a49cef54d4ae9831436181c2070fe868d3f 100644 (file)
@@ -376,6 +376,13 @@ set g_buffs_flight 0 "flight buff: crouch jump to reverse your gravity!"
 set g_buffs_flight_time 60 "flight buff carry time"
 
 
+// ================
+//  grappling hook
+// ================
+set g_grappling_hook 0 "let players spawn with the grappling hook which allows them to pull themselves up"
+set g_grappling_hook_useammo 0 "use ammunition with the off-hand grappling hook"
+
+
 // ==============
 //  vampire hook
 // ==============
@@ -386,6 +393,12 @@ set g_vampirehook_health_steal "2" "give hooker this much health per damage fram
 set g_vampirehook_teamheal "1" "hooking teammates drains hooker's health"
 
 
+// =================
+//  offhand blaster
+// =================
+set g_offhand_blaster 0 "whether to enable offhand blaster"
+
+
 // ===============
 //  rocket minsta
 // ===============
index 9d52fa20c44af25537d2b11bf68b04b2020cac0c..40a763c8ec04b39b9a39dfb3d8d915bf647e1324 100644 (file)
@@ -22,6 +22,7 @@
 #include <common/mutators/mutator/nades/_mod.inc>
 #include <common/mutators/mutator/new_toys/_mod.inc>
 #include <common/mutators/mutator/nix/_mod.inc>
+#include <common/mutators/mutator/offhand_blaster/_mod.inc>
 #include <common/mutators/mutator/overkill/_mod.inc>
 #include <common/mutators/mutator/physical_items/_mod.inc>
 #include <common/mutators/mutator/pinata/_mod.inc>
index f9edf4c56c47868e01161b34793a5c05e33f64d9..6a9261dd41f394cd3496bf119ec6fa92e6ebb0f1 100644 (file)
@@ -22,6 +22,7 @@
 #include <common/mutators/mutator/nades/_mod.qh>
 #include <common/mutators/mutator/new_toys/_mod.qh>
 #include <common/mutators/mutator/nix/_mod.qh>
+#include <common/mutators/mutator/offhand_blaster/_mod.qh>
 #include <common/mutators/mutator/overkill/_mod.qh>
 #include <common/mutators/mutator/physical_items/_mod.qh>
 #include <common/mutators/mutator/pinata/_mod.qh>
diff --git a/qcsrc/common/mutators/mutator/offhand_blaster/_mod.inc b/qcsrc/common/mutators/mutator/offhand_blaster/_mod.inc
new file mode 100644 (file)
index 0000000..41bb01e
--- /dev/null
@@ -0,0 +1,4 @@
+// generated file; do not modify
+#ifdef SVQC
+    #include <common/mutators/mutator/offhand_blaster/sv_offhand_blaster.qc>
+#endif
diff --git a/qcsrc/common/mutators/mutator/offhand_blaster/_mod.qh b/qcsrc/common/mutators/mutator/offhand_blaster/_mod.qh
new file mode 100644 (file)
index 0000000..98fb481
--- /dev/null
@@ -0,0 +1 @@
+// generated file; do not modify
diff --git a/qcsrc/common/mutators/mutator/offhand_blaster/sv_offhand_blaster.qc b/qcsrc/common/mutators/mutator/offhand_blaster/sv_offhand_blaster.qc
new file mode 100644 (file)
index 0000000..a4b9b18
--- /dev/null
@@ -0,0 +1,24 @@
+string autocvar_g_offhand_blaster;
+
+REGISTER_MUTATOR(offhand_blaster, expr_evaluate(autocvar_g_offhand_blaster));
+
+MUTATOR_HOOKFUNCTION(offhand_blaster, BuildMutatorsString)
+{
+       M_ARGV(0, string) = strcat(M_ARGV(0, string), ":offhand_blaster");
+}
+
+MUTATOR_HOOKFUNCTION(offhand_blaster, BuildMutatorsPrettyString)
+{
+       M_ARGV(0, string) = strcat(M_ARGV(0, string), ", Offhand blaster");
+}
+
+MUTATOR_HOOKFUNCTION(offhand_blaster, BuildGameplayTipsString)
+{
+    M_ARGV(0, string) = strcat(M_ARGV(0, string), "\n\n^3offhand blaster^8 is enabled, press 'e' to use it\n");
+}
+
+MUTATOR_HOOKFUNCTION(offhand_blaster, PlayerSpawn)
+{
+       entity player = M_ARGV(0, entity);
+       player.offhand = OFFHAND_BLASTER;
+}
index 20216f9283d1333115be8045b3a78c395f24b17e..e9106239467ffc7432cda21fa887481db192a6cc 100644 (file)
@@ -144,20 +144,7 @@ MUTATOR_HOOKFUNCTION(ok, PlayerPreThink)
                        if(player.(weaponentity).m_weapon == WEP_Null && slot != 0)
                                continue;
 
-                       W_Blaster_Attack(
-                               player,
-                               weaponentity,
-                               WEP_BLASTER.m_id | HITTYPE_SECONDARY,
-                               WEP_CVAR_SEC(vaporizer, shotangle),
-                               WEP_CVAR_SEC(vaporizer, damage),
-                               WEP_CVAR_SEC(vaporizer, edgedamage),
-                               WEP_CVAR_SEC(vaporizer, radius),
-                               WEP_CVAR_SEC(vaporizer, force),
-                               WEP_CVAR_SEC(vaporizer, speed),
-                               WEP_CVAR_SEC(vaporizer, spread),
-                               WEP_CVAR_SEC(vaporizer, delay),
-                               WEP_CVAR_SEC(vaporizer, lifetime)
-                       );
+                       BLASTER_SECONDARY_ATTACK(vaporizer, player, weaponentity);
                }
        }
 
index ec1f070e3e2be1f24167c3432b50ce4909870158..e3d713d470b5808f2f12a35b02cdaf6c53bb5755 100644 (file)
@@ -195,6 +195,17 @@ METHOD(Blaster, wr_killmessage, Notification(entity thiswep))
     return WEAPON_BLASTER_MURDER;
 }
 
+METHOD(OffhandBlaster, offhand_think, void(OffhandBlaster this, entity actor, bool key_pressed))
+{
+       if (!key_pressed || (time < actor.jump_interval))
+       {
+               return;
+       }
+       actor.jump_interval = time + WEP_CVAR_SEC(blaster, refire) * W_WeaponRateFactor(actor);
+       .entity weaponentity = weaponentities[1];
+       BLASTER_SECONDARY_ATTACK(blaster, actor, weaponentity);
+}
+
 #endif
 #ifdef CSQC
 
index 0a0e7c17d2f57c21cdbee6d3735f0576c566377e..7efbdf7a52cc661899ce42c973c72c11df5959df 100644 (file)
@@ -48,6 +48,10 @@ REGISTER_WEAPON(BLASTER, blaster, NEW(Blaster));
 SPAWNFUNC_WEAPON(weapon_blaster, WEP_BLASTER)
 SPAWNFUNC_WEAPON(weapon_laser, WEP_BLASTER)
 
+CLASS(OffhandBlaster, OffhandWeapon)
+ENDCLASS(OffhandBlaster)
+OffhandBlaster OFFHAND_BLASTER; STATIC_INIT(OFFHAND_BLASTER) { OFFHAND_BLASTER = NEW(OffhandBlaster); }
+
 #ifdef SVQC
 .float blaster_damage;
 .float blaster_edgedamage;
@@ -55,4 +59,22 @@ SPAWNFUNC_WEAPON(weapon_laser, WEP_BLASTER)
 .float blaster_force;
 .float blaster_lifetime;
 
+// Will be demacroed after WEP_CVAR macros are also demacroed.
+#define BLASTER_SECONDARY_ATTACK(weapon_name, actor, weaponentity) \
+       makevectors(actor.v_angle); \
+       W_Blaster_Attack( \
+               actor, \
+               weaponentity, \
+               WEP_BLASTER.m_id | HITTYPE_SECONDARY, \
+               WEP_CVAR_SEC(weapon_name, shotangle), \
+               WEP_CVAR_SEC(weapon_name, damage), \
+               WEP_CVAR_SEC(weapon_name, edgedamage), \
+               WEP_CVAR_SEC(weapon_name, radius), \
+               WEP_CVAR_SEC(weapon_name, force), \
+               WEP_CVAR_SEC(weapon_name, speed), \
+               WEP_CVAR_SEC(weapon_name, spread), \
+               WEP_CVAR_SEC(weapon_name, delay), \
+               WEP_CVAR_SEC(weapon_name, lifetime) \
+       );
+
 #endif
index c2a9491be2ad0a3c30f79e2a5da14a233c72d86c..7dae1b3f731d2a3cf479a8a71ddd733ea1ed2afe 100644 (file)
@@ -338,22 +338,7 @@ METHOD(Vaporizer, wr_think, void(entity thiswep, entity actor, .entity weaponent
             if(WEP_CVAR_SEC(vaporizer, ammo))
                 W_DecreaseAmmo(thiswep, actor, WEP_CVAR_SEC(vaporizer, ammo), weaponentity);
 
-            // ugly instagib hack to reuse the fire mode of the laser
-            makevectors(actor.v_angle);
-            W_Blaster_Attack(
-                actor,
-                weaponentity,
-                WEP_BLASTER.m_id | HITTYPE_SECONDARY,
-                WEP_CVAR_SEC(vaporizer, shotangle),
-                WEP_CVAR_SEC(vaporizer, damage),
-                WEP_CVAR_SEC(vaporizer, edgedamage),
-                WEP_CVAR_SEC(vaporizer, radius),
-                WEP_CVAR_SEC(vaporizer, force),
-                WEP_CVAR_SEC(vaporizer, speed),
-                WEP_CVAR_SEC(vaporizer, spread),
-                WEP_CVAR_SEC(vaporizer, delay),
-                WEP_CVAR_SEC(vaporizer, lifetime)
-            );
+            BLASTER_SECONDARY_ATTACK(vaporizer, actor, weaponentity);
 
             // now do normal refire
             weapon_thinkf(actor, weaponentity, WFRAME_FIRE2, WEP_CVAR_SEC(vaporizer, animtime), w_ready);