X-Git-Url: https://git.xonotic.org/?a=blobdiff_plain;f=qcsrc%2Fcommon%2Fturrets%2Fturret%2Ffusionreactor.qc;h=bdac1f02930f174648b1ccd8d80dc9188d1cadd6;hb=df2fe9b28cb6210b671bec6d5ae834ff4eb2e2db;hp=1077d5c635bf7848dc34af3f2765aa0fda130877;hpb=267433aa7d5dd80399b808f692b8bc1ef75f0851;p=xonotic%2Fxonotic-data.pk3dir.git diff --git a/qcsrc/common/turrets/turret/fusionreactor.qc b/qcsrc/common/turrets/turret/fusionreactor.qc index 1077d5c63..bdac1f029 100644 --- a/qcsrc/common/turrets/turret/fusionreactor.qc +++ b/qcsrc/common/turrets/turret/fusionreactor.qc @@ -6,8 +6,8 @@ CLASS(FusionReactor, Turret) /* mins */ ATTRIB(FusionReactor, mins, vector, '-34 -34 0'); /* maxs */ ATTRIB(FusionReactor, maxs, vector, '34 34 90'); /* modelname */ ATTRIB(FusionReactor, mdl, string, "base.md3"); -/* model */ ATTRIB(FusionReactor, model, string, strzone(strcat("models/turrets/", this.mdl))); -/* head_model */ ATTRIB(FusionReactor, head_model, string, strzone(strcat("models/turrets/", "reactor.md3"))); +/* model */ ATTRIB_STRZONE(FusionReactor, model, string, strcat("models/turrets/", this.mdl)); +/* head_model */ ATTRIB_STRZONE(FusionReactor, head_model, string, strcat("models/turrets/", "reactor.md3")); /* netname */ ATTRIB(FusionReactor, netname, string, "fusionreactor"); /* fullname */ ATTRIB(FusionReactor, turret_name, string, _("Fusion Reactor")); ENDCLASS(FusionReactor) @@ -17,46 +17,46 @@ REGISTER_TURRET(FUSIONREACTOR, NEW(FusionReactor)); #ifdef IMPLEMENTATION #ifdef SVQC -bool turret_fusionreactor_firecheck() -{SELFPARAM(); - if (self.attack_finished_single > time) +bool turret_fusionreactor_firecheck(entity this) +{ + if (this.attack_finished_single[0] > time) return false; - if (self.enemy.deadflag != DEAD_NO) + if (IS_DEAD(this.enemy)) return false; - if (self.enemy == world) + if (this.enemy == world) return false; - if (self.ammo < self.shot_dmg) + if (this.ammo < this.shot_dmg) return false; - if (self.enemy.ammo >= self.enemy.ammo_max) + if (this.enemy.ammo >= this.enemy.ammo_max) return false; - if (vlen(self.enemy.origin - self.origin) > self.target_range) + if(vdist(this.enemy.origin - this.origin, >, this.target_range)) return false; - if(self.team != self.enemy.team) + if(this.team != this.enemy.team) return false; - if(!(self.enemy.ammo_flags & TFL_AMMO_ENERGY)) + if(!(this.enemy.ammo_flags & TFL_AMMO_ENERGY)) return false; return true; } -spawnfunc(turret_fusionreactor) { if (!turret_initialize(TUR_FUSIONREACTOR)) remove(self); } +spawnfunc(turret_fusionreactor) { if (!turret_initialize(this, TUR_FUSIONREACTOR)) remove(this); } -METHOD(FusionReactor, tr_attack, void(FusionReactor this)) +METHOD(FusionReactor, tr_attack, void(FusionReactor this, entity it)) { - self.enemy.ammo = min(self.enemy.ammo + self.shot_dmg,self.enemy.ammo_max); - vector fl_org = 0.5 * (self.enemy.absmin + self.enemy.absmax); + it.enemy.ammo = min(it.enemy.ammo + it.shot_dmg,it.enemy.ammo_max); + vector fl_org = 0.5 * (it.enemy.absmin + it.enemy.absmax); te_smallflash(fl_org); } -METHOD(FusionReactor, tr_think, void(FusionReactor thistur)) +METHOD(FusionReactor, tr_think, void(FusionReactor thistur, entity it)) { - self.tur_head.avelocity = '0 250 0' * (self.ammo / self.ammo_max); + it.tur_head.avelocity = '0 250 0' * (it.ammo / it.ammo_max); } METHOD(FusionReactor, tr_setup, void(FusionReactor this, entity it)) {