const float drop_speed_vertical_max = 0.9;
const float drop_distance_disconnect = 32;
const float drop_speed_crash = 0.9;
+float br_event_supply_time;
+float br_event_vehicle_time;
bool br_started = false;
.bool br_ring_warned;
.float br_drop_time;
MUTATOR_HOOKFUNCTION(br, SV_StartFrame)
{
- static float supply_time = 0;
+ if(!br_started)
+ return false;
- if(autocvar_g_br_supply_interval > 0 && time - supply_time >= autocvar_g_br_supply_interval)
+ if(autocvar_g_br_supply_interval > 0 && time - br_event_supply_time >= autocvar_g_br_supply_interval)
{
- supply_time = time;
+ br_event_supply_time = time;
spawn_supply();
}
+
+ if(autocvar_g_br_vehicle_interval > 0 && time - br_event_vehicle_time >= autocvar_g_br_vehicle_interval)
+ {
+ br_event_vehicle_time = time;
+ spawn_vehicle();
+ }
}
float br_CalculatePlayerDropAngle(entity this)
it.br_force_drop_distance = min_distance + random() * max(dropship_path_length - (min_distance + dropship_speed * br_drop_time_secs), 0);
});
+ br_event_supply_time = br_event_vehicle_time = time;
round_handler.cnt = 0; // emulate round handler round start
}
#include "sv_events.qh"
+void drop_from_sky(entity this);
+
void spawn_supply()
{
string item_class = RandomItems_GetRandomItemClassName("br_supply");
- entity this = Item_Create(item_class, '0 0 0', false);
+ entity this = Item_CreateLoot(item_class, '0 0 0', '0 0 0', 999999999);
+ this.reset = SUB_Remove;
+
+ drop_from_sky(this);
+}
+
+void spawn_vehicle()
+{
+ entity this = spawn();
+ this.br_vehicle_drop = true;
+ if(!vehicle_initialize(this, VEH_SPIDERBOT, true)) { delete(this); return; }
+ this.pos2.y = random() * 360;
+ vehicles_spawn(this);
+ this.reset = SUB_Remove;
+
+ drop_from_sky(this);
+}
+
+// TODO: ensure spawn is within ring
+void drop_from_sky(entity this)
+{
+ for(int i = 0; i < 100; ++i)
+ {
+ MoveToRandomLocationWithinBounds(this, world.mins, world.maxs, DPCONTENTS_SOLID, DPCONTENTS_SLIME | DPCONTENTS_LAVA | DPCONTENTS_SKY | DPCONTENTS_DONOTENTER, Q3SURFACEFLAG_SKY, 10, 0, 0, false);
+ tracebox(this.origin, this.mins, this.maxs, this.origin + '0 0 65536', MOVE_NORMAL, this);
+ if(!(trace_dphitq3surfaceflags & Q3SURFACEFLAG_SKY))
+ continue;
+
+ setorigin(this, trace_endpos);
+ return;
+ }
- 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);
+ LOG_WARN("drop from sky not possible, spawning on floor");
}
void vehicles_setreturn(entity veh)
{
+ if(veh.br_vehicle_drop)
+ return;
+
vehicles_clearreturn(veh);
entity ret = new(vehicle_return);
this.angles = this.pos2;
setorigin(this, this.pos1);
// Show it
- Send_Effect(EFFECT_TELEPORT, this.origin + '0 0 64', '0 0 0', 1);
+ if(!this.br_vehicle_drop)
+ Send_Effect(EFFECT_TELEPORT, this.origin + '0 0 64', '0 0 0', 1);
if(this.vehicle_controller)
this.team = this.vehicle_controller.team;