X-Git-Url: http://de.git.xonotic.org/?a=blobdiff_plain;f=qcsrc%2Fcommon%2Fturrets%2Fturret%2Fwalker.qc;h=cdabf3391bab6167e572bd7e8050a251117da7a1;hb=refs%2Fmerge-requests%2F636%2Fhead;hp=415d5dfeef16fd315cd5c08d7dc269be2c199bd9;hpb=e57fd111a3279a4aa4789e2c72f9c819a56c7be9;p=xonotic%2Fxonotic-data.pk3dir.git diff --git a/qcsrc/common/turrets/turret/walker.qc b/qcsrc/common/turrets/turret/walker.qc index 415d5dfee..cdabf3391 100644 --- a/qcsrc/common/turrets/turret/walker.qc +++ b/qcsrc/common/turrets/turret/walker.qc @@ -62,7 +62,7 @@ void walker_melee_do_dmg(entity this) { if (turret_validate_target(this, e, this.target_validate_flags)) if (e != this && e.owner != this) - Damage(e, this, this, (autocvar_g_turrets_unit_walker_melee_damage), DEATH_TURRET_WALK_MELEE.m_id, '0 0 0', v_forward * (autocvar_g_turrets_unit_walker_melee_force)); + Damage(e, this, this, (autocvar_g_turrets_unit_walker_melee_damage), DEATH_TURRET_WALK_MELEE.m_id, DMG_NOWEP, '0 0 0', v_forward * (autocvar_g_turrets_unit_walker_melee_force)); e = e.chain; } @@ -75,7 +75,7 @@ void walker_setnoanim(entity this) } 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, NULL, (autocvar_g_turrets_unit_walker_rocket_force), DEATH_TURRET_WALK_ROCKET.m_id, NULL); + 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, DMG_NOWEP, NULL); delete(this); } @@ -84,12 +84,12 @@ 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) +void walker_rocket_damage(entity this, entity inflictor, entity attacker, float damage, float deathtype, .entity weaponentity, vector hitloc, vector vforce) { - this.health = this.health - damage; + TakeResource(this, RESOURCE_HEALTH, damage); this.velocity = this.velocity + vforce; - if (this.health <= 0) + if (GetResourceAmount(this, RESOURCE_HEALTH) <= 0) W_PrepareExplosionByDamage(this, this.owner, walker_rocket_explode); } @@ -218,7 +218,7 @@ void walker_fire_rocket(entity this, vector org) rocket.bot_dodgerating = 50; rocket.takedamage = DAMAGE_YES; rocket.damageforcescale = 2; - rocket.health = 25; + SetResourceAmount(rocket, RESOURCE_HEALTH, 25); rocket.tur_shotorg = randomvec() * 512; rocket.cnt = time + 1; rocket.enemy = this.enemy; @@ -281,7 +281,8 @@ void walker_move_path(entity this) { #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(turret_closetotarget(this, this.pathcurrent.origin)) + { if (this.pathcurrent.path_next == NULL) { // Path endpoint reached @@ -304,13 +305,14 @@ void walker_move_path(entity this) } else this.pathcurrent = this.pathcurrent.path_next; + } this.moveto = this.pathcurrent.origin; this.steerto = steerlib_attract2(this, this.moveto,0.5,500,0.95); walker_move_to(this, this.moveto, 0); #else - if(vdist(this.origin - this.pathcurrent.origin, <, 64)) + if(turret_closetotarget(this, this.pathcurrent.origin)) this.pathcurrent = this.pathcurrent.enemy; if(!this.pathcurrent) @@ -352,7 +354,7 @@ METHOD(WalkerTurret, tr_think, void(WalkerTurret thistur, entity it)) { fixedmakevectors(it.angles); - if (it.spawnflags & TSF_NO_PATHBREAK && it.pathcurrent) + if ((it.spawnflags & TSF_NO_PATHBREAK) && it.pathcurrent) walker_move_path(it); else if (it.enemy == NULL) { @@ -627,17 +629,17 @@ void walker_draw(entity this) setorigin(this, this.origin + this.velocity * dt); this.tur_head.angles += dt * this.tur_head.avelocity; - if (this.health < 127) + if(GetResourceAmount(this, RESOURCE_HEALTH) < 127) if(random() < 0.15) te_spark(this.origin + '0 0 40', randomvec() * 256 + '0 0 256', 16); } - METHOD(WalkerTurret, tr_setup, void(WalkerTurret this, entity it)) - { - it.gravity = 1; - set_movetype(it, MOVETYPE_BOUNCE); - it.move_time = time; - it.draw = walker_draw; - } +METHOD(WalkerTurret, tr_setup, void(WalkerTurret this, entity it)) +{ + it.gravity = 1; + set_movetype(it, MOVETYPE_BOUNCE); + it.move_time = time; + it.draw = walker_draw; +} #endif // CSQC