X-Git-Url: https://de.git.xonotic.org/?a=blobdiff_plain;f=qcsrc%2Fcommon%2Fturrets%2Fturret%2Fewheel.qc;h=90463697dbf9835e394f36ff343694216f8a852f;hb=5d929ee0b1dc587e3154a4fa4b56e83b9ba9100b;hp=cf53508b6f63adca3314782182b8739c9bba5b17;hpb=c879eb771ea22f97a56cc1c1aaf5487c40cf9e3d;p=xonotic%2Fxonotic-data.pk3dir.git diff --git a/qcsrc/common/turrets/turret/ewheel.qc b/qcsrc/common/turrets/turret/ewheel.qc index cf53508b6..90463697d 100644 --- a/qcsrc/common/turrets/turret/ewheel.qc +++ b/qcsrc/common/turrets/turret/ewheel.qc @@ -1,7 +1,5 @@ #include "ewheel.qh" -#ifdef IMPLEMENTATION - #ifdef SVQC float autocvar_g_turrets_unit_ewheel_speed_fast; @@ -19,7 +17,7 @@ const int ewheel_anim_bck_fast = 4; void ewheel_move_path(entity this) { // Are we close enough to a path node to switch to the next? - if(vdist(this.origin - this.pathcurrent.origin, <, 64)) + if(turret_closetotarget(this, this.pathcurrent.origin)) { #ifdef EWHEEL_FANCYPATH if (this.pathcurrent.path_next == NULL) @@ -51,7 +49,6 @@ void ewheel_move_path(entity this) if (this.pathcurrent) { - this.moveto = this.pathcurrent.origin; this.steerto = steerlib_attract2(this, this.moveto, 0.5, 500, 0.95); @@ -140,10 +137,9 @@ spawnfunc(turret_ewheel) { if(!turret_initialize(this, TUR_EWHEEL)) delete(this) METHOD(EWheel, tr_think, void(EWheel thistur, entity it)) { - float vz; vector wish_angle, real_angle; - vz = it.velocity_z; + float vz = it.velocity_z; it.angles_x = anglemods(it.angles_x); it.angles_y = anglemods(it.angles_y); @@ -198,8 +194,9 @@ METHOD(EWheel, tr_setup, void(EWheel this, entity it)) it.iscreature = true; it.teleportable = TELEPORT_NORMAL; - it.damagedbycontents = true; - IL_PUSH(g_damagedbycontents, it); + if(!it.damagedbycontents) + IL_PUSH(g_damagedbycontents, it); + it.damagedbycontents = true; set_movetype(it, MOVETYPE_WALK); it.solid = SOLID_SLIDEBOX; it.takedamage = DAMAGE_AIM; @@ -231,18 +228,17 @@ void ewheel_draw(entity this) setorigin(this, this.origin + this.velocity * dt); this.tur_head.angles += dt * this.tur_head.avelocity; - if (this.health < 127) + if(GetResource(this, RES_HEALTH) < 127) if(random() < 0.05) te_spark(this.origin + '0 0 40', randomvec() * 256 + '0 0 256', 16); } - METHOD(EWheel, tr_setup, void(EWheel this, entity it)) - { - it.gravity = 1; - set_movetype(it, MOVETYPE_BOUNCE); - it.move_time = time; - it.draw = ewheel_draw; - } +METHOD(EWheel, tr_setup, void(EWheel this, entity it)) +{ + it.gravity = 1; + set_movetype(it, MOVETYPE_BOUNCE); + it.move_time = time; + it.draw = ewheel_draw; +} #endif // CSQC -#endif