X-Git-Url: http://git.xonotic.org/?p=xonotic%2Fxonotic-data.pk3dir.git;a=blobdiff_plain;f=qcsrc%2Fserver%2Fg_triggers.qc;h=65846f5e38ba332e8f6e226c8f29831f18474260;hp=af7c105617769463262f0759e1b392a2463e8abe;hb=30e9db455abe691a3560555a989beb382b3b2531;hpb=55d3273e61152efe4244561d71c313512c20c20d diff --git a/qcsrc/server/g_triggers.qc b/qcsrc/server/g_triggers.qc index af7c10561..65846f5e3 100644 --- a/qcsrc/server/g_triggers.qc +++ b/qcsrc/server/g_triggers.qc @@ -61,12 +61,12 @@ void SUB_UseTargets() // // print the message // - if (activator.classname == "player" && self.message != "") + if (IS_PLAYER(activator) && self.message != "") { - if(clienttype(activator) == CLIENTTYPE_REAL) + if(IS_REAL_CLIENT(activator)) { centerprint (activator, self.message); - if (!self.noise) + if (self.noise == "") play2(activator, "misc/talk.wav"); } } @@ -164,7 +164,7 @@ void multi_trigger() if (self.classname == "trigger_secret") { - if (self.enemy.classname != "player") + if not(IS_PLAYER(self.enemy)) return; found_secrets = found_secrets + 1; WriteByte (MSG_ALL, SVC_FOUNDSECRET); @@ -192,7 +192,7 @@ void multi_trigger() else { // we can't just remove (self) here, because this is a touch function // called wheil C code is looping through area links... - self.touch = SUB_Null; + self.touch = func_null; } } @@ -254,7 +254,8 @@ void multi_reset() self.takedamage = DAMAGE_YES; self.solid = SOLID_BBOX; } - self.think = SUB_Null; + self.think = func_null; + self.nextthink = 0; self.team = self.team_saved; } @@ -359,7 +360,8 @@ void delay_use() void delay_reset() { - self.think = SUB_Null; + self.think = func_null; + self.nextthink = 0; } void spawnfunc_trigger_delay() @@ -382,7 +384,7 @@ void counter_use() if (self.count != 0) { - if (activator.classname == "player" + if (IS_PLAYER(activator) && (self.spawnflags & SPAWNFLAG_NOMESSAGE) == 0) { if (self.count >= 4) @@ -397,7 +399,7 @@ void counter_use() return; } - if (activator.classname == "player" + if (IS_PLAYER(activator) && (self.spawnflags & SPAWNFLAG_NOMESSAGE) == 0) centerprint(activator, "Sequence completed!"); self.enemy = activator; @@ -430,7 +432,7 @@ void spawnfunc_trigger_counter() void trigger_hurt_use() { - if(activator.classname == "player") + if(IS_PLAYER(activator)) self.enemy = activator; else self.enemy = world; // let's just destroy it, if taking over is too much work @@ -457,7 +459,7 @@ void trigger_hurt_touch() entity own; own = self.enemy; - if(own.classname != "player") + if not(IS_PLAYER(own)) { own = self; self.enemy = world; // I still hate you all @@ -466,20 +468,12 @@ void trigger_hurt_touch() Damage (other, self, own, self.dmg, DEATH_HURTTRIGGER, other.origin, '0 0 0'); } } - else + else if(other.damagedbytriggers) { - if (!other.owner) + if(other.takedamage) { - if (other.items & IT_KEY1 || other.items & IT_KEY2) // reset flag - { - EXACTTRIGGER_TOUCH; - other.pain_finished = min(other.pain_finished, time + 2); - } - else if (other.classname == "rune") // reset runes - { - EXACTTRIGGER_TOUCH; - other.nextthink = min(other.nextthink, time + 1); - } + EXACTTRIGGER_TOUCH; + Damage(other, self, self, self.dmg, DEATH_HURTTRIGGER, other.origin, '0 0 0'); } } @@ -503,9 +497,9 @@ void spawnfunc_trigger_hurt() self.enemy = world; // I hate you all if (!self.dmg) self.dmg = 1000; - if (!self.message) + if (self.message == "") self.message = "was in the wrong place"; - if (!self.message2) + if (self.message2 == "") self.message2 = "was thrown into a world of hurt by"; // self.message = "someone like %s always gets wrongplaced"; @@ -545,6 +539,7 @@ void trigger_heal_touch() if (other.iscreature) { if (other.takedamage) + if (!other.deadflag) if (other.triggerhealtime < time) { EXACTTRIGGER_TOUCH; @@ -696,7 +691,7 @@ void spawnfunc_trigger_gravity() void target_speaker_use_off(); void target_speaker_use_activator() { - if(clienttype(activator) != CLIENTTYPE_REAL) + if not(IS_REAL_CLIENT(activator)) return; string snd; if(substring(self.noise, 0, 1) == "*") @@ -1333,9 +1328,9 @@ void spawnfunc_misc_laser() if(self.colormod == '0 0 0') if(!self.alpha) self.colormod = '1 0 0'; - if(!self.message) + if(self.message == "") self.message = "saw the light"; - if (!self.message2) + if (self.message2 == "") self.message2 = "was pushed into a laser by"; if(!self.scale) self.scale = 1; @@ -1771,7 +1766,7 @@ void target_voicescript_next(entity pl) return; if(vs.message == "") return; - if(pl.classname != "player") + if not(IS_PLAYER(pl)) return; if(gameover) return; @@ -1920,7 +1915,7 @@ string trigger_magicear_processmessage(entity ear, entity source, float teamsay, magicear_matched = FALSE; - dotrigger = ((source.classname == "player") && (source.deadflag == DEAD_NO) && ((ear.radius == 0) || (vlen(source.origin - ear.origin) <= ear.radius))); + dotrigger = ((IS_PLAYER(source)) && (source.deadflag == DEAD_NO) && ((ear.radius == 0) || (vlen(source.origin - ear.origin) <= ear.radius))); domatch = ((ear.spawnflags & 32) || dotrigger); if not(domatch)