X-Git-Url: http://de.git.xonotic.org/?a=blobdiff_plain;f=qcsrc%2Fcommon%2Ftriggers%2Ftrigger%2Fmagicear.qc;h=3287210409c8cd65b73cbd378e02920f5c7a70e4;hb=cf1edea8694548556934b5b05f526bc192f576cb;hp=f14b75c3124b983856400b620faf2af7dbc517ce;hpb=99c1b6ca80a69e112d410ee493d62f757b2c6df8;p=xonotic%2Fxonotic-data.pk3dir.git diff --git a/qcsrc/common/triggers/trigger/magicear.qc b/qcsrc/common/triggers/trigger/magicear.qc index f14b75c31..328721040 100644 --- a/qcsrc/common/triggers/trigger/magicear.qc +++ b/qcsrc/common/triggers/trigger/magicear.qc @@ -2,15 +2,14 @@ float magicear_matched; float W_Tuba_HasPlayed(entity pl, string melody, float instrument, float ignorepitch, float mintempo, float maxtempo); string trigger_magicear_processmessage(entity ear, entity source, float teamsay, entity privatesay, string msgin) -{ +{SELFPARAM(); float domatch, dotrigger, matchstart, l; string s, msg; - entity oldself; string savemessage; magicear_matched = false; - dotrigger = ((IS_PLAYER(source)) && (source.deadflag == DEAD_NO) && ((ear.radius == 0) || (vlen(source.origin - ear.origin) <= ear.radius))); + dotrigger = ((IS_PLAYER(source)) && (!IS_DEAD(source)) && ((ear.radius == 0) || (vdist(source.origin - ear.origin, <=, ear.radius)))); domatch = ((ear.spawnflags & 32) || dotrigger); if (!domatch) @@ -29,14 +28,10 @@ string trigger_magicear_processmessage(entity ear, entity source, float teamsay, if(dotrigger) { - oldself = self; - activator = source; - self = ear; savemessage = self.message; self.message = string_null; - SUB_UseTargets(); + SUB_UseTargets(ear, source, NULL); self.message = savemessage; - self = oldself; } if(ear.netname != "") @@ -120,14 +115,10 @@ string trigger_magicear_processmessage(entity ear, entity source, float teamsay, if(dotrigger) { - oldself = self; - activator = source; - self = ear; savemessage = self.message; self.message = string_null; - SUB_UseTargets(); + SUB_UseTargets(ear, source, NULL); self.message = savemessage; - self = oldself; } if(ear.spawnflags & 16) @@ -165,10 +156,10 @@ string trigger_magicear_processmessage_forallears(entity source, float teamsay, return msgin; } -void spawnfunc_trigger_magicear() +spawnfunc(trigger_magicear) { - self.enemy = magicears; - magicears = self; + this.enemy = magicears; + magicears = this; // actually handled in "say" processing // spawnflags: @@ -199,6 +190,6 @@ void spawnfunc_trigger_magicear() // movedir: // for spawnflags 256, defines 'instrument+1 mintempo maxtempo' (zero component doesn't matter) - self.movedir_x -= 1; // map to tuba instrument numbers + this.movedir_x -= 1; // map to tuba instrument numbers } #endif