X-Git-Url: http://de.git.xonotic.org/?a=blobdiff_plain;ds=sidebyside;f=qcsrc%2Fserver%2Fg_triggers.qc;h=884c3e5b2b83e4c2d3b2e151f6c80b97ff415fbe;hb=786db02b0c9aa618c581b7c3fe7392ad114797d8;hp=bf473fabbb57405c87f8e2b4b11a247da4dc51dd;hpb=c8f6e9084a329db9597364ee96006c7c427a82b6;p=xonotic%2Fxonotic-data.pk3dir.git diff --git a/qcsrc/server/g_triggers.qc b/qcsrc/server/g_triggers.qc index bf473fabb..884c3e5b2 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"); } } @@ -137,8 +137,8 @@ void SUB_UseTargets() //============================================================================= -float SPAWNFLAG_NOMESSAGE = 1; -float SPAWNFLAG_NOTOUCH = 1; +const float SPAWNFLAG_NOMESSAGE = 1; +const float SPAWNFLAG_NOTOUCH = 1; // the wait time has passed, so set back up for another activation void multi_wait() @@ -164,14 +164,14 @@ void multi_trigger() if (self.classname == "trigger_secret") { - if (self.enemy.classname != "player") + if (!IS_PLAYER(self.enemy)) return; found_secrets = found_secrets + 1; WriteByte (MSG_ALL, SVC_FOUNDSECRET); } if (self.noise) - sound (self.enemy, CH_TRIGGER, self.noise, VOL_BASE, ATTN_NORM); + sound (self.enemy, CH_TRIGGER, self.noise, VOL_BASE, ATTEN_NORM); // don't trigger again until reset self.takedamage = DAMAGE_NO; @@ -205,12 +205,12 @@ void multi_use() void multi_touch() { - if not(self.spawnflags & 2) - if not(other.iscreature) + if (!(self.spawnflags & 2)) + if (!other.iscreature) return; if(self.team) - if((self.spawnflags & 4 == 0) == (self.team != other.team)) + if(((self.spawnflags & 4) == 0) == (self.team != other.team)) return; // if the trigger has an angles field, check player's facing direction @@ -361,7 +361,7 @@ void delay_use() void delay_reset() { self.think = func_null; - self.nextthink = 0: + self.nextthink = 0; } void spawnfunc_trigger_delay() @@ -384,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) @@ -399,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; @@ -432,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 @@ -445,7 +445,7 @@ void trigger_hurt_touch() return; if(self.team) - if((self.spawnflags & 4 == 0) == (self.team != other.team)) + if(((self.spawnflags & 4) == 0) == (self.team != other.team)) return; // only do the EXACTTRIGGER_TOUCH checks when really needed (saves some cpu) @@ -459,7 +459,7 @@ void trigger_hurt_touch() entity own; own = self.enemy; - if(own.classname != "player") + if (!IS_PLAYER(own)) { own = self; self.enemy = world; // I still hate you all @@ -476,17 +476,6 @@ void trigger_hurt_touch() Damage(other, self, self, self.dmg, DEATH_HURTTRIGGER, other.origin, '0 0 0'); } } - else - { - if (!other.owner) - { - if (other.classname == "rune") // reset runes - { - EXACTTRIGGER_TOUCH; - other.nextthink = min(other.nextthink, time + 1); - } - } - } return; } @@ -508,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"; @@ -560,7 +549,7 @@ void trigger_heal_touch() { other.health = min(other.health + self.health, self.max_health); other.pauserothealth_finished = max(other.pauserothealth_finished, time + autocvar_g_balance_pause_health_rot); - sound (other, CH_TRIGGER, self.noise, VOL_BASE, ATTN_NORM); + sound (other, CH_TRIGGER, self.noise, VOL_BASE, ATTEN_NORM); } } } @@ -639,7 +628,7 @@ void trigger_gravity_touch() g = self.gravity; - if not(self.spawnflags & 1) + if (!(self.spawnflags & 1)) { if(other.trigger_gravity_check) { @@ -671,7 +660,7 @@ void trigger_gravity_touch() { other.gravity = g; if(self.noise != "") - sound (other, CH_TRIGGER, self.noise, VOL_BASE, ATTN_NORM); + sound (other, CH_TRIGGER, self.noise, VOL_BASE, ATTEN_NORM); UpdateCSQCProjectile(self.owner); } } @@ -702,7 +691,7 @@ void spawnfunc_trigger_gravity() void target_speaker_use_off(); void target_speaker_use_activator() { - if(clienttype(activator) != CLIENTTYPE_REAL) + if (!IS_REAL_CLIENT(activator)) return; string snd; if(substring(self.noise, 0, 1) == "*") @@ -786,9 +775,9 @@ void spawnfunc_target_speaker() if(!self.atten && !(self.spawnflags & 4)) { IFTARGETED - self.atten = ATTN_NORM; + self.atten = ATTEN_NORM; else - self.atten = ATTN_STATIC; + self.atten = ATTEN_STATIC; } else if(self.atten < 0) self.atten = 0; @@ -960,7 +949,7 @@ void spawnfunc_func_pointparticles() self.bgmscriptsustain = 0; if(!self.atten) - self.atten = ATTN_NORM; + self.atten = ATTEN_NORM; else if(self.atten < 0) self.atten = 0; if(!self.volume) @@ -1175,7 +1164,7 @@ void misc_laser_think() if(self.enemy) { o = self.enemy.origin; - if not(self.spawnflags & 2) + if (!(self.spawnflags & 2)) o = self.origin + normalize(o - self.origin) * 32768; } else @@ -1225,7 +1214,7 @@ void misc_laser_think() if(self.dmg) { if(self.team) - if((self.spawnflags & 8 == 0) == (self.team != hitent.team)) + if(((self.spawnflags & 8) == 0) == (self.team != hitent.team)) return; if(hitent.takedamage) Damage(hitent, self, self, ((self.dmg < 0) ? 100000 : (self.dmg * frametime)), DEATH_HURTTRIGGER, hitloc, '0 0 0'); @@ -1339,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; @@ -1411,7 +1400,7 @@ void trigger_impulse_touch1() if(!pushdeltatime) return; other.velocity = other.velocity + normalize(targ.origin - self.origin) * str * pushdeltatime; - other.flags &~= FL_ONGROUND; + other.flags &= ~FL_ONGROUND; UpdateCSQCProjectile(other); } @@ -1777,7 +1766,7 @@ void target_voicescript_next(entity pl) return; if(vs.message == "") return; - if(pl.classname != "player") + if (!IS_PLAYER(pl)) return; if(gameover) return; @@ -1926,16 +1915,16 @@ 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) + if (!domatch) return msgin; - if not(msgin) + if (!msgin) { // we are in TUBA mode! - if not(ear.spawnflags & 256) + if (!(ear.spawnflags & 256)) return msgin; if(!W_Tuba_HasPlayed(source, ear.message, ear.movedir_x, !(ear.spawnflags & 512), ear.movedir_y, ear.movedir_z)) @@ -2073,7 +2062,7 @@ string trigger_magicear_processmessage_forallears(entity source, float teamsay, for(ear = magicears; ear; ear = ear.enemy) { msgout = trigger_magicear_processmessage(ear, source, teamsay, privatesay, msgin); - if not(ear.spawnflags & 64) + if (!(ear.spawnflags & 64)) if(magicear_matched) return msgout; msgin = msgout;