mirror of
https://gitlab.com/OpenMW/openmw.git
synced 2025-02-21 00:39:58 +00:00
Merge branch 'teleport_block' into 'master'
Lua: Add isTeleportingEnabled and setTeleportingEnabled to types.Player See merge request OpenMW/openmw!3519
This commit is contained in:
commit
f724b05c57
@ -138,6 +138,18 @@ namespace MWLua
|
||||
throw std::runtime_error("The argument must be a player.");
|
||||
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"] = [](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.");
|
||||
MWBase::Environment::get().getWorld()->enableTeleporting(state);
|
||||
};
|
||||
player["setControlSwitch"] = [input](const Object& player, std::string_view key, bool v) {
|
||||
if (player.ptr() != MWBase::Environment::get().getWorld()->getPlayerPtr())
|
||||
throw std::runtime_error("The argument must be a player.");
|
||||
|
@ -919,13 +919,26 @@
|
||||
-- @function [parent=#Player] getCrimeLevel
|
||||
-- @param openmw.core#GameObject player
|
||||
-- @return #number
|
||||
|
||||
|
||||
---
|
||||
-- Whether the character generation for this player is finished.
|
||||
-- @function [parent=#Player] isCharGenFinished
|
||||
-- @param openmw.core#GameObject player
|
||||
-- @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.
|
||||
-- @function [parent=#Player] quests
|
||||
|
Loading…
x
Reference in New Issue
Block a user