diff --git a/docs/source/reference/lua-scripting/openmw_core.rst b/docs/source/reference/lua-scripting/openmw_item.rst similarity index 65% rename from docs/source/reference/lua-scripting/openmw_core.rst rename to docs/source/reference/lua-scripting/openmw_item.rst index 2dc3f762b3..9c3ebaf8ef 100644 --- a/docs/source/reference/lua-scripting/openmw_core.rst +++ b/docs/source/reference/lua-scripting/openmw_item.rst @@ -4,4 +4,4 @@ Package openmw.core .. include:: version.rst .. raw:: html - :file: generated_html/openmw_core.html + :file: generated_html/openmw_item.html diff --git a/docs/source/reference/lua-scripting/tables/aux_packages.rst b/docs/source/reference/lua-scripting/tables/aux_packages.rst index af80f15243..32467ffd35 100644 --- a/docs/source/reference/lua-scripting/tables/aux_packages.rst +++ b/docs/source/reference/lua-scripting/tables/aux_packages.rst @@ -9,5 +9,5 @@ +---------------------------------------------------------+--------------------+---------------------------------------------------------------+ |:ref:`openmw_aux.ui ` | by player scripts | | User interface utils | +---------------------------------------------------------+--------------------+---------------------------------------------------------------+ -|:ref:`openmw_aux.core ` | everywhere | | GameObject Utils | +|:ref:`openmw_aux.item ` | everywhere | | Game Item utils | +---------------------------------------------------------+--------------------+---------------------------------------------------------------+ diff --git a/files/data/CMakeLists.txt b/files/data/CMakeLists.txt index 24c3fd003b..c97ccf893e 100644 --- a/files/data/CMakeLists.txt +++ b/files/data/CMakeLists.txt @@ -59,7 +59,7 @@ set(BUILTIN_DATA_FILES openmw_aux/time.lua openmw_aux/calendar.lua openmw_aux/calendarconfig.lua - openmw_aux/core.lua + openmw_aux/item.lua openmw_aux/ui.lua builtin.omwscripts diff --git a/files/data/openmw_aux/core.lua b/files/data/openmw_aux/item.lua similarity index 89% rename from files/data/openmw_aux/core.lua rename to files/data/openmw_aux/item.lua index 77d486a129..94d34ef014 100644 --- a/files/data/openmw_aux/core.lua +++ b/files/data/openmw_aux/item.lua @@ -5,17 +5,17 @@ local core = require('openmw.core') -- Implementation can be found in `resources/vfs/openmw_aux/core.lua`. -- @module core -- @usage local auxCore = require('openmw_aux.core') -local aux_core = {} +local aux_item = {} -local SKILL = types.NPC.stats.skills +local SKILL = core.stats.Skill.records -local armorSkillString = {[SKILL.heavyarmor] = "Heavy",[SKILL.mediumarmor] = "Medium", [SKILL.lightarmor] = "Light"} +local armorSkillString = {[SKILL.heavyarmor.id] = "Heavy",[SKILL.mediumarmor.id] = "Medium", [SKILL.lightarmor.id] = "Light"} --- -- Checks if the provided armor is Heavy, Medium, or Light. Errors if invaid object supplied. -- @function [parent=#core] getArmorType -- @param openmw.core#GameObject armor Either a gameObject or a armor record. -- @return openmw.core#SKILL The skill for this armor -function aux_core.getArmorType(armor) +function aux_item.getArmorType(armor) if armor.type ~= types.Armor and not armor.baseArmor then error("Not Armor") @@ -47,11 +47,11 @@ function aux_core.getArmorType(armor) local armorTypeWeight = math.floor(core.getGMST(armorGMSTs[armorType])) if weight <= armorTypeWeight * lightMultiplier then - return SKILL.lightarmor + return SKILL.lightarmor.id elseif weight <= armorTypeWeight * medMultiplier then - return SKILL.mediumarmor + return SKILL.mediumarmor.id else - return SKILL.heavyarmor + return SKILL.heavyarmor.id end end @@ -81,7 +81,7 @@ local function getItemSound(object) local record = object.type.record(object) local soundName = tostring(type) -- .. " Up" if type == types.Armor then - soundName = "Armor " .. armorSkillString[aux_core.getArmorType(object)] + soundName = "Armor " .. armorSkillString[aux_item.getArmorType(object)] elseif type == types.Clothing then soundName = "Clothes" if record.type == types.Clothing.TYPE.Ring then @@ -105,7 +105,7 @@ end -- @function [parent=#core] getDropSound -- @param openmw.core#GameObject item -- @return #string -function aux_core.getDropSound(item) +function aux_item.getDropSound(item) local soundName = getItemSound(item) return string.format("Item %s Down", soundName) end @@ -115,9 +115,9 @@ end -- @function [parent=#core] getPickupSound -- @param openmw.core#GameObject item -- @return #string -function aux_core.getPickupSound(item) +function aux_item.getPickupSound(item) local soundName = getItemSound(item) return string.format("Item %s Up", soundName) end -return aux_core +return aux_item