mirror of
https://github.com/OpenMW/openmw.git
synced 2025-11-29 07:34:30 +00:00
Enforced local scripts can only modify self.
Updated documentation to use self and player in examples.
This commit is contained in:
parent
5a76783616
commit
87dc3cd0e8
2 changed files with 5 additions and 2 deletions
|
|
@ -248,6 +248,9 @@ namespace MWLua
|
|||
};
|
||||
|
||||
npc["setWerewolf"] = [context](const Object& obj, bool werewolf) -> void {
|
||||
if (dynamic_cast<const LObject*>(&obj) && !dynamic_cast<const SelfObject*>(&obj))
|
||||
throw std::runtime_error("Local scripts can modify only self");
|
||||
|
||||
const MWWorld::Ptr& ptr = obj.ptr();
|
||||
if (!ptr.getClass().isNpc())
|
||||
throw std::runtime_error("NPC or Player expected");
|
||||
|
|
|
|||
|
|
@ -1095,9 +1095,9 @@
|
|||
-- @param openmw.core#GameObject actor The NPC or player to transform
|
||||
-- @param #boolean werewolf True to transform into werewolf, false to transform back to normal
|
||||
-- @usage -- Transform player into werewolf in a global script
|
||||
-- types.NPC.setWerewolf(player, true)
|
||||
-- player.type.setWerewolf(player, true)
|
||||
-- @usage -- Transform self back to normal in a local script
|
||||
-- types.NPC.setWerewolf(self, false)
|
||||
-- self.type.setWerewolf(self, false)
|
||||
|
||||
---
|
||||
-- Returns the read-only @{#NpcRecord} of an NPC
|
||||
|
|
|
|||
Loading…
Reference in a new issue