]> git.rm.cloudns.org Git - xonotic/xonotic-data.pk3dir.git/commitdiff
add supply event to battle royale, drops random items from the sky
authorJuhu <5894800-Juhu_@users.noreply.gitlab.com>
Mon, 22 May 2023 10:57:46 +0000 (12:57 +0200)
committerJuhu <5894800-Juhu_@users.noreply.gitlab.com>
Mon, 22 May 2023 10:57:46 +0000 (12:57 +0200)
gamemodes-server.cfg
qcsrc/common/gamemodes/gamemode/br/_mod.inc
qcsrc/common/gamemodes/gamemode/br/_mod.qh
qcsrc/common/gamemodes/gamemode/br/sv_br.qc
qcsrc/common/gamemodes/gamemode/br/sv_br.qh
qcsrc/common/gamemodes/gamemode/br/sv_events.qc [new file with mode: 0644]
qcsrc/common/gamemodes/gamemode/br/sv_events.qh [new file with mode: 0644]

index 6fa607dc4879e226d20d86194358a94c26bbc737..28d56d34856d32e0806607bc84be96f57f6eb74b 100644 (file)
@@ -611,3 +611,4 @@ set g_br_ring_center_factor 0.25 "factor by which the ring can deviate from the
 set g_br_ring_fadedistance 0.5 "value multiplied by the current ring radius defines the distance at which the ring slowly becomes visible until it reaches g_br_ring_alpha when standing right in front of it"
 set g_br_ring_fadedistance_min 2000 "minimum value generated by g_br_ring_fadedistance"
 set g_br_ring_exitvehicle 0 "players can't use vehicles outside of the ring"
+set g_br_supply_interval 30 "seconds between each supply drop or 0 to disable"
index 41d489e46c15c9ffff54f8b6aadfbd5db898207c..4b1bb7966c46bd001ee20be6a63a55a5e1f6008f 100644 (file)
@@ -16,6 +16,9 @@
 #ifdef SVQC
     #include <common/gamemodes/gamemode/br/sv_dropship.qc>
 #endif
+#ifdef SVQC
+    #include <common/gamemodes/gamemode/br/sv_events.qc>
+#endif
 #ifdef CSQC
     #include <common/gamemodes/gamemode/br/cl_squad.qc>
 #endif
index 2f1f2fe4b6858961d46f5ef2a57ea938187fa768..badfe28777b8bf6fe48689a6be814d9f849ef69c 100644 (file)
@@ -16,6 +16,9 @@
 #ifdef SVQC
     #include <common/gamemodes/gamemode/br/sv_dropship.qh>
 #endif
+#ifdef SVQC
+    #include <common/gamemodes/gamemode/br/sv_events.qh>
+#endif
 #ifdef CSQC
     #include <common/gamemodes/gamemode/br/cl_squad.qh>
 #endif
index a4b211a3d7f9662ec4d214ee4347868b9309c631..f14f707c001858d9841f7f31d8d2accdeab4c4f4 100644 (file)
@@ -1011,6 +1011,17 @@ MUTATOR_HOOKFUNCTION(br, PlayerSpawn)
         br_Start();
 }
 
