mirror of
https://gitlab.com/OpenMW/openmw.git
synced 2025-09-09 04:15:40 -04:00
Use Item instead of Core
This commit is contained in:
parent
d44db5faa8
commit
3741a4f596
@ -4,4 +4,4 @@ Package openmw.core
|
||||
.. include:: version.rst
|
||||
|
||||
.. raw:: html
|
||||
:file: generated_html/openmw_core.html
|
||||
:file: generated_html/openmw_item.html
|
@ -9,5 +9,5 @@
|
||||
+---------------------------------------------------------+--------------------+---------------------------------------------------------------+
|
||||
|:ref:`openmw_aux.ui <Package openmw_aux.ui>` | by player scripts | | User interface utils |
|
||||
+---------------------------------------------------------+--------------------+---------------------------------------------------------------+
|
||||
|:ref:`openmw_aux.core <Package openmw_aux.core>` | everywhere | | GameObject Utils |
|
||||
|:ref:`openmw_aux.item <Package openmw_aux.item>` | everywhere | | Game Item utils |
|
||||
+---------------------------------------------------------+--------------------+---------------------------------------------------------------+
|
||||
|
@ -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
|
||||
|
@ -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
|
Loading…
x
Reference in New Issue
Block a user