From 5e8ff01ab74b2f68d33edaa9aaadc3894a447fc2 Mon Sep 17 00:00:00 2001 From: bad Date: Tue, 24 May 2022 18:16:21 +0200 Subject: [PATCH] Initial commit --- init.lua | 49 +++++++++++++++++++++++++++++++++++++++++++++ mod.conf | 2 ++ textures/heart.png | Bin 0 -> 62464 bytes 3 files changed, 51 insertions(+) create mode 100644 init.lua create mode 100644 mod.conf create mode 100644 textures/heart.png diff --git a/init.lua b/init.lua new file mode 100644 index 0000000..8136c90 --- /dev/null +++ b/init.lua @@ -0,0 +1,49 @@ +function show_heart(pos) + minetest.add_particle( + { + pos = pos, + velocity = {x=0, y=1, z=0}, + acceleration = {x=0, y=0, z=0}, + -- Spawn particle at pos with velocity and acceleration + + expirationtime = 1, + -- Disappears after expirationtime seconds + + size = 3, + -- Scales the visual size of the particle texture. + -- If `node` is set, size can be set to 0 to spawn a randomly-sized + -- particle (just like actual node dig particles). + + texture = "heart.png", + -- The texture of the particle + + glow = 0 + -- Optional, specify particle self-luminescence in darkness. + -- Values 0-14. + } + ) + +end + +function show_hearts(player) + local hearts = 2+math.ceil(math.random()*3) + local player_pos = player:get_pos() + local looking_dir = player:get_look_dir() + looking_dir.y = 0 + + for i=0,hearts do + local vert_offset = 1.5*math.random()-0.75 + local y_offset = 0.5*math.random() + 1.5 + local offset = vector.multiply(looking_dir, vert_offset) + offset.y = y_offset + offset.x, offset.z = offset.z, offset.x + + show_heart(vector.add(player_pos,offset)) + end +end + +minetest.register_on_player_hpchange(function(player, hp_change, reason) + if hp_change < 0 then + show_hearts(player) + end +end) diff --git a/mod.conf b/mod.conf new file mode 100644 index 0000000..bf24349 --- /dev/null +++ b/mod.conf @@ -0,0 +1,2 @@ +name=testochism +description="A small mod to show heart particles when taking damage" diff --git a/textures/heart.png b/textures/heart.png new file mode 100644 index 0000000000000000000000000000000000000000..50dc50d3bd76c9ee48d4c1a29f8b766d5e59ec6e GIT binary patch literal 62464 zcmeHQ2~?BUwhkC1fJm5%iiV&fC{@JS%aD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