Merge branch 'master' of https://github.com/wofsauge/External-Item-Descriptions into master
This commit is contained in:
commit
e4795a42d2
1 file changed
+20
-4
+20
-4
@@ -407,7 +407,7 @@ end
|
|||||||
---@param description string
|
---@param description string
|
||||||
---@param language? EID_LanguageCode @Default: "en_us"
|
---@param language? EID_LanguageCode @Default: "en_us"
|
||||||
function EID:addEntity(id, variant, subtype, entityName, description, language)
|
function EID:addEntity(id, variant, subtype, entityName, description, language)
|
||||||
subtype = subtype or nil
|
subtype = subtype or -1
|
||||||
language = language or "en_us"
|
language = language or "en_us"
|
||||||
if id == EntityType.ENTITY_EFFECT then
|
if id == EntityType.ENTITY_EFFECT then
|
||||||
EID.effectList[variant] = true
|
EID.effectList[variant] = true
|
||||||
@@ -738,8 +738,24 @@ function EID:getDescriptionEntry(objTable, objIdentifier, noFallback)
|
|||||||
else return EID.descriptions[EID:getLanguage()][objTable] or EID.descriptions["en_us"][objTable] end
|
else return EID.descriptions[EID:getLanguage()][objTable] or EID.descriptions["en_us"][objTable] end
|
||||||
else
|
else
|
||||||
local translatedTable = EID.descriptions[EID:getLanguage()][objTable]
|
local translatedTable = EID.descriptions[EID:getLanguage()][objTable]
|
||||||
if noFallback then return translatedTable and translatedTable[objIdentifier]
|
local description
|
||||||
else return (translatedTable and translatedTable[objIdentifier]) or (EID.descriptions["en_us"][objTable] and EID.descriptions["en_us"][objTable][objIdentifier]) end
|
if noFallback then description = translatedTable and translatedTable[objIdentifier]
|
||||||
|
else description = (translatedTable and translatedTable[objIdentifier]) or (EID.descriptions["en_us"][objTable] and EID.descriptions["en_us"][objTable][objIdentifier]) end
|
||||||
|
--Try looking for a -1 that would encompass all subtypes of the variant
|
||||||
|
if not description then
|
||||||
|
local subtype
|
||||||
|
for i = string.len(objIdentifier), 1, -1 do
|
||||||
|
if string.sub(objIdentifier, i, i) == "." then
|
||||||
|
subtype = string.sub(objIdentifier, i + 1, -1)
|
||||||
|
objIdentifier = string.gsub(objIdentifier, "." .. subtype, "") .. ".-1"
|
||||||
|
if subtype ~= "-1" then
|
||||||
|
return EID:getDescriptionEntry(objTable, objIdentifier, noFallback)
|
||||||
|
end
|
||||||
|
break
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
return description
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
@@ -1588,7 +1604,7 @@ function EID:SplitTVS(tvsString)
|
|||||||
end
|
end
|
||||||
|
|
||||||
---Checks if any player has a given item ID (or anyone is a given player ID)
|
---Checks if any player has a given item ID (or anyone is a given player ID)
|
||||||
---@param Type string | integer | EntityType
|
---@param Type string | integer | EntityType
|
||||||
---@param Var integer | nil
|
---@param Var integer | nil
|
||||||
---@param Sub integer | nil
|
---@param Sub integer | nil
|
||||||
---@return boolean, EntityPlayer?, integer?
|
---@return boolean, EntityPlayer?, integer?
|
||||||
|
|||||||
Reference in new issue
Block a user