mirror of
https://gitlab.com/OpenMW/openmw.git
synced 2025-09-10 21:11:11 -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
|
.. include:: version.rst
|
||||||
|
|
||||||
.. raw:: html
|
.. 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.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/time.lua
|
||||||
openmw_aux/calendar.lua
|
openmw_aux/calendar.lua
|
||||||
openmw_aux/calendarconfig.lua
|
openmw_aux/calendarconfig.lua
|
||||||
openmw_aux/core.lua
|
openmw_aux/item.lua
|
||||||
openmw_aux/ui.lua
|
openmw_aux/ui.lua
|
||||||
|
|
||||||
builtin.omwscripts
|
builtin.omwscripts
|
||||||
|
@ -5,17 +5,17 @@ local core = require('openmw.core')
|
|||||||
-- Implementation can be found in `resources/vfs/openmw_aux/core.lua`.
|
-- Implementation can be found in `resources/vfs/openmw_aux/core.lua`.
|
||||||
-- @module core
|
-- @module core
|
||||||
-- @usage local auxCore = require('openmw_aux.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.
|
-- Checks if the provided armor is Heavy, Medium, or Light. Errors if invaid object supplied.
|
||||||
-- @function [parent=#core] getArmorType
|
-- @function [parent=#core] getArmorType
|
||||||
-- @param openmw.core#GameObject armor Either a gameObject or a armor record.
|
-- @param openmw.core#GameObject armor Either a gameObject or a armor record.
|
||||||
-- @return openmw.core#SKILL The skill for this armor
|
-- @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
|
if armor.type ~= types.Armor and not armor.baseArmor then
|
||||||
error("Not Armor")
|
error("Not Armor")
|
||||||
@ -47,11 +47,11 @@ function aux_core.getArmorType(armor)
|
|||||||
local armorTypeWeight = math.floor(core.getGMST(armorGMSTs[armorType]))
|
local armorTypeWeight = math.floor(core.getGMST(armorGMSTs[armorType]))
|
||||||
|
|
||||||
if weight <= armorTypeWeight * lightMultiplier then
|
if weight <= armorTypeWeight * lightMultiplier then
|
||||||
return SKILL.lightarmor
|
return SKILL.lightarmor.id
|
||||||
elseif weight <= armorTypeWeight * medMultiplier then
|
elseif weight <= armorTypeWeight * medMultiplier then
|
||||||
return SKILL.mediumarmor
|
return SKILL.mediumarmor.id
|
||||||
else
|
else
|
||||||
return SKILL.heavyarmor
|
return SKILL.heavyarmor.id
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
@ -81,7 +81,7 @@ local function getItemSound(object)
|
|||||||
local record = object.type.record(object)
|
local record = object.type.record(object)
|
||||||
local soundName = tostring(type) -- .. " Up"
|
local soundName = tostring(type) -- .. " Up"
|
||||||
if type == types.Armor then
|
if type == types.Armor then
|
||||||
soundName = "Armor " .. armorSkillString[aux_core.getArmorType(object)]
|
soundName = "Armor " .. armorSkillString[aux_item.getArmorType(object)]
|
||||||
elseif type == types.Clothing then
|
elseif type == types.Clothing then
|
||||||
soundName = "Clothes"
|
soundName = "Clothes"
|
||||||
if record.type == types.Clothing.TYPE.Ring then
|
if record.type == types.Clothing.TYPE.Ring then
|
||||||
@ -105,7 +105,7 @@ end
|
|||||||
-- @function [parent=#core] getDropSound
|
-- @function [parent=#core] getDropSound
|
||||||
-- @param openmw.core#GameObject item
|
-- @param openmw.core#GameObject item
|
||||||
-- @return #string
|
-- @return #string
|
||||||
function aux_core.getDropSound(item)
|
function aux_item.getDropSound(item)
|
||||||
local soundName = getItemSound(item)
|
local soundName = getItemSound(item)
|
||||||
return string.format("Item %s Down", soundName)
|
return string.format("Item %s Down", soundName)
|
||||||
end
|
end
|
||||||
@ -115,9 +115,9 @@ end
|
|||||||
-- @function [parent=#core] getPickupSound
|
-- @function [parent=#core] getPickupSound
|
||||||
-- @param openmw.core#GameObject item
|
-- @param openmw.core#GameObject item
|
||||||
-- @return #string
|
-- @return #string
|
||||||
function aux_core.getPickupSound(item)
|
function aux_item.getPickupSound(item)
|
||||||
local soundName = getItemSound(item)
|
local soundName = getItemSound(item)
|
||||||
return string.format("Item %s Up", soundName)
|
return string.format("Item %s Up", soundName)
|
||||||
end
|
end
|
||||||
|
|
||||||
return aux_core
|
return aux_item
|
Loading…
x
Reference in New Issue
Block a user