Fixed some bugs and added transformation Enum

This commit is contained in:
wofsauge committed 2020-08-31 22:22:28 +02:00
1 parent f029e36460
commit 8c6564e69f
7 files changed
+84 -71

No files matched your search

+3 -1
View File
@@ -851,5 +851,7 @@ transformations = {
"Seraphim", -- 10
"Super Bum", -- 11
"Bookworm", -- 12
"Spider Baby" -- 13
"Spider Baby", -- 13
"Adult", -- 14
"Stompy" -- 15
}
+3 -1
View File
@@ -853,5 +853,7 @@ transformations = {
"Seraphim", -- 10
"Super Bum", -- 11
"Bookworm", -- 12
"Spider Baby" -- 13
"Spider Baby", -- 13
"Adult", -- 14
"Stompy" -- 15
}
+3 -1
View File
@@ -858,5 +858,7 @@ transformations = {
"Seraphim", -- 10
"Super Bum", -- 11
"Bookworm", -- 12
"Spider Baby" -- 13
"Spider Baby", -- 13
"Adult", -- 14
"Stompy" -- 15
}
+3 -29
View File
@@ -880,33 +880,7 @@ transformations = {
"Seraphim", -- 10
"Super Bum", -- 11
"Bookworm", -- 12
"Spider Baby" -- 13
"Spider Baby", -- 13
"Adult", -- 14
"Stompy" -- 15
}
--[[print("\\1: \1 \\2: \2 \\3: \3 \\4: \4 \\5: \5 \\6: \6 \\7: \7 \\8: \8 \\9: \9 \\10: \10 ")
print("\\11: \11 \\12: \12 \\13: \13 \\14: \14 \\15: \15 \\16: \16 \\17: \17 \\18: \18 \\19: \19 \\20: \20 ")
print("\\21: \21 \\22: \22 \\23: \23 \\24: \24 \\25: \25 \\26: \26 \\27: \27 \\28: \28 \\29: \29 \\30: \30 ")
print("\\31: \31 \\32: \32 \\33: \33 \\34: \34 \\35: \35 \\36: \36 \\37: \37 \\38: \38 \\39: \39 \\40: \40 ")
print("\\41: \41 \\42: \42 \\43: \43 \\44: \44 \\45: \45 \\46: \46 \\47: \47 \\48: \48 \\49: \49 \\50: \50 ")
print("\\51: \51 \\52: \52 \\53: \53 \\54: \54 \\55: \55 \\56: \56 \\57: \57 \\58: \58 \\59: \59 \\60: \60 ")
print("\\61: \61 \\62: \62 \\63: \63 \\64: \64 \\65: \65 \\66: \66 \\67: \67 \\68: \68 \\69: \69 \\70: \70 ")
print("\\71: \71 \\72: \72 \\73: \73 \\74: \74 \\75: \75 \\76: \76 \\77: \77 \\78: \78 \\79: \79 \\80: \80 ")
print("\\81: \81 \\82: \82 \\83: \83 \\84: \84 \\85: \85 \\86: \86 \\87: \87 \\88: \88 \\89: \89 \\90: \90 ")
print("\\91: \91 \\92: \92 \\93: \93 \\94: \94 \\95: \95 \\96: \96 \\97: \97 \\98: \98 \\99: \99 \\100: \100 ")
print("\\101: \101 \\102: \102 \\103: \103 \\104: \104 \\105: \105 \\106: \106 \\107: \107 \\108: \108 \\109: \109 \\110: \110 ")
print("\\111: \111 \\112: \112 \\113: \113 \\114: \114 \\115: \115 \\116: \116 \\117: \117 \\118: \118 \\119: \119 \\120: \120 ")
print("\\121: \121 \\122: \122 \\123: \123 \\124: \124 \\125: \125 \\126: \126 \\127: \127 \\128: \128 \\129: \129 \\130: \130 ")
print("\\131: \131 \\132: \132 \\133: \133 \\134: \134 \\135: \135 \\136: \136 \\137: \137 \\138: \138 \\139: \139 \\140: \140 ")
print("\\141: \141 \\142: \142 \\143: \143 \\144: \144 \\145: \145 \\146: \146 \\147: \147 \\148: \148 \\149: \149 \\150: \150 ")
print("\\151: \151 \\152: \152 \\153: \153 \\154: \154 \\155: \155 \\156: \156 \\157: \157 \\158: \158 \\159: \159 \\160: \160 ")
print("\\161: \161 \\162: \162 \\163: \163 \\164: \164 \\165: \165 \\166: \166 \\167: \167 \\168: \168 \\169: \169 \\170: \170 ")
print("\\171: \171 \\172: \172 \\173: \173 \\174: \174 \\175: \175 \\176: \176 \\177: \177 \\178: \178 \\179: \179 \\180: \180 ")
print("\\181: \181 \\182: \182 \\183: \183 \\184: \184 \\185: \185 \\186: \186 \\187: \187 \\188: \188 \\189: \189 \\190: \190 ")
print("\\191: \191 \\192: \192 \\193: \193 \\194: \194 \\195: \195 \\196: \196 \\197: \197 \\198: \198 \\231: \231 \\200: \200 ")
print("\\201: \201 \\202: \202 \\203: \203 \\204: \204 \\205: \205 \\206: \206 \\207: \207 \\208: \208 \\209: \209 \\210: \210 ")
print("\\211: \211 \\212: \212 \\213: \213 \\214: \214 \\215: \215 \\216: \216 \\217: \217 \\218: \218 \\219: \219 \\220: \220 ")
print("\\221: \221 \\222: \222 \\223: \223 \\224: \224 \\225: \225 \\226: \226 \\227: \227 \\228: \228 \\229: \229 \\230: \230 ")
print("\\231: \231 \\232: \232 \\233: \233 \\234: \234 \\235: \235 \\236: \236 \\237: \237 \\238: \238 \\239: \239 \\240: \240 ")
print("\\241: \241 \\242: \242 \\243: \243 \\244: \244 \\245: \245 \\246: \246 \\247: \247 \\248: \248 \\249: \249 \\250: \250 ")
print("\\251: \251 \\252: \252 \\253: \253 \\254: \254 \\255: \255 ")]]--
+3 -1
View File
@@ -857,5 +857,7 @@ transformations = {
"Serafín", -- 10
"Super Bum", -- 11
"Bookworm (Ratón de Biblioteca)", -- 12
"Spider Baby (Bebé araña)" -- 13
"Spider Baby (Bebé araña)", -- 13
"Adult", -- 14
"Stompy" -- 15
}
+52 -15
View File
@@ -45,17 +45,43 @@ if not __eidEntityDescriptions then
end
---------------------------------------------------------------------------
-------------------------Handle Custom Enum -----------------------------
--maps the Player transformation from the enum PlayerForm to the internal transformation table
-- Possible usages: EID.TRANSFORMATION[ PlayerForm.PLAYERFORM_MUSHROOM ]
-- EID.TRANSFORMATION.MUSHROOM
EID.TRANSFORMATION = {
["GUPPY"] = 1,
["LORD_OF_THE_FLIES"] = 3,
["MUSHROOM"] = 2,
["ANGEL"] = 10,
["BOB"] = 8,
["SPUN"] = 5,
["MOM"] = 6,
["CONJOINED"] = 4,
["LEVIATHAN"] = 9,
["POOP"] = 7,
["BOOKWORM"] = 12,
["ADULT"] = 14,
["SPIDERBABY"] = 13,
["SUPERBUM"] = 11,
}
---------------------------------------------------------------------------
-------------------------Handle API Functions -----------------------------
-- Returns if EID is displaying text right now
function EID:isDisplayingText()
return isDisplayingText
end
-- returns the current text position
function EID:getTextPosition()
return Vector(EIDConfig["XPosition"],EIDConfig["YPosition"])
end
-- returns the entity that is currently described. returns last described entity if currently not displaying text
function EID:getLastDescribedEntity()
return lastDescriptionEntity
end
@@ -64,6 +90,29 @@ function EID:getModDescription(list, id)
return (list) and (list[id])
end
--Get the name of the given transformation by its ID
function EID:getTransformation(id)
local str="Custom";
if (tonumber(id) <= #transformations-1) then
return transformations[tonumber(id)+1]
end
return str
end
-- check if an entity is part of the describable entities
function EID:hasDescription(entity)
local isAllowed = false
if EIDConfig["EnableEntityDescriptions"] then
isAllowed = isAllowed or (__eidEntityDescriptions[entity.Type.."."..entity.Variant.."."..entity.SubType]~=nil --[[or type(entity:GetData()["EID_Description"]) ~= type(nil)]])
end
isAllowed = isAllowed or (entity.Variant == PickupVariant.PICKUP_COLLECTIBLE and EIDConfig["DisplayItemInfo"])
isAllowed = isAllowed or (entity.Variant == PickupVariant.PICKUP_TRINKET and EIDConfig["DisplayTrinketInfo"])
isAllowed = isAllowed or (entity.Variant == PickupVariant.PICKUP_TAROTCARD and EIDConfig["DisplayCardInfo"])
isAllowed = isAllowed or (entity.Variant == PickupVariant.PICKUP_PILL and EIDConfig["DisplayPillInfo"])
return entity.Type == EntityType.ENTITY_PICKUP and isAllowed and entity.SubType>0
end
-- Replaces shorthand-representations of a character with the internal reference
function EID:replaceMarkupStrings(text)
text = string.gsub(text, "!!!", "ǃ") -- Turn 3 Exclamations into Warning
text = string.gsub(text, "\1", "↑") -- Legacy Up Arrow
@@ -76,10 +125,10 @@ function EID:replaceMarkupStrings(text)
return text
end
--Returns
EID:bulletIcons={"↑","↓","!","ǃ"}
-- Returns the icon used for the bulletpoint. It will look at the first character in the given string.
EID.bulletIcons={"↑","↓","!","ǃ"}
function EID:getBulletpointIcon(text)
for i,v in ipairs(EID:bulletIcons) do
for i,v in ipairs(EID.bulletIcons) do
local iconPos = string.find(text,v)
if iconPos == 1 or iconPos == 2 then
return v
@@ -114,15 +163,3 @@ function EID:getErrorColor()
return KColor(EIDConfig["ErrorColor"][1] , EIDConfig["ErrorColor"][2], EIDConfig["ErrorColor"][3],EIDConfig["Transparency"],0,0,0)
end
-- check if an entity is part of the describable entities
function EID:hasDescription(entity)
local isAllowed = false
if EIDConfig["EnableEntityDescriptions"] then
isAllowed = isAllowed or (__eidEntityDescriptions[entity.Type.."."..entity.Variant.."."..entity.SubType]~=nil --[[or type(entity:GetData()["EID_Description"]) ~= type(nil)]])
end
isAllowed = isAllowed or (entity.Variant == PickupVariant.PICKUP_COLLECTIBLE and EIDConfig["DisplayItemInfo"])
isAllowed = isAllowed or (entity.Variant == PickupVariant.PICKUP_TRINKET and EIDConfig["DisplayTrinketInfo"])
isAllowed = isAllowed or (entity.Variant == PickupVariant.PICKUP_TAROTCARD and EIDConfig["DisplayCardInfo"])
isAllowed = isAllowed or (entity.Variant == PickupVariant.PICKUP_PILL and EIDConfig["DisplayPillInfo"])
return entity.Type == EntityType.ENTITY_PICKUP and isAllowed and entity.SubType>0
end
+17 -23
View File
@@ -5,6 +5,7 @@ local lineHeight = 11
local isDisplayingText= false
local lastDescriptionEntity= nil
local hideDescToggle= false
EID.sacrificeCounter= 1
local IconSprite = Sprite()
IconSprite:Load("gfx/icons.anm2", true)
@@ -46,18 +47,17 @@ end
---------------------------------------------------------------------------
-------------------------Handle Sacrifice Room-----------------------------
local SacrificeCounter = 1
if EIDConfig["DisplaySacrificeInfo"] then
function onNewFloor()
SacrificeCounter = 1
EID.sacrificeCounter= 1
end
EID:AddCallback(ModCallbacks.MC_POST_NEW_LEVEL, onNewFloor)
function onDamage(_,entity,_,flag,source)
if Game():GetRoom():GetType() == RoomType.ROOM_SACRIFICE and source.Type == 0 and flag == DamageFlag.DAMAGE_SPIKES then
if SacrificeCounter<12 then
SacrificeCounter= SacrificeCounter+1
if EID.sacrificeCounter<12 then
EID.sacrificeCounter= EID.sacrificeCounter+1
end
end
end
@@ -111,16 +111,16 @@ function printDescription(desc)
if not(desc[2]=="0" or desc[2]=="" or desc[2]==nil ) then
if EIDConfig["TransformationText"] then
local transformationText= ""
if not(printTransformation(desc[2])=="Custom") then
transformationText =printTransformation(desc[2])
if not(EID:getTransformation(desc[2])=="Custom") then
transformationText =EID:getTransformation(desc[2])
elseif not(transformations[desc[2]]) then --Custom transformationname
transformationText=desc[2]
else
transformationText=printTransformation(desc[2])
transformationText=EID:getTransformation(desc[2])
end
EID:renderString(transformationText, Vector(EIDConfig["XPosition"]+16*EIDConfig["Scale"], padding-1), Vector(EIDConfig["Scale"],EIDConfig["Scale"]), EID:getTransformationColor(), false)
end
if EIDConfig["TransformationIcons"] and not(printTransformation(desc[2])=="Custom") then
if EIDConfig["TransformationIcons"] and not(EID:getTransformation(desc[2])=="Custom") then
IconSprite:Play("Transformation"..desc[2])
IconSprite.Scale = Vector(EIDConfig["Scale"],EIDConfig["Scale"])
IconSprite:Update()
@@ -176,27 +176,21 @@ function printBulletPoints(description, padding)
table.insert(array, text)
local textColor = EID:getTextColor()
for i, v in ipairs(array) do
local posX = EIDConfig["XPosition"]
local bpIcon = " " -- no bulletpoint
if i == 1 then
bpIcon = EID:getBulletpointIcon(v)
if string.find(bpIcon,'\007') == nil then
v = string.sub(v, 3 + #bpIcon)
posX = posX - 2 -- Move a bit to the left, to center icons
end
end
EID:renderString(bpIcon..EID:replaceMarkupStrings(v), Vector(EIDConfig["XPosition"],padding), Vector(EIDConfig["Scale"],EIDConfig["Scale"]), textColor, false)
EID:renderString(bpIcon..EID:replaceMarkupStrings(v), Vector(posX, padding), Vector(EIDConfig["Scale"],EIDConfig["Scale"]), textColor, false)
padding = padding +lineHeight*EIDConfig["Scale"]
end
end
end
function printTransformation(transformationString)
local str="Custom";
for i = 0, #transformations-1 do
if (tonumber(transformationString)==i) then
str = tostring(transformations[i+1])
end
end
return str
end
---------------------------------------------------------------------------
---------------------------Handle Rendering--------------------------------
@@ -217,7 +211,7 @@ function renderQuestionMark()
IconSprite.Scale = Vector(EIDConfig["Scale"],EIDConfig["Scale"])
IconSprite:Update()
IconSprite:Render(Vector(EIDConfig["XPosition"]+5*EIDConfig["Scale"],posY()+5*EIDConfig["Scale"]), Vector(0,0), Vector(0,0))
if Isaac.GetPlayer(0):HasCollectible(CollectibleType.COLLECTIBLE_SCHOOLBAG)then modifiedPosY =EIDConfig["YPosition"] -30 end
if Isaac.GetPlayer(0):HasCollectible(CollectibleType.COLLECTIBLE_SCHOOLBAG) then modifiedPosY =EIDConfig["YPosition"] -30 end
end
function renderIndicator(entity)
@@ -284,7 +278,7 @@ local function onRender(t)
if dist/40>tonumber(EIDConfig["MaxDistance"]) or not closest.Type == EntityType.ENTITY_PICKUP then
if Game():GetRoom():GetType()==RoomType.ROOM_SACRIFICE and EIDConfig["DisplaySacrificeInfo"] then
printTrinketDescription(sacrificeDescriptions[SacrificeCounter],"sacrifice")
printTrinketDescription(sacrificeDescriptions[EID.sacrificeCounter],"sacrifice")
end
if Game():GetRoom():GetType()==RoomType.ROOM_DICE and EIDConfig["DisplayDiceInfo"] and type(closestDice) ~= type(nil) then
printTrinketDescription(diceDescriptions[closestDice.SubType+1],"dice")
@@ -383,7 +377,7 @@ local function onRender(t)
pillsprite:Render(Vector(EIDConfig["XPosition"]+2*EIDConfig["Scale"],posY()+(11+offsetX)*EIDConfig["Scale"]), Vector(0,0), Vector(0,0))
pillsprite.Scale = Vector(1,1)
end
if player:HasCollectible(CollectibleType.COLLECTIBLE_SCHOOLBAG)then modifiedPosY =EIDConfig["YPosition"] +30 end
if player:HasCollectible(CollectibleType.COLLECTIBLE_SCHOOLBAG) then modifiedPosY =EIDConfig["YPosition"] +30 end
end
EID:AddCallback(ModCallbacks.MC_POST_RENDER, onRender)