From 8bc4f8fdbef5bb1e4917fe5988d25355f356b0bd Mon Sep 17 00:00:00 2001 From: the-real-herowl Date: Fri, 27 Dec 2024 15:27:08 +0100 Subject: [PATCH] Review commemts implemented --- mods/ITEMS/vl_fireworks/crafting.lua | 10 ++++++++-- mods/ITEMS/vl_fireworks/init.lua | 4 +++- mods/ITEMS/vl_fireworks/rockets.lua | 5 ++--- mods/ITEMS/vl_fireworks/star.lua | 6 ++---- 4 files changed, 15 insertions(+), 10 deletions(-) diff --git a/mods/ITEMS/vl_fireworks/crafting.lua b/mods/ITEMS/vl_fireworks/crafting.lua index 684788543..9f97cb07b 100644 --- a/mods/ITEMS/vl_fireworks/crafting.lua +++ b/mods/ITEMS/vl_fireworks/crafting.lua @@ -21,8 +21,14 @@ local function craft_star(itemstack, player, old_grid) -- analyze the recipe used for _, item in pairs(old_grid) do - if item:get_name() == "mcl_fire:fire_charge" then size = 2 end - if item:get_name() == "mcl_end:crystal" then size = 3 end + if item:get_name() == "mcl_fire:fire_charge" then + size = 2 + break + end + if item:get_name() == "mcl_end:crystal" then + size = 3 + break + end end local effect = { diff --git a/mods/ITEMS/vl_fireworks/init.lua b/mods/ITEMS/vl_fireworks/init.lua index 8c61358f7..c5a5c2bbb 100644 --- a/mods/ITEMS/vl_fireworks/init.lua +++ b/mods/ITEMS/vl_fireworks/init.lua @@ -2,13 +2,15 @@ local path = minetest.get_modpath("vl_fireworks") vl_fireworks = {} +local colors = {"red", "yellow", "blue", "green", "white"} + + function vl_fireworks.generic_particle_explosion(pos, size) if pos.object then pos = pos.object:get_pos() end local particle_pattern = math.random(1, 3) local fpitch local type = math.random(1, 2) local size = size or math.random(1, 3) - local colors = {"red", "yellow", "blue", "green", "white"} local this_colors = {colors[math.random(#colors)], colors[math.random(#colors)], colors[math.random(#colors)]} if size == 1 then diff --git a/mods/ITEMS/vl_fireworks/rockets.lua b/mods/ITEMS/vl_fireworks/rockets.lua index d78c74f8d..a02788512 100644 --- a/mods/ITEMS/vl_fireworks/rockets.lua +++ b/mods/ITEMS/vl_fireworks/rockets.lua @@ -81,10 +81,9 @@ local firework_entity = { allow_punching = function(self, entity_def, projectile_def, object) local lua = object:get_luaentity() if lua and lua.name == "mobs_mc:rover" then return false end + -- TODO at some point make it so impact depends on collision speed? (see next line) --if (self.object:get_velocity() + object:get_velocity()).length() < 5 then return end - core.log("allow punching") - return true end, }, @@ -183,7 +182,7 @@ local firework_def = { end, _vl_fireworks_std_durs_forces = { {2.2, 10}, {4.5, 20}, {6, 30} }, _vl_fireworks_tt = function(duration, stars) - local retval = S("Duration:") .. " " .. duration + local retval = tt_help .. " " .. duration for _, effect in pairs(stars) do if type(effect) == "string" then effect = core.deserialize(effect) end diff --git a/mods/ITEMS/vl_fireworks/star.lua b/mods/ITEMS/vl_fireworks/star.lua index 7d86d6948..f60fceb0a 100644 --- a/mods/ITEMS/vl_fireworks/star.lua +++ b/mods/ITEMS/vl_fireworks/star.lua @@ -5,10 +5,8 @@ minetest.register_craftitem("vl_fireworks:firework_star", { _doc_items_longdesc = S("A firework star is the key component of a firework rocket which is responsible for the visible explosion."), wield_image = "vl_fireworks_star.png", inventory_image = "vl_fireworks_star.png", - groups = { craftitem = 1 }, + groups = { craftitem = 1, _vl_fireworks_star = 1 }, stack_max = 64, - - _vl_fireworks_star = true }) function vl_fireworks.star_tt(effect) @@ -17,7 +15,7 @@ function vl_fireworks.star_tt(effect) s = S("Generic Firework Star") end if effect.size then - s = s .. "\nSize: " .. effect.size + s = s .. "\n" .. S("Size:") .. " " .. effect.size end return s:trim() end