mirror of
https://gitlab.com/OpenMW/openmw.git
synced 2025-04-11 00:44:33 +00:00
Add isTeleportingEnabled and setTeleportingEnabled
This commit is contained in:
parent
c058b30322
commit
f4d349070c
@ -138,6 +138,19 @@ namespace MWLua
|
|||||||
throw std::runtime_error("The argument must be a player.");
|
throw std::runtime_error("The argument must be a player.");
|
||||||
return input->getControlSwitch(key);
|
return input->getControlSwitch(key);
|
||||||
};
|
};
|
||||||
|
player["isTeleportingEnabled"] = [](const Object& player) -> bool {
|
||||||
|
if (player.ptr() != MWBase::Environment::get().getWorld()->getPlayerPtr())
|
||||||
|
throw std::runtime_error("The argument must be a player.");
|
||||||
|
return MWBase::Environment::get().getWorld()->isTeleportingEnabled();
|
||||||
|
};
|
||||||
|
player["setTeleportingEnabled"] = [context](const Object& player, bool state) {
|
||||||
|
if (player.ptr() != MWBase::Environment::get().getWorld()->getPlayerPtr())
|
||||||
|
throw std::runtime_error("The argument must be a player.");
|
||||||
|
if (dynamic_cast<const LObject*>(&player) && !dynamic_cast<const SelfObject*>(&player))
|
||||||
|
throw std::runtime_error("Only player and global scripts can toggle teleportation.");
|
||||||
|
context.mLuaManager->addAction([state] { MWBase::Environment::get().getWorld()->enableTeleporting(state); },
|
||||||
|
"toggleTeleportingAction");
|
||||||
|
};
|
||||||
player["setControlSwitch"] = [input](const Object& player, std::string_view key, bool v) {
|
player["setControlSwitch"] = [input](const Object& player, std::string_view key, bool v) {
|
||||||
if (player.ptr() != MWBase::Environment::get().getWorld()->getPlayerPtr())
|
if (player.ptr() != MWBase::Environment::get().getWorld()->getPlayerPtr())
|
||||||
throw std::runtime_error("The argument must be a player.");
|
throw std::runtime_error("The argument must be a player.");
|
||||||
|
@ -919,13 +919,26 @@
|
|||||||
-- @function [parent=#Player] getCrimeLevel
|
-- @function [parent=#Player] getCrimeLevel
|
||||||
-- @param openmw.core#GameObject player
|
-- @param openmw.core#GameObject player
|
||||||
-- @return #number
|
-- @return #number
|
||||||
|
|
||||||
---
|
---
|
||||||
-- Whether the character generation for this player is finished.
|
-- Whether the character generation for this player is finished.
|
||||||
-- @function [parent=#Player] isCharGenFinished
|
-- @function [parent=#Player] isCharGenFinished
|
||||||
-- @param openmw.core#GameObject player
|
-- @param openmw.core#GameObject player
|
||||||
-- @return #boolean
|
-- @return #boolean
|
||||||
|
|
||||||
|
---
|
||||||
|
-- Whether teleportation for this player is enabled.
|
||||||
|
-- @function [parent=#Player] isTeleportingEnabled
|
||||||
|
-- @param openmw.core#GameObject player
|
||||||
|
-- @param #boolean player
|
||||||
|
-- @return #boolean
|
||||||
|
|
||||||
|
---
|
||||||
|
-- Enables or disables teleportation for this player.
|
||||||
|
-- @function [parent=#Player] setTeleportingEnabled
|
||||||
|
-- @param openmw.core#GameObject player
|
||||||
|
-- @param #boolean state True to enable teleporting, false to disable.
|
||||||
|
|
||||||
---
|
---
|
||||||
-- Returns a list containing quests @{#PlayerQuest} for the specified player, indexed by quest ID.
|
-- Returns a list containing quests @{#PlayerQuest} for the specified player, indexed by quest ID.
|
||||||
-- @function [parent=#Player] quests
|
-- @function [parent=#Player] quests
|
||||||
|
Loading…
x
Reference in New Issue
Block a user