From a05a52c217aa315b084380e94794b21d8d1f0bff Mon Sep 17 00:00:00 2001 From: James David Clarke Date: Mon, 15 Jan 2024 03:19:08 +0000 Subject: [PATCH] Added more entity's properties into initial_properties table. --- mods/ENTITIES/mobs_mc/enderman.lua | 12 ++++---- mods/ENTITIES/mobs_mc/spider.lua | 14 ++++++---- mods/ENVIRONMENT/mcl_raids/init.lua | 2 +- mods/ITEMS/mcl_banners/init.lua | 19 +++++++------ mods/ITEMS/mcl_bows/arrow.lua | 18 ++++++------ mods/ITEMS/mcl_end/eye_of_ender.lua | 13 +++++---- mods/ITEMS/mcl_fishing/init.lua | 30 +++++++++++--------- mods/ITEMS/mcl_signs/init.lua | 2 ++ mods/ITEMS/mcl_signs/signs_api.lua | 30 ++++++++++---------- mods/ITEMS/mcl_throwing/register.lua | 42 ++++++++++++++++------------ mods/ITEMS/mcl_tnt/init.lua | 34 +++++++++++----------- 11 files changed, 120 insertions(+), 96 deletions(-) diff --git a/mods/ENTITIES/mobs_mc/enderman.lua b/mods/ENTITIES/mobs_mc/enderman.lua index d2f3f78f8..022edd196 100644 --- a/mods/ENTITIES/mobs_mc/enderman.lua +++ b/mods/ENTITIES/mobs_mc/enderman.lua @@ -31,11 +31,13 @@ local place_frequency_min = 235 local place_frequency_max = 245 minetest.register_entity("mobs_mc:ender_eyes", { - visual = "mesh", - mesh = "mobs_mc_spider.b3d", - visual_size = {x=1.01/3, y=1.01/3}, - textures = { - "mobs_mc_enderman_eyes.png", + initial_properties = { + visual = "mesh", + mesh = "mobs_mc_spider.b3d", + visual_size = {x=1.01/3, y=1.01/3}, + textures = { + "mobs_mc_enderman_eyes.png", + }, }, on_step = function(self) if self and self.object then diff --git a/mods/ENTITIES/mobs_mc/spider.lua b/mods/ENTITIES/mobs_mc/spider.lua index 1889983cf..5aede54ab 100644 --- a/mods/ENTITIES/mobs_mc/spider.lua +++ b/mods/ENTITIES/mobs_mc/spider.lua @@ -12,12 +12,14 @@ local S = minetest.get_translator("mobs_mc") -- Spider by AspireMint (fishyWET (CC-BY-SA 3.0 license for texture) minetest.register_entity("mobs_mc:spider_eyes", { - pointable = false, - visual = "mesh", - mesh = "mobs_mc_spider.b3d", - visual_size = {x=1.01/3, y=1.01/3}, - textures = { - "mobs_mc_spider_eyes.png", + initial_properties = { + pointable = false, + visual = "mesh", + mesh = "mobs_mc_spider.b3d", + visual_size = {x=1.01/3, y=1.01/3}, + textures = { + "mobs_mc_spider_eyes.png", + }, }, on_step = function(self) if self and self.object then diff --git a/mods/ENVIRONMENT/mcl_raids/init.lua b/mods/ENVIRONMENT/mcl_raids/init.lua index 8e7c644ae..32578e699 100644 --- a/mods/ENVIRONMENT/mcl_raids/init.lua +++ b/mods/ENVIRONMENT/mcl_raids/init.lua @@ -72,7 +72,7 @@ local oban_layers = { local oban_def = table.copy(minetest.registered_entities["mcl_banners:standing_banner"]) -oban_def.visual_size = { x=1, y=1 } +oban_def.initial_properties.visual_size = { x=1, y=1 } local old_step = oban_def.on_step oban_def.on_step = function(self,dtime) if not self.object:get_attach() then return self.object:remove() end diff --git a/mods/ITEMS/mcl_banners/init.lua b/mods/ITEMS/mcl_banners/init.lua index 8c2c1298c..5f896053d 100644 --- a/mods/ITEMS/mcl_banners/init.lua +++ b/mods/ITEMS/mcl_banners/init.lua @@ -613,13 +613,15 @@ end -- Banner entities. local entity_standing = { - physical = false, - collide_with_objects = false, - visual = "mesh", - mesh = "amc_banner.b3d", - visual_size = { x=2.499, y=2.499 }, - textures = {mcl_banners.make_banner_texture()}, - pointable = false, + initial_properties = { + physical = false, + collide_with_objects = false, + visual = "mesh", + mesh = "amc_banner.b3d", + visual_size = { x=2.499, y=2.499 }, + textures = {mcl_banners.make_banner_texture()}, + pointable = false, + }, _base_color = nil, -- base color of banner _layers = nil, -- table of layers painted over the base color. @@ -663,7 +665,7 @@ local entity_standing = { minetest.register_entity("mcl_banners:standing_banner", entity_standing) local entity_hanging = table.copy(entity_standing) -entity_hanging.mesh = "amc_banner_hanging.b3d" +entity_hanging.initial_properties.mesh = "amc_banner_hanging.b3d" minetest.register_entity("mcl_banners:hanging_banner", entity_hanging) -- FIXME: Prevent entity destruction by /clearobjects @@ -682,4 +684,3 @@ minetest.register_craft({ recipe = "group:banner", burntime = 15, }) - diff --git a/mods/ITEMS/mcl_bows/arrow.lua b/mods/ITEMS/mcl_bows/arrow.lua index 37e41fa6d..c8995c8e0 100644 --- a/mods/ITEMS/mcl_bows/arrow.lua +++ b/mods/ITEMS/mcl_bows/arrow.lua @@ -57,14 +57,16 @@ S("Arrows might get stuck on solid blocks and can be retrieved again. They are a }) local ARROW_ENTITY={ - physical = true, - pointable = false, - visual = "mesh", - mesh = "mcl_bows_arrow.obj", - visual_size = {x=-1, y=1}, - textures = {"mcl_bows_arrow.png"}, - collisionbox = {-0.19, -0.125, -0.19, 0.19, 0.125, 0.19}, - collide_with_objects = false, + initial_properties = { + physical = true, + pointable = false, + visual = "mesh", + mesh = "mcl_bows_arrow.obj", + visual_size = {x=-1, y=1}, + textures = {"mcl_bows_arrow.png"}, + collisionbox = {-0.19, -0.125, -0.19, 0.19, 0.125, 0.19}, + collide_with_objects = false, + }, _fire_damage_resistant = true, _lastpos={}, diff --git a/mods/ITEMS/mcl_end/eye_of_ender.lua b/mods/ITEMS/mcl_end/eye_of_ender.lua index b5adc7cb6..5d51589e7 100644 --- a/mods/ITEMS/mcl_end/eye_of_ender.lua +++ b/mods/ITEMS/mcl_end/eye_of_ender.lua @@ -2,12 +2,13 @@ local S = minetest.get_translator(minetest.get_current_modname()) minetest.register_entity("mcl_end:ender_eye", { - physical = false, - textures = {"mcl_end_ender_eye.png"}, - visual_size = {x=1.5, y=1.5}, - collisionbox = {0,0,0,0,0,0}, - pointable = false, - + initial_properties = { + physical = false, + textures = {"mcl_end_ender_eye.png"}, + visual_size = {x=1.5, y=1.5}, + collisionbox = {0,0,0,0,0,0}, + pointable = false, + }, -- Save and restore age get_staticdata = function(self) return tostring(self._age) diff --git a/mods/ITEMS/mcl_fishing/init.lua b/mods/ITEMS/mcl_fishing/init.lua index 4638325bd..a9ad616eb 100644 --- a/mods/ITEMS/mcl_fishing/init.lua +++ b/mods/ITEMS/mcl_fishing/init.lua @@ -3,13 +3,15 @@ local S = minetest.get_translator(minetest.get_current_modname()) local bobber_ENTITY={ - physical = false, - timer=0, - textures = {"mcl_fishing_bobber.png"}, - visual_size = {x=0.5, y=0.5}, - collisionbox = {0.45,0.45,0.45,0.45,0.45,0.45}, - pointable = false, - static_save = false, + initial_properties = { + physical = false, + timer=0, + textures = {"mcl_fishing_bobber.png"}, + visual_size = {x=0.5, y=0.5}, + collisionbox = {0.45,0.45,0.45,0.45,0.45,0.45}, + pointable = false, + static_save = false, + }, _lastpos={}, _dive = false, @@ -308,12 +310,14 @@ bobber_ENTITY.on_step = bobber_on_step minetest.register_entity("mcl_fishing:bobber_entity", bobber_ENTITY) local flying_bobber_ENTITY={ - physical = false, - timer=0, - textures = {"mcl_fishing_bobber.png"}, --FIXME: Replace with correct texture. - visual_size = {x=0.5, y=0.5}, - collisionbox = {0,0,0,0,0,0}, - pointable = false, + initial_properties = { + physical = false, + timer=0, + textures = {"mcl_fishing_bobber.png"}, --FIXME: Replace with correct texture. + visual_size = {x=0.5, y=0.5}, + collisionbox = {0,0,0,0,0,0}, + pointable = false, + }, get_staticdata = mcl_throwing.get_staticdata, on_activate = mcl_throwing.on_activate, diff --git a/mods/ITEMS/mcl_signs/init.lua b/mods/ITEMS/mcl_signs/init.lua index 117f5665c..2f6c6dbfc 100644 --- a/mods/ITEMS/mcl_signs/init.lua +++ b/mods/ITEMS/mcl_signs/init.lua @@ -28,11 +28,13 @@ end) -- This defines the text entity for the lettering of the sign. -- FIXME: Prevent entity destruction by /clearobjects minetest.register_entity("mcl_signs:text", { + initial_properties = { pointable = false, visual = "upright_sprite", textures = {}, physical = false, collide_with_objects = false, + }, _signnodename = nil, -- node name of sign node to which the text belongs diff --git a/mods/ITEMS/mcl_signs/signs_api.lua b/mods/ITEMS/mcl_signs/signs_api.lua index 2c0908124..0f35c0341 100644 --- a/mods/ITEMS/mcl_signs/signs_api.lua +++ b/mods/ITEMS/mcl_signs/signs_api.lua @@ -362,20 +362,22 @@ mcl_signs.wall_standard = { } -- standing sign base (definition) mcl_signs.standing_standard = { - paramtype = "light", - use_texture_alpha = minetest.features.use_texture_alpha_string_modes and "opaque" or false, - sunlight_propagates = true, - walkable = false, - is_ground_content = false, - paramtype2 = "facedir", - drawtype = "mesh", - mesh = "mcl_signs_sign.obj", - selection_box = { type = "fixed", fixed = { -0.2, -0.5, -0.2, 0.2, 0.5, 0.2 } }, - tiles = { "mcl_signs_sign.png" }, - groups = mcl_signs.sign_groups, - drop = "mcl_signs:wall_sign", - stack_max = 16, - sounds = node_sounds, + initial_properties = { + paramtype = "light", + use_texture_alpha = minetest.features.use_texture_alpha_string_modes and "opaque" or false, + sunlight_propagates = true, + walkable = false, + is_ground_content = false, + paramtype2 = "facedir", + drawtype = "mesh", + mesh = "mcl_signs_sign.obj", + selection_box = { type = "fixed", fixed = { -0.2, -0.5, -0.2, 0.2, 0.5, 0.2 } }, + tiles = { "mcl_signs_sign.png" }, + groups = mcl_signs.sign_groups, + drop = "mcl_signs:wall_sign", + stack_max = 16, + sounds = node_sounds, + }, on_destruct = function(pos) mcl_signs:destruct_sign(pos) diff --git a/mods/ITEMS/mcl_throwing/register.lua b/mods/ITEMS/mcl_throwing/register.lua index 43dedd33b..e3f8b6776 100644 --- a/mods/ITEMS/mcl_throwing/register.lua +++ b/mods/ITEMS/mcl_throwing/register.lua @@ -7,12 +7,14 @@ local mod_target = minetest.get_modpath("mcl_target") -- The snowball entity local snowball_ENTITY={ - physical = false, - timer=0, - textures = {"mcl_throwing_snowball.png"}, - visual_size = {x=0.5, y=0.5}, - collisionbox = {0,0,0,0,0,0}, - pointable = false, + initial_properties = { + physical = false, + timer=0, + textures = {"mcl_throwing_snowball.png"}, + visual_size = {x=0.5, y=0.5}, + collisionbox = {0,0,0,0,0,0}, + pointable = false, + }, get_staticdata = mcl_throwing.get_staticdata, on_activate = mcl_throwing.on_activate, @@ -22,12 +24,14 @@ local snowball_ENTITY={ } local egg_ENTITY={ - physical = false, - timer=0, - textures = {"mcl_throwing_egg.png"}, - visual_size = {x=0.45, y=0.45}, - collisionbox = {0,0,0,0,0,0}, - pointable = false, + initial_properties = { + physical = false, + timer=0, + textures = {"mcl_throwing_egg.png"}, + visual_size = {x=0.45, y=0.45}, + collisionbox = {0,0,0,0,0,0}, + pointable = false, + }, get_staticdata = mcl_throwing.get_staticdata, on_activate = mcl_throwing.on_activate, @@ -38,12 +42,14 @@ local egg_ENTITY={ -- Ender pearl entity local pearl_ENTITY={ - physical = false, - timer=0, - textures = {"mcl_throwing_ender_pearl.png"}, - visual_size = {x=0.9, y=0.9}, - collisionbox = {0,0,0,0,0,0}, - pointable = false, + initial_properties = { + physical = false, + timer=0, + textures = {"mcl_throwing_ender_pearl.png"}, + visual_size = {x=0.9, y=0.9}, + collisionbox = {0,0,0,0,0,0}, + pointable = false, + }, get_staticdata = mcl_throwing.get_staticdata, on_activate = mcl_throwing.on_activate, diff --git a/mods/ITEMS/mcl_tnt/init.lua b/mods/ITEMS/mcl_tnt/init.lua index 4d7be3125..decb0635b 100644 --- a/mods/ITEMS/mcl_tnt/init.lua +++ b/mods/ITEMS/mcl_tnt/init.lua @@ -115,23 +115,25 @@ minetest.register_node("mcl_tnt:tnt", { local TNT = { -- Static definition - physical = true, -- Collides with things - --weight = -100, - collisionbox = { -0.5, -0.5, -0.5, 0.5, 0.5, 0.5 }, - visual = "cube", - textures = { - "default_tnt_top.png", - "default_tnt_bottom.png", - "default_tnt_side.png", - "default_tnt_side.png", - "default_tnt_side.png", - "default_tnt_side.png", + initial_properties = { + physical = true, -- Collides with things + --weight = -100, + collisionbox = { -0.5, -0.5, -0.5, 0.5, 0.5, 0.5 }, + visual = "cube", + textures = { + "default_tnt_top.png", + "default_tnt_bottom.png", + "default_tnt_side.png", + "default_tnt_side.png", + "default_tnt_side.png", + "default_tnt_side.png", + }, + -- Initial value for our timer + timer = 0, + blinktimer = 0, + tnt_knockback = true, + blinkstatus = true, }, - -- Initial value for our timer - timer = 0, - blinktimer = 0, - tnt_knockback = true, - blinkstatus = true, } function TNT:on_activate(_, _)