From bdefca5bf1ec851a53252a54be140e71c1789387 Mon Sep 17 00:00:00 2001 From: Azuline Date: Tue, 16 Sep 2025 17:58:12 +0700 Subject: [PATCH] dungus sfx --- Items/dormantFungus.lua | 38 ++++++++++++++++++++++++++++++- Sprites/Items/Effects/dungus.png | Bin 0 -> 669 bytes 2 files changed, 37 insertions(+), 1 deletion(-) create mode 100644 Sprites/Items/Effects/dungus.png diff --git a/Items/dormantFungus.lua b/Items/dormantFungus.lua index 43be6256..4290cab6 100644 --- a/Items/dormantFungus.lua +++ b/Items/dormantFungus.lua @@ -1,12 +1,39 @@ local sprite = Resources.sprite_load(NAMESPACE, "DormantFungus", path.combine(PATH, "Sprites/Items/dormantFungus.png"), 1, 18, 18) +local sprite_footstep = Resources.sprite_load(NAMESPACE, "DormantFungusFootstep", path.combine(PATH, "Sprites/Items/Effects/dungus.png"), 24, 14, 24) local sound = Resources.sfx_load(NAMESPACE, "DormantFungus", path.combine(PATH, "Sounds/Items/dormantFungus.ogg")) local dormantFungus = Item.new(NAMESPACE, "dormantFungus") dormantFungus:set_sprite(sprite) dormantFungus:set_tier(Item.TIER.common) dormantFungus:set_loot_tags(Item.LOOT_TAG.category_healing) - dormantFungus:clear_callbacks() + +local parDungus = Particle.new(NAMESPACE, "parDungus") +parDungus:set_sprite(sprite_footstep, true, true, false) +parDungus:set_life(96, 96) +parDungus:set_alpha3(1, 1, 0) + +local dungusShroomSync = Packet.new() +dungusShroomSync:onReceived(function(msg) + local actor = msg:read_instance() + + if not actor:exists() then return end + + -- copied and pasted from uranium horseshoe basically + parDungus:create(actor.x, actor.bbox_bottom + 1, 1) +end) + +local function sync_dungus(actor) + if not gm._mod_net_isHost() then + log.warning("sync_dungus called on client!") + return + end + + local msg = dungusShroomSync:message_begin() + msg:write_instance(actor) + msg:send_to_all() +end + dormantFungus:onPostStep(function(actor, stack) if gm._mod_net_isClient() then return end @@ -22,6 +49,15 @@ dormantFungus:onPostStep(function(actor, stack) local regen = math.ceil(actor.maxhp * (1 - 1 / (0.02 * stack + 1))) actor:heal(regen) gm.sound_play_networked(sound, 1, (0.9 + math.random() * 0.2), actor.x, actor.y) + + -- copied and pasted from uranium horseshoe basically + if Helper.is_false(actor.free) then + parDungus:create(actor.x, actor.bbox_bottom + 1, 1) + + if gm._mod_net_isOnline() then + sync_dungus(actor) -- particles arent synced by default so we have to use a packet for that + end + end else actor_data.dungusTimer = actor_data.dungusTimer - 1 end diff --git a/Sprites/Items/Effects/dungus.png b/Sprites/Items/Effects/dungus.png new file mode 100644 index 0000000000000000000000000000000000000000..be42b9b10b873990b092265477edf42a145d06c9 GIT binary patch literal 669 zcmV;O0%HA%P)Px#7*I@9MF0Q*%8RQ2000^q8m~`xx4fcqW`E(;+XsgPI{*Lx2y{|TQvm<}|NsC0 z|JBM=G5`PqA4x<(RA_^;~lq#D{h$9cFrjF|3gE2y~@iI5Fu)q#Bsn?nqUy|}@)^_6&LBW=1 zvuHKkwcYZ=-S<@?`5@G`$jA_sjSm5~7MtX#i+`m%cMY?4uF&cxN9fX!U9-sCJ#jVy zy2=O)Y>38$W?`{R5^k|;U%=VWIHJM&pP87ezHY(@YzbB(7uMm--6CIB$#8XUsLT=` z%<1fyj58#3;-Bnc#$X@AiiTpTYu+M^NL|BaSAJ{f$^@+P3a`sVrPg4pvK+ZtY#R)9 zK6MS3ecw+DG?pi^D`p4gwkk0gSdMa>*|uz