-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
#4 - Refactor
- Loading branch information
Showing
8 changed files
with
107 additions
and
43 deletions.
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
<items gfxroot="gfx/items/" version="1"> | ||
<!--Trinkets--> | ||
<trinket name="Small Cookie" description="A tiny snack" gfx="trinket_baby-bender.png" /> | ||
</items> |
Empty file.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,46 @@ | ||
--VvP and S0R's Small Cookie Trinket-- | ||
--Version 1.0 | ||
--By Vincent1vp / SoRcius | ||
|
||
local Mod = RegisterMod("S0R_SmallCookie", 1) | ||
local game = Game() | ||
local sound = SFXManager() | ||
|
||
local trinketId = { | ||
TRINKET_SMALLCOOKIE = Isaac.GetTrinketIdByName("Small Cookie") | ||
} | ||
|
||
local smallCookieStats = { | ||
hasTrinket = false, | ||
uses = 10 | ||
} | ||
|
||
--- | ||
--- EID Comparability | ||
--- | ||
if not __eidTrinketDescriptions then | ||
__eidTrinketDescriptions = {} | ||
end | ||
__eidTrinketDescriptions[trinketId.TRINKET_SMALLCOOKIE] = "Auto-regen over time#10 uses" | ||
|
||
function Mod:postRender() | ||
local player = Isaac.GetPlayer(0) | ||
|
||
if player:HasTrinket(trinketId.TRINKET_SMALLCOOKIE) then | ||
-- TODO: Time based instead of random? | ||
if math.random(1000) == 1 and smallCookieStats.uses > 0 and player:GetHearts() < player:GetMaxHearts() then | ||
smallCookieStats.uses = smallCookieStats.uses - 1 | ||
player:AddHearts(1) | ||
|
||
-- Play sound when healed | ||
local dummy = Isaac.Spawn(EntityType.ENTITY_FLY, 0, 0, Vector(0,0), Vector(0,0), Isaac.GetPlayer(0)):ToNPC() | ||
dummy:ClearEntityFlags(EntityFlag.FLAG_APPEAR) | ||
dummy.CanShutDoors = false | ||
dummy:PlaySound(157, 1, 0, false, 1.0) | ||
dummy:Remove() | ||
elseif smallCookieStats.uses == 0 then | ||
player:TryRemoveTrinket(trinketId.TRINKET_SMALLCOOKIE) | ||
end | ||
end | ||
end | ||
Mod:AddCallback(ModCallbacks.MC_POST_RENDER, Mod.postRender) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
<metadata> | ||
<name>Small Cookie trinket</name> | ||
<directory>small_cookie</directory> | ||
<description> | ||
Adds a trinket to the game. The Small Cookie when held heals Isaac over time (Like the Placenta item), but disappears after 10 uses. | ||
|
||
If you have Mom's Box the trinket will heal you a full heart instead of a half heart | ||
</description> | ||
<version>1.0</version> | ||
<visibility/> | ||
<tag id="Trinkets"/> | ||
</metadata> |
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters