From 3d202883c9eb7b54b6d0c2114845dce16aaa9c1a Mon Sep 17 00:00:00 2001 From: Ryozuki Date: Fri, 26 Oct 2018 17:05:21 +0200 Subject: [PATCH] tele-activator: make delay be able to specify a weapon --- src/game/server/entities/laser.cpp | 9 +++++++++ src/game/server/entities/projectile.cpp | 13 +++++++++++++ 2 files changed, 22 insertions(+) diff --git a/src/game/server/entities/laser.cpp b/src/game/server/entities/laser.cpp index 90d42ca70..4b1c2d853 100644 --- a/src/game/server/entities/laser.cpp +++ b/src/game/server/entities/laser.cpp @@ -200,6 +200,15 @@ void CLaser::DoBounce() int TileFIndex = GameServer()->Collision()->GetFTileIndex(MapIndex); bool IsSwitchTeleGun = GameServer()->Collision()->IsSwitch(MapIndex) == TILE_ALLOW_TELE_GUN; + if(IsSwitchTeleGun) { + // Delay specifies which weapon the tile should work for. + // Delay = 0 means all. + int delay = GameServer()->Collision()->GetSwitchDelay(MapIndex); + + if((delay != 3 && delay != 0) && m_Type == WEAPON_RIFLE) + IsSwitchTeleGun = false; + } + // Teleport is canceled if the last bounce tile is not a TILE_ALLOW_TELE_GUN. // Teleport also works if laser didn't bounce. m_TeleportCancelled = diff --git a/src/game/server/entities/projectile.cpp b/src/game/server/entities/projectile.cpp index a8a00bfa0..89dca2096 100644 --- a/src/game/server/entities/projectile.cpp +++ b/src/game/server/entities/projectile.cpp @@ -179,6 +179,19 @@ void CProjectile::Tick() int TileFIndex = GameServer()->Collision()->GetFTileIndex(MapIndex); bool IsSwitchTeleGun = GameServer()->Collision()->IsSwitch(MapIndex) == TILE_ALLOW_TELE_GUN; + if(IsSwitchTeleGun) { + // Delay specifies which weapon the tile should work for. + // Delay = 0 means all. + int delay = GameServer()->Collision()->GetSwitchDelay(MapIndex); + + if(delay == 1 && m_Type != WEAPON_GUN) + IsSwitchTeleGun = false; + if(delay == 2 && m_Type != WEAPON_GRENADE) + IsSwitchTeleGun = false; + if(delay == 3 && m_Type != WEAPON_RIFLE) + IsSwitchTeleGun = false; + } + if (TileIndex == TILE_ALLOW_TELE_GUN || TileFIndex == TILE_ALLOW_TELE_GUN || IsSwitchTeleGun