File tree Expand file tree Collapse file tree 3 files changed +27
-1
lines changed
Expand file tree Collapse file tree 3 files changed +27
-1
lines changed Original file line number Diff line number Diff line change @@ -82,7 +82,7 @@ message(STATUS "Configuring OpenMW...")
8282set (OPENMW_VERSION_MAJOR 0)
8383set (OPENMW_VERSION_MINOR 51)
8484set (OPENMW_VERSION_RELEASE 0)
85- set (OPENMW_LUA_API_REVISION 103 )
85+ set (OPENMW_LUA_API_REVISION 104 )
8686set (OPENMW_POSTPROCESSING_API_REVISION 3)
8787
8888set (OPENMW_VERSION_COMMITHASH "" )
Original file line number Diff line number Diff line change 1919
2020#include " ../classbindings.hpp"
2121#include " ../localscripts.hpp"
22+ #include " ../luamanagerimp.hpp"
2223#include " ../racebindings.hpp"
2324#include " ../stats.hpp"
2425
@@ -246,6 +247,20 @@ namespace MWLua
246247 throw std::runtime_error (" NPC or Player expected" );
247248 };
248249
250+ npc[" setWerewolf" ] = [context](const Object& obj, bool werewolf) -> void {
251+ if (dynamic_cast <const LObject*>(&obj) && !dynamic_cast <const SelfObject*>(&obj))
252+ throw std::runtime_error (" Local scripts can modify only self" );
253+
254+ const MWWorld::Ptr& ptr = obj.ptr ();
255+ if (!ptr.getClass ().isNpc ())
256+ throw std::runtime_error (" NPC or Player expected" );
257+ context.mLuaManager ->addAction (
258+ [obj = Object (ptr), werewolf] {
259+ MWBase::Environment::get ().getMechanicsManager ()->setWerewolf (obj.ptr (), werewolf);
260+ },
261+ " setWerewolfAction" );
262+ };
263+
249264 npc[" getDisposition" ] = [](const Object& o, const Object& player) -> int {
250265 const MWWorld::Class& cls = o.ptr ().getClass ();
251266 verifyPlayer (player);
Original file line number Diff line number Diff line change 10881088-- @param openmw.core#GameObject actor
10891089-- @return #boolean
10901090
1091+ ---
1092+ -- Turn an NPC or player into werewolf form or back to normal form.
1093+ -- Can only be used in global scripts or on self in local scripts.
1094+ -- @function [parent=#NPC] setWerewolf
1095+ -- @param openmw.core#GameObject actor The NPC or player to transform
1096+ -- @param #boolean werewolf True to transform into werewolf, false to transform back to normal
1097+ -- @usage -- Transform player into werewolf in a global script
1098+ -- player.type.setWerewolf(player, true)
1099+ -- @usage -- Transform self back to normal in a local script
1100+ -- self.type.setWerewolf(self, false)
1101+
10911102---
10921103-- Returns the read-only @{#NpcRecord} of an NPC
10931104-- @function [parent=#NPC] record
You can’t perform that action at this time.
0 commit comments