X-Git-Url: http://de.git.xonotic.org/?a=blobdiff_plain;f=qcsrc%2Fserver%2Fportals.qc;h=aff0652d4a569061d7fb39a43d654185f264b229;hb=57f409333cc09406298b66421d5e99357a7f586d;hp=76af253dca5c0f3bd3b5785134f9c378687fdf8c;hpb=616650bb18362024afeed71fed91d33dc1708d09;p=xonotic%2Fxonotic-data.pk3dir.git diff --git a/qcsrc/server/portals.qc b/qcsrc/server/portals.qc index 76af253dc..aff0652d4 100644 --- a/qcsrc/server/portals.qc +++ b/qcsrc/server/portals.qc @@ -89,7 +89,7 @@ float Portal_TeleportPlayer(entity teleporter, entity player) vector from, to, safe, step, transform, ang, newvel; float planeshift, s, t; - if not(teleporter.enemy) + if (!teleporter.enemy) { backtrace("Portal_TeleportPlayer called without other portal being set. Stop."); return 0; @@ -146,7 +146,7 @@ float Portal_TeleportPlayer(entity teleporter, entity player) //print(vtos(to), "\n"); // ang_x stuff works around weird quake angles - if(player.classname == "player") + if(IS_PLAYER(player)) ang = Portal_ApplyTransformToPlayerAngle(transform, player.v_angle); else ang = AnglesTransform_ApplyToAngles(transform, player.angles); @@ -154,10 +154,13 @@ float Portal_TeleportPlayer(entity teleporter, entity player) // factor -1 allows chaining portals, but may be weird player.right_vector = -1 * AnglesTransform_Apply(transform, player.right_vector); - if(player.flagcarried) - DropFlag(player.flagcarried, player, world); + entity oldself = self; + self = player; + MUTATOR_CALLHOOK(PortalTeleport); + player = self; + self = oldself; - if not(teleporter.enemy) + if (!teleporter.enemy) { backtrace("Portal_TeleportPlayer ended up without other portal being set BEFORE TeleportPlayer. Stop."); return 0; @@ -169,10 +172,10 @@ float Portal_TeleportPlayer(entity teleporter, entity player) { // telefrag within 1 second of portal creation = amazing if(time < teleporter.teleport_time + 1) - AnnounceTo(player, "amazing"); + Send_Notification(NOTIF_ONE, player, MSG_ANNCE, ANNCE_ACHIEVEMENT_AMAZING); } - if not(teleporter.enemy) + if (!teleporter.enemy) { backtrace("Portal_TeleportPlayer ended up without other portal being set AFTER TeleportPlayer. Stop."); return 0; @@ -241,7 +244,7 @@ void Portal_Touch() if(self.solid != SOLID_TRIGGER) return; // possibly engine bug - if(other.classname == "player") + if(IS_PLAYER(other)) return; // handled by think #endif @@ -274,11 +277,11 @@ void Portal_Touch() return; } if(other != self.aiment) - if(other.classname == "player") + if(IS_PLAYER(other)) if(IS_INDEPENDENT_PLAYER(other) || IS_INDEPENDENT_PLAYER(self.aiment)) return; // cannot go through someone else's portal if(other.aiment != self.aiment) - if(other.aiment.classname == "player") + if(IS_PLAYER(other.aiment)) if(IS_INDEPENDENT_PLAYER(other.aiment) || IS_INDEPENDENT_PLAYER(self.aiment)) return; // cannot go through someone else's portal fixedmakevectors(self.mangle); @@ -306,8 +309,8 @@ void Portal_MakeBrokenPortal(entity portal) { portal.skin = 2; portal.solid = SOLID_NOT; - portal.touch = SUB_Null; - portal.think = SUB_Null; + portal.touch = func_null; + portal.think = func_null; portal.effects = 0; portal.nextthink = 0; portal.takedamage = DAMAGE_NO; @@ -317,8 +320,8 @@ void Portal_MakeWaitingPortal(entity portal) { portal.skin = 2; portal.solid = SOLID_NOT; - portal.touch = SUB_Null; - portal.think = SUB_Null; + portal.touch = func_null; + portal.think = func_null; portal.effects = EF_ADDITIVE; portal.nextthink = 0; portal.takedamage = DAMAGE_YES; @@ -339,8 +342,8 @@ void Portal_MakeOutPortal(entity portal) { portal.skin = 1; portal.solid = SOLID_NOT; - portal.touch = SUB_Null; - portal.think = SUB_Null; + portal.touch = func_null; + portal.think = func_null; portal.effects = EF_STARDUST | EF_BLUE; portal.nextthink = 0; portal.takedamage = DAMAGE_YES; @@ -395,14 +398,14 @@ void Portal_Remove(entity portal, float killed) if(killed) { fixedmakevectors(portal.mangle); - sound(portal, CH_SHOTS, "porto/explode.wav", VOL_BASE, ATTN_NORM); + sound(portal, CH_SHOTS, "porto/explode.wav", VOL_BASE, ATTEN_NORM); pointparticles(particleeffectnum("rocket_explode"), portal.origin + v_forward * 16, v_forward * 1024, 4); remove(portal); } else { Portal_MakeBrokenPortal(portal); - sound(portal, CH_SHOTS, "porto/expire.wav", VOL_BASE, ATTN_NORM); + sound(portal, CH_SHOTS, "porto/expire.wav", VOL_BASE, ATTEN_NORM); SUB_SetFade(portal, time, 0.5); } } @@ -476,7 +479,7 @@ void Portal_Think() float Portal_Customize() { - if(other.classname == "spectator") + if(IS_SPEC(other)) other = other.enemy; if(other == self.aiment) {