From 46513ca3997df930465b3ade2334a88757e5244f Mon Sep 17 00:00:00 2001 From: Wofsauge Date: Wed, 11 Nov 2020 23:06:02 +0100 Subject: [PATCH] Fixed wrong initialization of KColor objects --- eid_api.lua | 56 ++++++++-------------------------------------------- eid_data.lua | 34 +++++++++++++++---------------- 2 files changed, 25 insertions(+), 65 deletions(-) diff --git a/eid_api.lua b/eid_api.lua index 78afc6f3..92a8a297 100644 --- a/eid_api.lua +++ b/eid_api.lua @@ -1,29 +1,4 @@ ---[[ -EID features 6 tables for mods to define their descriptions: -__eidTrinketDescriptions for trinkets -__eidCardDescriptions for cards -__eidPillDescriptions for pills -__eidItemDescriptions for Collectibles / items -__eidItemTransformations assigns transformation-informations to collectibles -__eidEntityDescriptions for entities -__eidEntityDescriptions["ID.Variant.Subtype"] = {"HEADLINE","DESCRIPTION"}; - -To assign a unique description for a specific entity: entity:GetData()["EID_Description"] = {"HEADLINE","DESCRIPTION"} - - -For example: to add the item "My Item Name" and the Description "Most Fitting Description" do something like this: - --- 1. Get your itemid -local item = Isaac.GetItemIdByName("My Item Name"); --- 2. Make sure we're not adding to a nil table -if not __eidItemDescriptions then - __eidItemDescriptions = {}; -end --- 3. Add the description -__eidItemDescriptions[item] = "Most Fitting Description"; - ---]] --- Init variables for other mods to hand over Descriptions if they were not yet inited by another mod. +-- Init legacy global variables for other mods to hand over Descriptions if not __eidItemDescriptions then __eidItemDescriptions = {} end @@ -113,7 +88,7 @@ function EID:addTransformation(targetType, targetIdentifier, transformationStrin EID.descriptions[language].custom["transformations_"..targetType.."_".. targetIdentifier] = {targetType, targetIdentifier, transformationString} end --- Adds a description for a pilleffect id. Optional parameters: language, transformations +-- Adds a description for a an Entity. Optional parameters: language, transformations -- when subtype is -1 or empty, it will affect all subtypes of that entity function EID:addEntity(id, variant, subtype, entityName, description, language) subtype = subtype or nil @@ -500,17 +475,14 @@ function EID:interpolateColors(kColor1, kColor2, fraction) (kColor2.Red - kColor1.Red) * fraction + kColor1.Red, (kColor2.Green - kColor1.Green) * fraction + kColor1.Green, (kColor2.Blue - kColor1.Blue) * fraction + kColor1.Blue, - (kColor2.Alpha - kColor1.Alpha) * fraction + kColor1.Alpha, - 0, - 0, - 0 + (kColor2.Alpha - kColor1.Alpha) * fraction + kColor1.Alpha ) return t end -- Creates a copy of a KColor object. This prevents overwriting existing function EID:copyKColor(colorObj) - return KColor(colorObj.Red, colorObj.Green, colorObj.Blue, colorObj.Alpha, 0, 0, 0) + return KColor(colorObj.Red, colorObj.Green, colorObj.Blue, colorObj.Alpha) end -- Compares two KColors. Returns true if they are equal @@ -524,10 +496,7 @@ function EID:getNameColor() EIDConfig["ItemNameColor"][1], EIDConfig["ItemNameColor"][2], EIDConfig["ItemNameColor"][3], - EIDConfig["Transparency"], - 0, - 0, - 0 + EIDConfig["Transparency"] ) end @@ -537,10 +506,7 @@ function EID:getTextColor() EIDConfig["TextColor"][1], EIDConfig["TextColor"][2], EIDConfig["TextColor"][3], - EIDConfig["Transparency"], - 0, - 0, - 0 + EIDConfig["Transparency"] ) end @@ -550,10 +516,7 @@ function EID:getTransformationColor() EIDConfig["TransformationColor"][1], EIDConfig["TransformationColor"][2], EIDConfig["TransformationColor"][3], - EIDConfig["Transparency"], - 0, - 0, - 0 + EIDConfig["Transparency"] ) end @@ -563,9 +526,6 @@ function EID:getErrorColor() EIDConfig["ErrorColor"][1], EIDConfig["ErrorColor"][2], EIDConfig["ErrorColor"][3], - EIDConfig["Transparency"], - 0, - 0, - 0 + EIDConfig["Transparency"] ) end diff --git a/eid_data.lua b/eid_data.lua index 6e63470b..06784edb 100644 --- a/eid_data.lua +++ b/eid_data.lua @@ -131,23 +131,23 @@ EID.InlineColors = { ["ColorObjName"] = function(_) return EID:getNameColor() end, ["ColorReset"] = function(_) return EID.LastRenderCallColor end, -- Basic Colors - ["ColorBlack"] = KColor(0, 0, 0, 1, 0, 0, 0), - ["ColorWhite"] = KColor(1, 1, 1, 1, 0, 0, 0), - ["ColorRed"] = KColor(1, 0, 0, 1, 0, 0, 0), - ["ColorLime"] = KColor(0, 1, 0, 1, 0, 0, 0), - ["ColorBlue"] = KColor(0, 0, 1, 1, 0, 0, 0), - ["ColorYellow"] = KColor(1, 1, 0, 1, 0, 0, 0), - ["ColorCyan"] = KColor(0, 1, 1, 1, 0, 0, 0), - ["ColorPink"] = KColor(1, 0, 1, 1, 0, 0, 0), - ["ColorSilver"] = KColor(0.75, 0.75, 0.75, 1, 0, 0, 0), - ["ColorGray"] = KColor(0.5, 0.5, 0.5, 1, 0, 0, 0), - ["ColorMaroon"] = KColor(0.5, 0, 0, 1, 0, 0, 0), - ["ColorOlive"] = KColor(0.5, 0.5, 0, 1, 0, 0, 0), - ["ColorGreen"] = KColor(0, 0.5, 0, 1, 0, 0, 0), - ["ColorPurple"] = KColor(0.5, 0, 0.5, 1, 0, 0, 0), - ["ColorTeal"] = KColor(0, 0.5, 0.5, 1, 0, 0, 0), - ["ColorNavy"] = KColor(0, 0, 0.5, 1, 0, 0, 0), - ["ColorOrange"] = KColor(1, 0.54, 0, 1, 0, 0, 0), + ["ColorBlack"] = KColor(0, 0, 0, 1), + ["ColorWhite"] = KColor(1, 1, 1, 1), + ["ColorRed"] = KColor(1, 0, 0, 1), + ["ColorLime"] = KColor(0, 1, 0, 1), + ["ColorBlue"] = KColor(0, 0, 1, 1), + ["ColorYellow"] = KColor(1, 1, 0, 1), + ["ColorCyan"] = KColor(0, 1, 1, 1), + ["ColorPink"] = KColor(1, 0, 1, 1), + ["ColorSilver"] = KColor(0.75, 0.75, 0.75, 1), + ["ColorGray"] = KColor(0.5, 0.5, 0.5, 1), + ["ColorMaroon"] = KColor(0.5, 0, 0, 1), + ["ColorOlive"] = KColor(0.5, 0.5, 0, 1), + ["ColorGreen"] = KColor(0, 0.5, 0, 1), + ["ColorPurple"] = KColor(0.5, 0, 0.5, 1), + ["ColorTeal"] = KColor(0, 0.5, 0.5, 1), + ["ColorNavy"] = KColor(0, 0, 0.5, 1), + ["ColorOrange"] = KColor(1, 0.54, 0, 1), -- Swag Colors -- Rainbow color effect