From dd1f8cb59ca8054e5871730b756cc40192f77fd9 Mon Sep 17 00:00:00 2001 From: Elias Fleckenstein Date: Wed, 25 May 2022 14:57:59 +0200 Subject: [PATCH] Remove enderman gameconfig --- mods/ENTITIES/mobs_mc/0_gameconfig.lua | 60 +----------------- mods/ENTITIES/mobs_mc/enderman.lua | 43 ++++++++++--- .../mobs_mc_enderman_cactus_background.png} | Bin mods/ENTITIES/mobs_mc_gameconfig/init.lua | 34 ---------- 4 files changed, 36 insertions(+), 101 deletions(-) rename mods/ENTITIES/{mobs_mc_gameconfig/textures/mobs_mc_gameconfig_enderman_cactus_background.png => mobs_mc/textures/mobs_mc_enderman_cactus_background.png} (100%) diff --git a/mods/ENTITIES/mobs_mc/0_gameconfig.lua b/mods/ENTITIES/mobs_mc/0_gameconfig.lua index c36b88475..6fd0894aa 100644 --- a/mods/ENTITIES/mobs_mc/0_gameconfig.lua +++ b/mods/ENTITIES/mobs_mc/0_gameconfig.lua @@ -215,55 +215,6 @@ mobs_mc.replace = { }, } --- List of nodes which endermen can take -mobs_mc.enderman_takable = { - -- Generic handling, useful for entensions - "group:enderman_takable", - - -- Generic nodes - "group:sand", - "group:flower", - - -- Minetest Game - "default:dirt", - "default:dirt_with_grass", - "default:dirt_with_dry_grass", - "default:dirt_with_snow", - "default:dirt_with_rainforest_litter", - "default:dirt_with_grass_footsteps", --- FIXME: For some reason, Minetest has a Lua error when an enderman tries to place a Minetest Game cactus. --- Maybe this is because default:cactus has rotate_and_place? --- "default:cactus", -- TODO: Re-enable cactus when it works again - "default:gravel", - "default:clay", - "flowers:mushroom_red", - "flowers:mushroom_brown", - "tnt:tnt", - - -- Nether mod - "nether:rack", -} - ---[[ Table of nodes to replace when an enderman takes it. -If the enderman takes an indexed node, it the enderman will get the item in the value. -Table indexes: Original node, taken by enderman. -Table values: The item which the enderman *actually* gets -Example: - mobs_mc.enderman_node_replace = { - ["default:dirt_with_dry_grass"] = "default_dirt_with_grass", - } --- This means, if the enderman takes a dirt with dry grass, he will get a dirt with grass --- on his hand instead. -]] -mobs_mc.enderman_replace_on_take = {} -- no replacements by default - --- A table which can be used to override block textures of blocks carried by endermen. --- Only works for cube-shaped nodes and nodeboxes. --- Key: itemstrings of the blocks to replace --- Value: A table with the texture overrides (6 textures) -mobs_mc.enderman_block_texture_overrides = { -} - -- List of nodes on which mobs can spawn mobs_mc.spawn = { solid = { "group:cracky", "group:crumbly", "group:shovely", "group:pickaxey" }, -- spawn on "solid" nodes (this is mostly just guessing) @@ -312,6 +263,7 @@ mobs_mc.misc = { -- Item name overrides from mobs_mc_gameconfig (if present) if minetest.get_modpath("mobs_mc_gameconfig") and mobs_mc.override then local tables = {"items", "follow", "replace", "spawn", "spawn_height", "misc"} + for t=1, #tables do local tbl = tables[t] if mobs_mc.override[tbl] then @@ -320,15 +272,5 @@ if minetest.get_modpath("mobs_mc_gameconfig") and mobs_mc.override then end end end - - if mobs_mc.override.enderman_takable then - mobs_mc.enderman_takable = mobs_mc.override.enderman_takable - end - if mobs_mc.override.enderman_replace_on_take then - mobs_mc.enderman_replace_on_take = mobs_mc.override.enderman_replace_on_take - end - if mobs_mc.enderman_block_texture_overrides then - mobs_mc.enderman_block_texture_overrides = mobs_mc.override.enderman_block_texture_overrides - end end diff --git a/mods/ENTITIES/mobs_mc/enderman.lua b/mods/ENTITIES/mobs_mc/enderman.lua index 7e2dd3e30..e29f80f6a 100644 --- a/mods/ENTITIES/mobs_mc/enderman.lua +++ b/mods/ENTITIES/mobs_mc/enderman.lua @@ -48,6 +48,37 @@ local take_frequency_max = 245 local place_frequency_min = 235 local place_frequency_max = 245 + +-- Texuture overrides for enderman block. Required for cactus because it's original is a nodebox +-- and the textures have tranparent pixels. +local block_texture_overrides +do + local cbackground = "mobs_mc_enderman_cactus_background.png" + local ctiles = minetest.registered_nodes["mcl_core:cactus"].tiles + + local ctable = {} + local last + for i=1, 6 do + if ctiles[i] then + last = ctiles[i] + end + table.insert(ctable, cbackground .. "^" .. last) + end + + block_texture_overrides = { + ["mcl_core:cactus"] = ctable, + -- FIXME: replace colorize colors with colors from palette + ["mcl_core:dirt_with_grass"] = + { + "mcl_core_grass_block_top.png^[colorize:green:90", + "default_dirt.png", + "default_dirt.png^(mcl_core_grass_block_side_overlay.png^[colorize:green:90)", + "default_dirt.png^(mcl_core_grass_block_side_overlay.png^[colorize:green:90)", + "default_dirt.png^(mcl_core_grass_block_side_overlay.png^[colorize:green:90)", + "default_dirt.png^(mcl_core_grass_block_side_overlay.png^[colorize:green:90)"} + } +end + -- Create the textures table for the enderman, depending on which kind of block -- the enderman holds (if any). local create_enderman_textures = function(block_type, itemstring) @@ -69,9 +100,9 @@ local create_enderman_textures = function(block_type, itemstring) local tiles = minetest.registered_nodes[itemstring].tiles local textures = {} local last - if mobs_mc.enderman_block_texture_overrides[itemstring] then + if block_texture_overrides[itemstring] then -- Texture override available? Use these instead! - textures = mobs_mc.enderman_block_texture_overrides[itemstring] + textures = block_texture_overrides[itemstring] else -- Extract the texture names for i = 1, 6 do @@ -388,7 +419,7 @@ mcl_mobs:register_mob("mobs_mc:enderman", { self._take_place_timer = 0 self._next_take_place_time = math.random(place_frequency_min, place_frequency_max) local pos = self.object:get_pos() - local takable_nodes = minetest.find_nodes_in_area_under_air({x=pos.x-2, y=pos.y-1, z=pos.z-2}, {x=pos.x+2, y=pos.y+1, z=pos.z+2}, mobs_mc.enderman_takable) + local takable_nodes = minetest.find_nodes_in_area_under_air({x=pos.x-2, y=pos.y-1, z=pos.z-2}, {x=pos.x+2, y=pos.y+1, z=pos.z+2}, "group:enderman_takable") if #takable_nodes >= 1 then local r = pr:next(1, #takable_nodes) local take_pos = takable_nodes[r] @@ -398,11 +429,7 @@ mcl_mobs:register_mob("mobs_mc:enderman", { minetest.remove_node(take_pos) local dug = minetest.get_node_or_nil(take_pos) if dug and dug.name == "air" then - if mobs_mc.enderman_replace_on_take[node.name] then - self._taken_node = mobs_mc.enderman_replace_on_take[node.name] - else - self._taken_node = node.name - end + self._taken_node = node.name local def = minetest.registered_nodes[self._taken_node] -- Update animation and texture accordingly (adds visibly carried block) local block_type diff --git a/mods/ENTITIES/mobs_mc_gameconfig/textures/mobs_mc_gameconfig_enderman_cactus_background.png b/mods/ENTITIES/mobs_mc/textures/mobs_mc_enderman_cactus_background.png similarity index 100% rename from mods/ENTITIES/mobs_mc_gameconfig/textures/mobs_mc_gameconfig_enderman_cactus_background.png rename to mods/ENTITIES/mobs_mc/textures/mobs_mc_enderman_cactus_background.png diff --git a/mods/ENTITIES/mobs_mc_gameconfig/init.lua b/mods/ENTITIES/mobs_mc_gameconfig/init.lua index 06d7eb87f..576e0f454 100644 --- a/mods/ENTITIES/mobs_mc_gameconfig/init.lua +++ b/mods/ENTITIES/mobs_mc_gameconfig/init.lua @@ -172,44 +172,10 @@ mobs_mc.override.replace = { }, } --- List of nodes which endermen can take -mobs_mc.override.enderman_takable = { - -- Generic handling, useful for entensions - "group:enderman_takable", -} -mobs_mc.override.enderman_replace_on_take = { -} mobs_mc.override.misc = { totem_fail_nodes = { "mcl_core:void", "mcl_core:realm_barrier" }, } --- Texuture overrides for enderman block. Required for cactus because it's original is a nodebox --- and the textures have tranparent pixels. -local cbackground = "mobs_mc_gameconfig_enderman_cactus_background.png" -local ctiles = minetest.registered_nodes["mcl_core:cactus"].tiles - -local ctable = {} -local last -for i=1, 6 do - if ctiles[i] then - last = ctiles[i] - end - table.insert(ctable, cbackground .. "^" .. last) -end - -mobs_mc.override.enderman_block_texture_overrides = { - ["mcl_core:cactus"] = ctable, - -- FIXME: replace colorize colors with colors from palette - ["mcl_core:dirt_with_grass"] = - { - "mcl_core_grass_block_top.png^[colorize:green:90", - "default_dirt.png", - "default_dirt.png^(mcl_core_grass_block_side_overlay.png^[colorize:green:90)", - "default_dirt.png^(mcl_core_grass_block_side_overlay.png^[colorize:green:90)", - "default_dirt.png^(mcl_core_grass_block_side_overlay.png^[colorize:green:90)", - "default_dirt.png^(mcl_core_grass_block_side_overlay.png^[colorize:green:90)"} -} - -- List of nodes on which mobs can spawn mobs_mc.override.spawn = { solid = { "group:solid", }, -- spawn on "solid" nodes