1
0
Fork 0
mirror of https://github.com/OpenMW/openmw.git synced 2025-12-25 05:23:12 +00:00

Add Lua API for werewolf state management

Adds a new function to force the player or NPCS to turn into a werewolf.
- setWerewolf(bool): Transform a PC or NPC into/out of werewolf form

This enables modders to control werewolf transformations

Useage Example:

-- Turn player into werewolf
types.NPC.setWerewolf(self, true)
This commit is contained in:
Nova 2025-10-05 01:49:18 -04:00 committed by Alexei Kotov
parent 0d4bff8ad6
commit 96ab0752db

View file

@ -246,6 +246,17 @@ namespace MWLua
throw std::runtime_error("NPC or Player expected");
};
npc["setWerewolf"] = [context](const Object& obj, bool werewolf) -> void {
const MWWorld::Ptr& ptr = obj.ptr();
if (!ptr.getClass().isNpc())
throw std::runtime_error("NPC or Player expected");
context.mLuaManager->addAction(
[obj = Object(ptr), werewolf] {
MWBase::Environment::get().getMechanicsManager()->setWerewolf(obj.ptr(), werewolf);
},
"setWerewolfAction");
};
npc["getDisposition"] = [](const Object& o, const Object& player) -> int {
const MWWorld::Class& cls = o.ptr().getClass();
verifyPlayer(player);