float autocvar_g_vehicle_racer_blowup_edgedamage;
float autocvar_g_vehicle_racer_blowup_forceintensity;
+float autocvar_g_vehicle_racer_bouncefactor;
+float autocvar_g_vehicle_racer_bouncestop;
+vector autocvar_g_vehicle_racer_bouncepain;
+
var vector racer_force_from_tag(string tag_name, float spring_length, float max_power);
void racer_align4point()
self.owner = world;
}
+void racer_worldimpact()
+{
+ if(self.play_time < time)
+ if(autocvar_g_vehicle_racer_bouncepain_x)
+ vehilces_worldimpact(autocvar_g_vehicle_racer_bouncepain_x, autocvar_g_vehicle_racer_bouncepain_y, autocvar_g_vehicle_racer_bouncepain_z);
+
+}
void racer_spawn()
{
self.scale = 0.5;
setsize(self, RACER_MIN * 0.5, RACER_MAX * 0.5);
+ self.bouncefactor = autocvar_g_vehicle_racer_bouncefactor;
+ self.bouncestop = autocvar_g_vehicle_racer_bouncestop;
+ self.vehicle_worldimpact = racer_worldimpact;
+ //self.destvec = autocvar_g_vehicle_racer_bouncepain;
}
float autocvar_g_vehicle_raptor_shield_regen;
float autocvar_g_vehicle_raptor_shield_regen_pause;
+float autocvar_g_vehicle_raptor_bouncefactor;
+float autocvar_g_vehicle_raptor_bouncestop;
+vector autocvar_g_vehicle_raptor_bouncepain;
+
void raptor_spawn();
float raptor_frame();
float raptor_takeoff();
float raptor_altitude(float amax)
{
- tracebox(self.origin, self.mins, self.maxs, self.origin - ('0 0 1' * amax), TRUE, self);
+ tracebox(self.origin, self.mins, self.maxs, self.origin - ('0 0 1' * amax), MOVE_WORLDONLY, self);
return vlen(self.origin - trace_endpos);
}
}
void raptor_land()
-{
-
+{
float hgt;
-
- hgt = raptor_altitude(512);
+
+ hgt = raptor_altitude(512);
self.velocity = (self.velocity * 0.9) + ('0 0 -1800' * (hgt / 256) * sys_frametime);
self.angles_x *= 0.95;
self.angles_z *= 0.95;
if(hgt < 128)
- if(self.frame != 0)
- self.frame = max(self.frame - 0.25, 0);
+ if(hgt > 0)
+ self.frame = (hgt / 128) * 25;
self.bomb1.gun1.avelocity_y = 90 + ((self.frame / 25) * 2000);
self.bomb1.gun2.avelocity_y = -self.bomb1.gun1.avelocity_y;
if(hgt < 16)
{
- self.movetype = MOVETYPE_TOSS;
- self.think = raptor_think;
+ self.movetype = MOVETYPE_TOSS;
+ self.think = raptor_think;
+ self.frame = 0;
}
self.nextthink = time;
self.touch = raptor_blowup;
}
+void raptor_worldimpact()
+{
+ if(self.play_time < time)
+ if(autocvar_g_vehicle_raptor_bouncepain_x)
+ vehilces_worldimpact(autocvar_g_vehicle_raptor_bouncepain_x, autocvar_g_vehicle_raptor_bouncepain_y, autocvar_g_vehicle_raptor_bouncepain_z);
+}
+
void raptor_spawn()
{
self.frame = 0;
setsize(self, RAPTOR_MIN, RAPTOR_MAX );
self.delay = time;
+
+ self.bouncefactor = autocvar_g_vehicle_raptor_bouncefactor;
+ self.bouncestop = autocvar_g_vehicle_raptor_bouncestop;
+ self.vehicle_worldimpact = raptor_worldimpact;
}
// If we dont do this ever now and then, the raptors rotors
float autocvar_g_vehicle_spiderbot_rocket_turnrate;
float autocvar_g_vehicle_spiderbot_rocket_lifetime;
+float autocvar_g_vehicle_spiderbot_bouncefactor;
+float autocvar_g_vehicle_spiderbot_bouncestop;
+vector autocvar_g_vehicle_spiderbot_bouncepain;
+
+
void spiderbot_exit(float eject);
void spiderbot_enter();
void spiderbot_spawn();
self.owner = world;
}
-
+void spider_worldimpact()
+{
+ if(self.play_time < time)
+ if(autocvar_g_vehicle_spiderbot_bouncepain_x)
+ vehilces_worldimpact(autocvar_g_vehicle_spiderbot_bouncepain_x, autocvar_g_vehicle_spiderbot_bouncepain_y, autocvar_g_vehicle_spiderbot_bouncepain_z);
+}
void spiderbot_spawn()
{
self.frame = 5;
setorigin(self, self.pos1 + '0 0 128');
self.angles = self.pos2;
+ self.vehicle_worldimpact = spider_worldimpact;
}
void spiderbot_headfade()
return FALSE;
}
+void vehilces_worldimpact(float _minspeed, float _speedfac, float _maxpain)
+{
+ if(self.play_time < time)
+ {
+ float wc, take;
+ wc = vlen(self.velocity - self.oldvelocity);
+ if(_minspeed < wc)
+ {
+ take = min(_speedfac * wc, _maxpain);
+ Damage (self, world, world, take, DEATH_FALL, self.origin, '0 0 0');
+ self.play_time = time + 0.25;
+
+ dprint("oldvel: ", vtos(self.oldvelocity), "\n");
+ dprint("vel: ", vtos(self.velocity), "\n");
+ dprint("wc: ", ftos(wc), "\n");
+ dprint("take: ", ftos(take), "\n");
+
+ }
+ }
+}
+
+.void() vehicle_worldimpact;
void vehicles_touch()
{
// Vehicle currently in use
// Colided with world?
if(other == world)
{
+ if(self.vehicle_worldimpact)
+ self.vehicle_worldimpact();
}
else
{
set g_vehicle_racer_blowup_edgedamage 15
set g_vehicle_racer_blowup_forceintensity 250
+set g_vehicle_racer_bouncefactor 0.25 // Factor of old velocity to keep after colission
+set g_vehicle_racer_bouncestop 0 // if != 0, New veloctiy after bounce = 0 if new velocity < this
+set g_vehicle_racer_bouncepain "35 2 250" // "minspeed_for_pain speedchange_to_pain_factor max_damage"
+
set g_vehicle_racer_mass 900
set g_vehicle_raptor_shield_regen 25
set g_vehicle_raptor_shield_regen_pause 1.5
+set g_vehicle_raptor_bouncefactor 0.2
+set g_vehicle_raptor_bouncestop 0
+set g_vehicle_raptor_bouncepain "1 1.5 500"
+
set g_vehicle_raptor_mass 2200
set g_vehicle_spiderbot_mass 5000
+set g_vehicle_spiderbot_bouncefactor 0 // Factor of old velocity to keep after colission
+set g_vehicle_spiderbot_bouncestop 0 // if != 0, New veloctiy after bounce = 0 if new velocity < this
+set g_vehicle_spiderbot_bouncepain "0 0 0" // "minspeed_for_pain speedchange_to_pain_factor max_damage"
set cl_vehicle_spiderbot_cross_alpha 0.4
set cl_vehicle_spiderbot_cross_size 1