+MUTATOR_HOOKFUNCTION(br, SV_StartFrame)
+{
+    static float supply_time = 0;
+
+    if(autocvar_g_br_supply_interval > 0 && time - supply_time >= autocvar_g_br_supply_interval)
+    {
+        supply_time = time;
+        spawn_supply();
+    }
+}
+
 float br_CalculatePlayerDropAngle(entity this)
 {
     if(this.velocity.z < 0)
index 8ec22c1ab12889934cce1bbbca3620ec4b7f766b..daf6acec66121e53bfd381109625e4e7d1f2f5e8 100644 (file)
@@ -38,3 +38,4 @@ float autocvar_g_br_bleedlinear = 1;
 int autocvar_g_br_squad_size = 3;
 int autocvar_g_br_minplayers = 2;
 bool autocvar_g_br_ring_exitvehicle = false;
+float autocvar_g_br_supply_interval = 30;
diff --git a/qcsrc/common/gamemodes/gamemode/br/sv_events.qc b/qcsrc/common/gamemodes/gamemode/br/sv_events.qc
new file mode 100644 (file)
index 0000000..f2e8af8
--- /dev/null
@@ -0,0 +1,11 @@
+#include "sv_events.qh"
+
+void spawn_supply()
+{
+    string item_class = RandomItems_GetRandomItemClassName("br_supply");
+    entity this = Item_Create(item_class, '0 0 0', false);
+
+    MoveToRandomLocationWithinBounds(this, world.mins, world.maxs, DPCONTENTS_SOLID, DPCONTENTS_SLIME | DPCONTENTS_LAVA | DPCONTENTS_SKY | DPCONTENTS_DONOTENTER, Q3SURFACEFLAG_SKY, 2500, 0, 0, false);
+    tracebox(this.origin, this.mins, this.maxs, this.origin + '0 0 65536', MOVE_NORMAL, this);
+    setorigin(this, trace_endpos);
+}
diff --git a/qcsrc/common/gamemodes/gamemode/br/sv_events.qh b/qcsrc/common/gamemodes/gamemode/br/sv_events.qh
new file mode 100644 (file)
index 0000000..9d0339c
--- /dev/null
@@ -0,0 +1,49 @@
+#pragma once
+
+void spawn_supply();
+
+noref float autocvar_g_br_supply_health_probability = 0;
+noref float autocvar_g_br_supply_armor_probability = 0;
+noref float autocvar_g_br_supply_resource_probability = 0;
+noref float autocvar_g_br_supply_weapon_probability = 1;
+noref float autocvar_g_br_supply_powerup_probability = 0;
+
+noref float autocvar_g_br_supply_item_health_small_probability = 0;
+noref float autocvar_g_br_supply_item_health_medium_probability = 0;
+noref float autocvar_g_br_supply_item_health_big_probability = 0;
+noref float autocvar_g_br_supply_item_health_mega_probability = 0;
+
+noref float autocvar_g_br_supply_item_armor_small_probability = 0;
+noref float autocvar_g_br_supply_item_armor_medium_probability = 0;
+noref float autocvar_g_br_supply_item_armor_big_probability = 0;
+noref float autocvar_g_br_supply_item_armor_mega_probability = 0;
+
+noref float autocvar_g_br_supply_item_bullets_probability = 0;
+noref float autocvar_g_br_supply_item_cells_probability = 0;
+noref float autocvar_g_br_supply_item_fuel_probability = 0;
+noref float autocvar_g_br_supply_item_fuel_regen_probability = 0;
+noref float autocvar_g_br_supply_item_invisibility_probability = 0;
+noref float autocvar_g_br_supply_item_jetpack_probability = 0;
+noref float autocvar_g_br_supply_item_plasma_probability = 0;
+noref float autocvar_g_br_supply_item_rockets_probability = 0;
+noref float autocvar_g_br_supply_item_shells_probability = 0;
+noref float autocvar_g_br_supply_item_shield_probability = 0;
+noref float autocvar_g_br_supply_item_speed_probability = 0;
+noref float autocvar_g_br_supply_item_strength_probability = 0;
+
+noref float autocvar_g_br_supply_weapon_arc_probability = 0;
+noref float autocvar_g_br_supply_weapon_blaster_probability = 0;
+noref float autocvar_g_br_supply_weapon_crylink_probability = 0.1;
+noref float autocvar_g_br_supply_weapon_devastator_probability = 0.1;
+noref float autocvar_g_br_supply_weapon_electro_probability = 0.1;
+noref float autocvar_g_br_supply_weapon_fireball_probability = 0;
+noref float autocvar_g_br_supply_weapon_hagar_probability = 0;
+noref float autocvar_g_br_supply_weapon_hook_probability = 0;
+noref float autocvar_g_br_supply_weapon_machinegun_probability = 0.1;
+noref float autocvar_g_br_supply_weapon_mortar_probability = 0.1;
+noref float autocvar_g_br_supply_weapon_porto_probability = 0;
+noref float autocvar_g_br_supply_weapon_shockwave_probability = 0;
+noref float autocvar_g_br_supply_weapon_shotgun_probability = 0.1;
+noref float autocvar_g_br_supply_weapon_tuba_probability = 0;
+noref float autocvar_g_br_supply_weapon_vaporizer_probability = 0;
+noref float autocvar_g_br_supply_weapon_vortex_probability = 0.1;