From 61637c96608b65f19703a978ef7518cc6152c0d2 Mon Sep 17 00:00:00 2001 From: Mario Date: Sun, 29 Dec 2019 02:16:15 +1000 Subject: [PATCH] Give kill credit if a player falls into the void after passing through your portal --- qcsrc/server/player.qc | 2 +- qcsrc/server/portals.qc | 18 ++++++++++++------ 2 files changed, 13 insertions(+), 7 deletions(-) diff --git a/qcsrc/server/player.qc b/qcsrc/server/player.qc index 9e67050cb..9bf3f7c60 100644 --- a/qcsrc/server/player.qc +++ b/qcsrc/server/player.qc @@ -369,7 +369,7 @@ void PlayerDamage(entity this, entity inflictor, entity attacker, float damage, if(attacker == this) { - // don't reset pushltime for this damage as it may be an attempt to + // don't reset pushltime for self damage as it may be an attempt to // escape a lava pit or similar //this.pushltime = 0; this.istypefrag = 0; diff --git a/qcsrc/server/portals.qc b/qcsrc/server/portals.qc index 6f1287163..2f3940eee 100644 --- a/qcsrc/server/portals.qc +++ b/qcsrc/server/portals.qc @@ -103,7 +103,7 @@ vector Portal_ApplyTransformToPlayerAngle(vector transform, vector vangle) } .vector right_vector; -float Portal_TeleportPlayer(entity teleporter, entity player) +float Portal_TeleportPlayer(entity teleporter, entity player, entity portal_owner) { vector from, to, safe, step, transform, ang, newvel; float planeshift, s, t; @@ -189,6 +189,12 @@ float Portal_TeleportPlayer(entity teleporter, entity player) if(time < teleporter.teleport_time + 1) Send_Notification(NOTIF_ONE, player, MSG_ANNCE, ANNCE_ACHIEVEMENT_AMAZING); } + else if(player != portal_owner && IS_PLAYER(portal_owner) && IS_PLAYER(player)) + { + player.pusher = portal_owner; + player.pushltime = time + autocvar_g_maxpushtime; + player.istypefrag = PHYS_INPUT_BUTTON_CHAT(player); + } if (!teleporter.enemy) { @@ -317,7 +323,7 @@ void Portal_Touch(entity this, entity toucher) } */ - if(Portal_TeleportPlayer(this, toucher)) + if(Portal_TeleportPlayer(this, toucher, this.aiment)) if(toucher.classname == "porto") if(toucher.effects & EF_RED) toucher.effects += EF_BLUE - EF_RED; @@ -440,7 +446,7 @@ void Portal_Damage(entity this, entity inflictor, entity attacker, float damage, Portal_Remove(this, 1); } -void Portal_Think_TryTeleportPlayer(entity this, entity e, vector g) +void Portal_Think_TryTeleportPlayer(entity this, entity e, vector g, entity portal_owner) { if(!Portal_WillHitPlane(e.origin, e.mins, e.maxs, e.velocity + g, this.origin, v_forward, this.maxs.x)) return; @@ -449,7 +455,7 @@ void Portal_Think_TryTeleportPlayer(entity this, entity e, vector g) // already teleport him tracebox(e.origin, e.mins, e.maxs, e.origin + e.velocity * 2 * frametime, MOVE_NORMAL, e); if(trace_ent == this) - Portal_TeleportPlayer(this, e); + Portal_TeleportPlayer(this, e, portal_owner); } void Portal_Think(entity this) @@ -479,13 +485,13 @@ void Portal_Think(entity this) continue; // cannot go through someone else's portal if(it != o || time >= this.portal_activatetime) - Portal_Think_TryTeleportPlayer(this, it, g); + Portal_Think_TryTeleportPlayer(this, it, g, o); for(int slot = 0; slot < MAX_WEAPONSLOTS; ++slot) { .entity weaponentity = weaponentities[slot]; if(it.(weaponentity).hook) - Portal_Think_TryTeleportPlayer(this, it.(weaponentity).hook, g); + Portal_Think_TryTeleportPlayer(this, it.(weaponentity).hook, g, o); } }); this.solid = SOLID_TRIGGER; -- 2.39.2