X-Git-Url: https://de.git.xonotic.org/?a=blobdiff_plain;f=qcsrc%2Fserver%2Fg_triggers.qc;h=af7c105617769463262f0759e1b392a2463e8abe;hb=5f5505ba20abda2ac0d8eec592d6082846a49b19;hp=0ab2b423354013da80c2e56215aecd053eebfcca;hpb=fd2b1a8ba60990ceca63c494e1fc6094c3b7f6b2;p=xonotic%2Fxonotic-data.pk3dir.git diff --git a/qcsrc/server/g_triggers.qc b/qcsrc/server/g_triggers.qc index 0ab2b4233..af7c10561 100644 --- a/qcsrc/server/g_triggers.qc +++ b/qcsrc/server/g_triggers.qc @@ -1390,6 +1390,8 @@ void trigger_impulse_touch1() return; } + str = min(self.radius, vlen(self.origin - other.origin)); + if(self.falloff == 1) str = (str / self.radius) * self.strength; else if(self.falloff == 2) @@ -1908,19 +1910,54 @@ void spawnfunc_trigger_disablerelay() } 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) { float domatch, dotrigger, matchstart, l; string s, msg; entity oldself; + string savemessage; magicear_matched = FALSE; - dotrigger = ((self.classname == "player") && (self.deadflag == DEAD_NO) && ((ear.radius == 0) || (vlen(source.origin - ear.origin) <= ear.radius))); + dotrigger = ((source.classname == "player") && (source.deadflag == DEAD_NO) && ((ear.radius == 0) || (vlen(source.origin - ear.origin) <= ear.radius))); domatch = ((ear.spawnflags & 32) || dotrigger); + if not(domatch) return msgin; + if not(msgin) + { + // we are in TUBA mode! + if not(ear.spawnflags & 256) + return msgin; + + if(!W_Tuba_HasPlayed(source, ear.message, ear.movedir_x, !(ear.spawnflags & 512), ear.movedir_y, ear.movedir_z)) + return msgin; + + magicear_matched = TRUE; + + if(dotrigger) + { + oldself = self; + activator = source; + self = ear; + savemessage = self.message; + self.message = string_null; + SUB_UseTargets(); + self.message = savemessage; + self = oldself; + } + + if(ear.netname != "") + return ear.netname; + + return msgin; + } + + if(ear.spawnflags & 256) // ENOTUBA + return msgin; + if(privatesay) { if(ear.spawnflags & 4) @@ -1942,7 +1979,7 @@ string trigger_magicear_processmessage(entity ear, entity source, float teamsay, matchstart = -1; l = strlen(ear.message); - if(self.spawnflags & 128) + if(ear.spawnflags & 128) msg = msgin; else msg = strdecolorize(msgin); @@ -1993,9 +2030,13 @@ string trigger_magicear_processmessage(entity ear, entity source, float teamsay, if(dotrigger) { - oldself = activator = self; + oldself = self; + activator = source; self = ear; + savemessage = self.message; + self.message = string_null; SUB_UseTargets(); + self.message = savemessage; self = oldself; } @@ -2041,13 +2082,16 @@ void spawnfunc_trigger_magicear() // actually handled in "say" processing // spawnflags: - // 1 = ignore say - // 2 = ignore teamsay - // 4 = ignore tell - // 8 = ignore tell to unknown player + // 1 = ignore say + // 2 = ignore teamsay + // 4 = ignore tell + // 8 = ignore tell to unknown player // 16 = let netname replace the whole message (otherwise, netname is a word replacement if set) // 32 = perform the replacement even if outside the radius or dead // 64 = continue replacing/triggering even if this one matched + // 128 = don't decolorize message before matching + // 256 = message is a tuba note sequence (pitch.duration pitch.duration ...) + // 512 = tuba notes must be exact right pitch, no transposing // message: either // *pattern* // or @@ -2062,6 +2106,10 @@ void spawnfunc_trigger_magicear() // "hearing distance" // target: // what to trigger + // movedir: + // for spawnflags 256, defines 'instrument+1 mintempo maxtempo' (zero component doesn't matter) + + self.movedir_x -= 1; // map to tuba instrument numbers } void relay_activators_use()