mirror of
https://gitlab.com/OpenMW/openmw.git
synced 2025-02-21 09:39:56 +00:00
Lua: Creature skill bindings
This commit is contained in:
parent
6ead5f9321
commit
1f416d7c8a
@ -1,3 +1,4 @@
|
||||
#include "../stats.hpp"
|
||||
#include "actor.hpp"
|
||||
#include "types.hpp"
|
||||
|
||||
@ -42,6 +43,20 @@ namespace MWLua
|
||||
record["soulValue"] = sol::readonly_property([](const ESM::Creature& rec) -> int { return rec.mData.mSoul; });
|
||||
record["type"] = sol::readonly_property([](const ESM::Creature& rec) -> int { return rec.mData.mType; });
|
||||
record["baseGold"] = sol::readonly_property([](const ESM::Creature& rec) -> int { return rec.mData.mGold; });
|
||||
record["combatSkill"]
|
||||
= sol::readonly_property([](const ESM::Creature& rec) -> int { return rec.mData.mCombat; });
|
||||
record["magicSkill"] = sol::readonly_property([](const ESM::Creature& rec) -> int { return rec.mData.mMagic; });
|
||||
record["stealthSkill"]
|
||||
= sol::readonly_property([](const ESM::Creature& rec) -> int { return rec.mData.mStealth; });
|
||||
record["attack"] = sol::readonly_property([context](const ESM::Creature& rec) -> sol::table {
|
||||
sol::state_view& lua = context.mLua->sol();
|
||||
sol::table res(lua, sol::create);
|
||||
int index = 1;
|
||||
for (auto attack : rec.mData.mAttack)
|
||||
res[index++] = attack;
|
||||
return LuaUtil::makeReadOnly(res);
|
||||
});
|
||||
|
||||
addActorServicesBindings<ESM::Creature>(record, context);
|
||||
}
|
||||
}
|
||||
|
@ -717,6 +717,11 @@
|
||||
-- @param #any objectOrRecordId
|
||||
-- @return #CreatureRecord
|
||||
|
||||
---
|
||||
-- @type CreatureAttack
|
||||
-- @field #number minDamage Minimum attack damage.
|
||||
-- @field #number maxDamage Maximum attack damage.
|
||||
|
||||
---
|
||||
-- @type CreatureRecord
|
||||
-- @field #string id The record ID of the creature
|
||||
@ -727,6 +732,10 @@
|
||||
-- @field #number soulValue The soul value of the creature record
|
||||
-- @field #number type The @{#Creature.TYPE} of the creature
|
||||
-- @field #number baseGold The base barter gold of the creature
|
||||
-- @field #number combatSkill The base combat skill of the creature. This is the skill value used for all skills with a 'combat' specialization
|
||||
-- @field #number magicSkill The base magic skill of the creature. This is the skill value used for all skills with a 'magic' specialization
|
||||
-- @field #number stealthSkill The base stealth skill of the creature. This is the skill value used for all skills with a 'stealth' specialization
|
||||
-- @field #list<#number> attack A table of the 3 randomly selected attacks used by creatures that do not carry weapons. The table consists of 6 numbers split into groups of 2 values corresponding to minimum and maximum damage in that order.
|
||||
-- @field #map<#string, #boolean> servicesOffered The services of the creature, in a table. Value is if the service is provided or not, and they are indexed by: Spells, Spellmaking, Enchanting, Training, Repair, Barter, Weapon, Armor, Clothing, Books, Ingredients, Picks, Probes, Lights, Apparatus, RepairItems, Misc, Potions, MagicItems, Travel.
|
||||
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user