Skip to content

Commit

Permalink
fix: teleport effect from "onUse" actions
Browse files Browse the repository at this point in the history
  • Loading branch information
dudantas committed Nov 13, 2024
1 parent 1382b77 commit 0cae46b
Show file tree
Hide file tree
Showing 5 changed files with 8 additions and 8 deletions.
2 changes: 1 addition & 1 deletion data-canary/scripts/actions/other/ladder_up.lua
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ function ladder.onUse(player, item, fromPosition, target, toPosition, isHotkey)
return true
end

player:teleportTo(fromPosition, false)
player:teleportTo(fromPosition, true)
return true
end

Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
local dwarvenLadder = Action()
function dwarvenLadder.onUse(player, item, fromPosition, itemEx, toPosition)
if player:getStorageValue(Storage.DwarvenLegs) < 1 then
player:teleportTo({ x = 32681, y = 31507, z = 10 })
player:teleportTo({ x = 32681, y = 31507, z = 10 }, true)
player:getPosition():sendMagicEffect(CONST_ME_TELEPORT)
return true
else
Expand Down
2 changes: 1 addition & 1 deletion src/creatures/combat/combat.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1089,7 +1089,7 @@ bool Combat::doCombatChain(const std::shared_ptr<Creature> &caster, const std::s
auto delay = i * std::max<int32_t>(50, g_configManager().getNumber(COMBAT_CHAIN_DELAY));
++i;
for (const auto &to : toVector) {
auto nextTarget = g_game().getCreatureByID(to);
const auto &nextTarget = g_game().getCreatureByID(to);
if (!nextTarget) {
continue;
}
Expand Down
8 changes: 4 additions & 4 deletions src/game/game.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1419,7 +1419,7 @@ void Game::playerMoveCreatureByID(uint32_t playerId, uint32_t movingCreatureId,
return;
}

std::shared_ptr<Creature> movingCreature = getCreatureByID(movingCreatureId);
const auto &movingCreature = getCreatureByID(movingCreatureId);
if (!movingCreature) {
return;
}
Expand Down Expand Up @@ -5451,7 +5451,7 @@ void Game::playerLookInBattleList(uint32_t playerId, uint32_t creatureId) {
return;
}

std::shared_ptr<Creature> creature = getCreatureByID(creatureId);
const auto &creature = getCreatureByID(creatureId);
if (!creature) {
return;
}
Expand Down Expand Up @@ -5863,7 +5863,7 @@ void Game::playerSetAttackedCreature(uint32_t playerId, uint32_t creatureId) {
return;
}

std::shared_ptr<Creature> attackCreature = getCreatureByID(creatureId);
const auto &attackCreature = getCreatureByID(creatureId);
if (!attackCreature) {
player->setAttackedCreature(nullptr);
player->sendCancelTarget();
Expand Down Expand Up @@ -9424,7 +9424,7 @@ void Game::parsePlayerExtendedOpcode(uint32_t playerId, uint8_t opcode, const st
}

void Game::forceRemoveCondition(uint32_t creatureId, ConditionType_t conditionType, ConditionId_t conditionId) {
std::shared_ptr<Creature> creature = getCreatureByID(creatureId);
const auto &creature = getCreatureByID(creatureId);
if (!creature) {
return;
}
Expand Down
2 changes: 1 addition & 1 deletion src/server/network/protocol/protocolgame.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1522,7 +1522,7 @@ void ProtocolGame::checkCreatureAsKnown(uint32_t id, bool &known, uint32_t &remo
continue;
}
// We need to protect party players from removing
std::shared_ptr<Creature> creature = g_game().getCreatureByID(*it);
const auto &creature = g_game().getCreatureByID(*it);
if (std::shared_ptr<Player> checkPlayer;
creature && (checkPlayer = creature->getPlayer()) != nullptr) {
if (player->getParty() != checkPlayer->getParty() && !canSee(creature)) {
Expand Down

0 comments on commit 0cae46b

Please sign in to comment.