X-Git-Url: http://de.git.xonotic.org/?p=xonotic%2Fxonotic-data.pk3dir.git;a=blobdiff_plain;f=qcsrc%2Fserver%2Fg_triggers.qc;h=f4fb67a1bad9a5d5cbdbadd6e4df7094e421fa0c;hp=65846f5e38ba332e8f6e226c8f29831f18474260;hb=a6a3b0cebd6928e3678ee4e97de4093f1b61c58b;hpb=8c8a22011714768f8c5b3ac887d0fd099fc08d8b diff --git a/qcsrc/server/g_triggers.qc b/qcsrc/server/g_triggers.qc index 65846f5e38..f4fb67a1ba 100644 --- a/qcsrc/server/g_triggers.qc +++ b/qcsrc/server/g_triggers.qc @@ -61,14 +61,12 @@ void SUB_UseTargets() // // print the message // - if (IS_PLAYER(activator) && self.message != "") + if(IS_PLAYER(activator) && self.message != "") + if(IS_REAL_CLIENT(activator)) { - if(IS_REAL_CLIENT(activator)) - { - centerprint (activator, self.message); - if (self.noise == "") - play2(activator, "misc/talk.wav"); - } + centerprint(activator, 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 not(IS_PLAYER(self.enemy)) + 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 +203,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 @@ -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 (IS_PLAYER(activator) - && (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 (IS_PLAYER(activator) - && (self.spawnflags & SPAWNFLAG_NOMESSAGE) == 0) - centerprint(activator, "Sequence completed!"); - self.enemy = activator; - multi_trigger (); } void counter_reset() @@ -441,11 +433,11 @@ void trigger_hurt_use() .float triggerhurttime; void trigger_hurt_touch() { - if (self.active != ACTIVE_ACTIVE) + if (self.active != ACTIVE_ACTIVE) 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 not(IS_PLAYER(own)) + if (!IS_PLAYER(own)) { own = self; self.enemy = world; // I still hate you all @@ -532,9 +524,9 @@ float tracebox_hits_trigger_hurt(vector start, vector mi, vector ma, vector end) .float triggerhealtime; void trigger_heal_touch() { - if (self.active != ACTIVE_ACTIVE) + if (self.active != ACTIVE_ACTIVE) return; - + // only do the EXACTTRIGGER_TOUCH checks when really needed (saves some cpu) if (other.iscreature) { @@ -544,12 +536,12 @@ void trigger_heal_touch() { EXACTTRIGGER_TOUCH; other.triggerhealtime = time + 1; - + if (other.health < self.max_health) { 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); } } } @@ -558,7 +550,7 @@ void trigger_heal_touch() void spawnfunc_trigger_heal() { self.active = ACTIVE_ACTIVE; - + EXACTTRIGGER_INIT; self.touch = trigger_heal_touch; if (!self.health) @@ -628,7 +620,7 @@ void trigger_gravity_touch() g = self.gravity; - if not(self.spawnflags & 1) + if (!(self.spawnflags & 1)) { if(other.trigger_gravity_check) { @@ -660,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); } } @@ -691,7 +683,7 @@ void spawnfunc_trigger_gravity() void target_speaker_use_off(); void target_speaker_use_activator() { - if not(IS_REAL_CLIENT(activator)) + if (!IS_REAL_CLIENT(activator)) return; string snd; if(substring(self.noise, 0, 1) == "*") @@ -775,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; @@ -942,14 +934,14 @@ void spawnfunc_func_pointparticles() setmodel(self, self.model); if(self.noise != "") precache_sound (self.noise); - + if(!self.bgmscriptsustain) self.bgmscriptsustain = 1; else if(self.bgmscriptsustain < 0) 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) @@ -1097,9 +1089,6 @@ void spawnfunc_func_snow() Net_LinkEntity(self, FALSE, 0, rainsnow_SendEntity); } - -void FireRailgunBullet (vector start, vector end, float bdamage, float bforce, float mindist, float maxdist, float halflifedist, float forcehalflifedist, float deathtype); - .float modelscale; void misc_laser_aim() { @@ -1164,7 +1153,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 @@ -1214,7 +1203,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'); @@ -1369,7 +1358,7 @@ void trigger_impulse_touch1() float pushdeltatime; float str; - if (self.active != ACTIVE_ACTIVE) + if (self.active != ACTIVE_ACTIVE) return; if (!isPushable(other)) @@ -1400,7 +1389,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); } @@ -1409,7 +1398,7 @@ void trigger_impulse_touch2() { float pushdeltatime; - if (self.active != ACTIVE_ACTIVE) + if (self.active != ACTIVE_ACTIVE) return; if (!isPushable(other)) @@ -1433,7 +1422,7 @@ void trigger_impulse_touch3() float pushdeltatime; float str; - if (self.active != ACTIVE_ACTIVE) + if (self.active != ACTIVE_ACTIVE) return; if (!isPushable(other)) @@ -1766,7 +1755,7 @@ void target_voicescript_next(entity pl) return; if(vs.message == "") return; - if not(IS_PLAYER(pl)) + if (!IS_PLAYER(pl)) return; if(gameover) return; @@ -1819,7 +1808,7 @@ void spawnfunc_target_voicescript() // added after this message // wait: average time between messages // delay: initial delay before the first message - + float i, n; self.use = target_voicescript_use; @@ -1918,13 +1907,13 @@ string trigger_magicear_processmessage(entity ear, entity source, float teamsay, 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)) @@ -1970,7 +1959,7 @@ string trigger_magicear_processmessage(entity ear, entity source, float teamsay, if(ear.spawnflags & 8) return msgin; } - + matchstart = -1; l = strlen(ear.message); @@ -2062,7 +2051,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; @@ -2110,9 +2099,9 @@ void spawnfunc_trigger_magicear() void relay_activators_use() { entity trg, os; - + os = self; - + for(trg = world; (trg = find(trg, targetname, os.target)); ) { self = trg; @@ -2124,11 +2113,11 @@ void relay_activators_use() if(os.cnt == ACTIVE_TOGGLE) if(trg.active == ACTIVE_ACTIVE) trg.active = ACTIVE_NOT; - else + else trg.active = ACTIVE_ACTIVE; else trg.active = os.cnt; - } + } } self = os; } @@ -2142,13 +2131,13 @@ void spawnfunc_relay_activate() void spawnfunc_relay_deactivate() { self.cnt = ACTIVE_NOT; - self.use = relay_activators_use; + self.use = relay_activators_use; } void spawnfunc_relay_activatetoggle() { self.cnt = ACTIVE_TOGGLE; - self.use = relay_activators_use; + self.use = relay_activators_use; } .string chmap, gametype;