X-Git-Url: http://de.git.xonotic.org/?a=blobdiff_plain;f=qcsrc%2Fserver%2Fg_triggers.qc;h=725eb9b1ab5fc26b05baa4329696e20a2f693e3c;hb=67b0ed3729e3e9245067180fc2f672a7f51b65b8;hp=293c78f001f0f3a2df0c050d91102db2b53a4289;hpb=8a390ed02bde47c98a5e6bd47c7eb9b1cb3cd1dc;p=xonotic%2Fxonotic-data.pk3dir.git diff --git a/qcsrc/server/g_triggers.qc b/qcsrc/server/g_triggers.qc index 293c78f00..725eb9b1a 100644 --- a/qcsrc/server/g_triggers.qc +++ b/qcsrc/server/g_triggers.qc @@ -61,14 +61,12 @@ void SUB_UseTargets() // // print the message // - if (activator.classname == "player" && self.message != "") + if(IS_PLAYER(activator) && self.message != "") + if(IS_REAL_CLIENT(activator)) { - if(clienttype(activator) == CLIENTTYPE_REAL) - { - centerprint (activator, self.message); - if (self.noise == "") - play2(activator, "misc/talk.wav"); - } + Send_Notification(NOTIF_ONE, activator, MSG_CENTER, CENTER_TRIGGER, self.message); + if (self.noise == "") + play2(activator, "misc/talk.wav"); } // @@ -137,8 +135,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 +162,14 @@ 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); } 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; @@ -210,7 +208,7 @@ void multi_touch() 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 @@ -378,32 +376,26 @@ void spawnfunc_trigger_delay() void counter_use() { - self.count = self.count - 1; + self.count -= 1; if (self.count < 0) return; - if (self.count != 0) + if (self.count == 0) { - if (activator.classname == "player" - && (self.spawnflags & SPAWNFLAG_NOMESSAGE) == 0) - { - if (self.count >= 4) - centerprint (activator, "There are more to go..."); - else if (self.count == 3) - centerprint (activator, "Only 3 more to go..."); - else if (self.count == 2) - centerprint (activator, "Only 2 more to go..."); - else - centerprint (activator, "Only 1 more to go..."); - } - return; + if(IS_PLAYER(activator) && (self.spawnflags & SPAWNFLAG_NOMESSAGE) == 0) + Send_Notification(NOTIF_ONE, activator, MSG_CENTER, CENTER_SEQUENCE_COMPLETED); + + self.enemy = activator; + multi_trigger (); + } + else + { + if(IS_PLAYER(activator) && (self.spawnflags & SPAWNFLAG_NOMESSAGE) == 0) + if(self.count >= 4) + Send_Notification(NOTIF_ONE, activator, MSG_CENTER, CENTER_SEQUENCE_COUNTER); + else + Send_Notification(NOTIF_ONE, activator, MSG_CENTER, CENTER_SEQUENCE_COUNTER_FEWMORE, self.count); } - - if (activator.classname == "player" - && (self.spawnflags & SPAWNFLAG_NOMESSAGE) == 0) - centerprint(activator, "Sequence completed!"); - self.enemy = activator; - multi_trigger (); } void counter_reset() @@ -432,7 +424,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 +437,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 +451,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 @@ -476,17 +468,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; } @@ -560,7 +541,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); } } } @@ -671,7 +652,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 +683,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) == "*") @@ -786,9 +767,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 +941,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) @@ -1225,7 +1206,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'); @@ -1411,7 +1392,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 +1758,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; @@ -1926,7 +1907,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)