1
0
mirror of https://gitlab.com/OpenMW/openmw.git synced 2025-01-29 09:32:45 +00:00

Verify the player

This commit is contained in:
Zackhasacat 2024-04-06 18:17:51 -05:00
parent 5856bc8a0e
commit 4ca13a9404

View File

@ -187,6 +187,9 @@ namespace MWLua
return cls.getNpcStats(o.ptr()).getBounty();
};
player["setCrimeLevel"] = [](const Object& o, int amount) {
verifyPlayer(o);
if (!dynamic_cast<const GObject*>(&o))
throw std::runtime_error("Only global scripts can change crime level");
const MWWorld::Class& cls = o.ptr().getClass();
cls.getNpcStats(o.ptr()).setBounty(amount);
};