-#ifndef TURRET_WALKER_H
-#define TURRET_WALKER_H
-
-//#define WALKER_FANCYPATHING
-
-#include "walker_weapon.qh"
-
-CLASS(WalkerTurret, Turret)
-/* spawnflags */ ATTRIB(WalkerTurret, spawnflags, int, TUR_FLAG_PLAYER | TUR_FLAG_MOVE);
-/* mins */ ATTRIB(WalkerTurret, mins, vector, '-70 -70 0');
-/* maxs */ ATTRIB(WalkerTurret, maxs, vector, '70 70 95');
-/* modelname */ ATTRIB(WalkerTurret, mdl, string, "walker_body.md3");
-/* model */ ATTRIB_STRZONE(WalkerTurret, model, string, strcat("models/turrets/", this.mdl));
-/* head_model */ ATTRIB_STRZONE(WalkerTurret, head_model, string, strcat("models/turrets/", "walker_head_minigun.md3"));
-/* netname */ ATTRIB(WalkerTurret, netname, string, "walker");
-/* fullname */ ATTRIB(WalkerTurret, turret_name, string, _("Walker Turret"));
- ATTRIB(WalkerTurret, m_weapon, Weapon, WEP_WALKER);
-ENDCLASS(WalkerTurret)
-REGISTER_TURRET(WALKER, NEW(WalkerTurret));
-
-#endif
+#include "walker.qh"
#ifdef IMPLEMENTATION
}
void walker_rocket_explode(entity this)
{
- RadiusDamage (this, this.owner, (autocvar_g_turrets_unit_walker_rocket_damage), 0, (autocvar_g_turrets_unit_walker_rocket_radius), this, world, (autocvar_g_turrets_unit_walker_rocket_force), DEATH_TURRET_WALK_ROCKET.m_id, world);
- remove (this);
+ RadiusDamage (this, this.owner, (autocvar_g_turrets_unit_walker_rocket_damage), 0, (autocvar_g_turrets_unit_walker_rocket_radius), this, NULL, (autocvar_g_turrets_unit_walker_rocket_force), DEATH_TURRET_WALK_ROCKET.m_id, NULL);
+ delete (this);
+}
+
+void walker_rocket_touch(entity this, entity toucher)
+{
+ walker_rocket_explode(this);
}
void walker_rocket_damage(entity this, entity inflictor, entity attacker, float damage, float deathtype, vector hitloc, vector vforce)
m_speed = vlen(this.velocity);
// Enemy dead? just keep on the current heading then.
- if (this.enemy == world || IS_DEAD(this.enemy))
- this.enemy = world;
+ if (this.enemy == NULL || IS_DEAD(this.enemy))
+ this.enemy = NULL;
if (this.enemy)
{
rocket.event_damage = walker_rocket_damage;
rocket.nextthink = time;
- rocket.movetype = MOVETYPE_FLY;
+ set_movetype(rocket, MOVETYPE_FLY);
rocket.velocity = normalize((v_forward + v_up * 0.5) + (randomvec() * 0.2)) * (autocvar_g_turrets_unit_walker_rocket_speed);
rocket.angles = vectoangles(rocket.velocity);
- settouch(rocket, walker_rocket_explode);
- rocket.flags = FL_PROJECTILE;
+ settouch(rocket, walker_rocket_touch);
+ rocket.flags = FL_PROJECTILE;
+ IL_PUSH(g_projectiles, rocket);
+ IL_PUSH(g_bot_dodge, rocket);
rocket.solid = SOLID_BBOX;
rocket.max_health = time + 9;
rocket.missile_flags = MIF_SPLASH | MIF_PROXY | MIF_GUIDED_HEAT;
#ifdef WALKER_FANCYPATHING
// Are we close enougth to a path node to switch to the next?
if(vdist(this.origin - this.pathcurrent.origin, <, 64))
- if (this.pathcurrent.path_next == world)
+ if (this.pathcurrent.path_next == NULL)
{
// Path endpoint reached
pathlib_deletepath(this.pathcurrent.owner);
- this.pathcurrent = world;
+ this.pathcurrent = NULL;
if (this.pathgoal)
{
}
}
else
- this.pathgoal = world;
+ this.pathgoal = NULL;
}
else
this.pathcurrent = this.pathcurrent.path_next;
#endif
}
-spawnfunc(turret_walker) { if(!turret_initialize(this, TUR_WALKER)) remove(this); }
+spawnfunc(turret_walker) { if(!turret_initialize(this, TUR_WALKER)) delete(this); }
METHOD(WalkerTurret, tr_think, void(WalkerTurret thistur, entity it))
{
if (it.spawnflags & TSF_NO_PATHBREAK && it.pathcurrent)
walker_move_path(it);
- else if (it.enemy == world)
+ else if (it.enemy == NULL)
{
if(it.pathcurrent)
walker_move_path(it);
entity e;
// Respawn is called & first spawn to, to set team. need to make sure we do not move the initial spawn.
- if(it.movetype == MOVETYPE_WALK)
+ if(it.move_movetype == MOVETYPE_WALK)
{
if(it.pos1)
setorigin(it, it.pos1);
it.damagedbycontents = true;
it.solid = SOLID_SLIDEBOX;
it.takedamage = DAMAGE_AIM;
- if(it.movetype != MOVETYPE_WALK)
+ if(it.move_movetype != MOVETYPE_WALK)
{
setorigin(it, it.origin);
tracebox(it.origin + '0 0 128', it.mins, it.maxs, it.origin - '0 0 10000', MOVE_NORMAL, it);
it.pos1 = it.origin;
it.pos2 = it.angles;
}
- it.movetype = MOVETYPE_WALK;
+ set_movetype(it, MOVETYPE_WALK);
it.idle_aim = '0 0 0';
it.turret_firecheckfunc = walker_firecheck;
if (it.target != "")
{
- e = find(world, targetname, it.target);
+ e = find(NULL, targetname, it.target);
if (!e)
{
- LOG_TRACE("Initital waypoint for walker does NOT exsist, fix your map!\n");
+ LOG_TRACE("Initital waypoint for walker does NOT exsist, fix your map!");
it.target = "";
}
if (e.classname != "turret_checkpoint")
- LOG_TRACE("Warning: not a turrret path\n");
+ LOG_TRACE("Warning: not a turrret path");
else
{
#ifdef WALKER_FANCYPATHING
fixedmakevectors(this.angles);
movelib_groundalign4point(this, 300, 100, 0.25, 45);
setorigin(this, this.origin + this.velocity * dt);
- this.tur_head.angles += dt * this.tur_head.move_avelocity;
- this.angles_y = this.move_angles_y;
+ this.tur_head.angles += dt * this.tur_head.avelocity;
if (this.health < 127)
if(random() < 0.15)
METHOD(WalkerTurret, tr_setup, void(WalkerTurret this, entity it))
{
it.gravity = 1;
- it.movetype = MOVETYPE_BOUNCE;
- it.move_movetype = MOVETYPE_BOUNCE;
- it.move_origin = it.origin;
+ set_movetype(it, MOVETYPE_BOUNCE);
it.move_time = time;
it.draw = walker_draw;
}