From 2298cd4a60dad1c1c31ae4c092346ec799141fc1 Mon Sep 17 00:00:00 2001 From: cora Date: Sat, 28 Oct 2023 01:50:42 +0200 Subject: [PATCH 1/5] Fix wrong usages of minetest.is_creative_enabled argument is the name, not the object --- api/api.lua | 4 ++-- api/behaviors.lua | 2 +- craftitems.lua | 2 +- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/api/api.lua b/api/api.lua index 956a130..1588c5c 100644 --- a/api/api.lua +++ b/api/api.lua @@ -1334,7 +1334,7 @@ draconis.dragon_api = { end local item, item_name = self:follow_wielded_item(player) if item_name then - if not minetest.is_creative_enabled(player) then + if not minetest.is_creative_enabled(player:get_player_name()) then item:take_item() player:set_wielded_item(item) end @@ -1514,7 +1514,7 @@ draconis.wyvern_api = { end local item, item_name = self:follow_wielded_item(player) if item_name then - if not minetest.is_creative_enabled(player) then + if not minetest.is_creative_enabled(player:get_player_name()) then item:take_item() player:set_wielded_item(item) end diff --git a/api/behaviors.lua b/api/behaviors.lua index 8493603..28d29f8 100644 --- a/api/behaviors.lua +++ b/api/behaviors.lua @@ -139,7 +139,7 @@ local function find_target(self, list) local targets = creatura.get_nearby_players(self) if #targets > 0 then -- If there are players nearby local target = targets[random(#targets)] - local is_creative = target:is_player() and minetest.is_creative_enabled(target) + local is_creative = target:is_player() and minetest.is_creative_enabled(target:get_player_name()) local is_owner = owner and target == owner if is_creative or is_owner then targets = {} end end diff --git a/craftitems.lua b/craftitems.lua index 41c1dbe..d1c56fd 100644 --- a/craftitems.lua +++ b/craftitems.lua @@ -108,7 +108,7 @@ minetest.register_craftitem("draconis:draconic_steel_ingot_ice", { ---------- local function egg_rightclick(self, clicker, item) - if not minetest.is_creative_enabled(clicker) then + if not minetest.is_creative_enabled(clicker:is_player() and clicker:get_player_name() or "") then local inv = clicker:get_inventory() if inv:room_for_item("main", {name = item}) then clicker:get_inventory():add_item("main", item) From 543053441ec18304d5965942fb75907f3e26852a Mon Sep 17 00:00:00 2001 From: cora Date: Sat, 28 Oct 2023 01:53:41 +0200 Subject: [PATCH 2/5] Fix premature access of "steel_ingot" variable --- mod.conf | 2 +- nodes.lua | 7 +++---- 2 files changed, 4 insertions(+), 5 deletions(-) diff --git a/mod.conf b/mod.conf index 14bd318..9134a71 100644 --- a/mod.conf +++ b/mod.conf @@ -1,6 +1,6 @@ name = draconis depends = creatura -optional_depends = default, mcl_player, stairs, 3d_armor +optional_depends = default, mcl_player, stairs, 3d_armor, mcl_core description = Adds advanced Dragons and powerful equipment title = Draconis diff --git a/nodes.lua b/nodes.lua index e9f06fe..a1d2d1d 100644 --- a/nodes.lua +++ b/nodes.lua @@ -9,12 +9,13 @@ local random = math.random -- Get Craft Items -- local steel_ingot = "default:steel_ingot" - +local stack_size = 99 minetest.register_on_mods_loaded(function() - for name in pairs(minetest.registered_items) do + for name, def in pairs(minetest.registered_items) do if name:match(":steel_ingot") or name:match(":ingot_steel") or name:match(":iron_ingot") or name:match(":ingot_iron") then steel_ingot = name + stack_size = def.stack_max or stack_size break end end @@ -251,8 +252,6 @@ register_node("draconis:bone_pile_frozen", { -- Draconic Steel Forge -- -------------------------- -local stack_size = minetest.registered_items[steel_ingot].stack_max or 99 - local forge_core = { ["draconis:draconic_forge_fire"] = "draconis:dragonstone_block_fire", ["draconis:draconic_forge_ice"] = "draconis:dragonstone_block_ice" From 36dcb35df61d7e7cc4d9e87b7d78e8f1810aec52 Mon Sep 17 00:00:00 2001 From: cora Date: Sat, 28 Oct 2023 02:18:00 +0200 Subject: [PATCH 3/5] Add mcl* node sound functions --- init.lua | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/init.lua b/init.lua index 34fcb10..5376b37 100644 --- a/init.lua +++ b/init.lua @@ -25,15 +25,23 @@ draconis.sounds = { dirt = {} } +draconis.has_mcl = minetest.get_modpath("mcl_core") + if minetest.get_modpath("default") then if default.node_sound_wood_defaults then draconis.sounds.wood = default.node_sound_wood_defaults() + elseif draconis.has_mcl then + draconis.sounds.wood = mcl_sounds.node_sound_wood_defaults() end if default.node_sound_stone_defaults then draconis.sounds.stone = default.node_sound_stone_defaults() + elseif draconis.has_mcl then + draconis.sounds.stone = mcl_sounds.node_sound_stone_defaults() end if default.node_sound_dirt_defaults then draconis.sounds.dirt = default.node_sound_dirt_defaults() + elseif draconis.has_mcl then + draconis.sounds.dirt = mcl_sounds.node_sound_dirt_defaults() end end From 841bd34cc024e2d11c9405ee79ce21118cf4be0d Mon Sep 17 00:00:00 2001 From: cora Date: Sat, 28 Oct 2023 02:18:27 +0200 Subject: [PATCH 4/5] Add mcl* node names --- init.lua | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/init.lua b/init.lua index 5376b37..f9088dd 100644 --- a/init.lua +++ b/init.lua @@ -63,9 +63,9 @@ draconis.colors_ice = { draconis.global_nodes = {} -draconis.global_nodes["flame"] = "fire:basic_flame" -draconis.global_nodes["ice"] = "default:ice" -draconis.global_nodes["steel_blockj"] = "default:steelblock" +draconis.global_nodes["flame"] = draconis.has_mcl and "mcl_fire:fire" or "fire:basic_flame" +draconis.global_nodes["ice"] = draconis.has_mcl and "mcl_core:ice" or "default:ice" +draconis.global_nodes["steel_blockj"] = draconis.has_mcl and "mcl_core:ironblock" or "default:steelblock" minetest.register_on_mods_loaded(function() for name, def in pairs(minetest.registered_nodes) do From 5db8c224185a8d6e973377d534ef0d24c6ae80d6 Mon Sep 17 00:00:00 2001 From: cora Date: Sat, 28 Oct 2023 02:21:44 +0200 Subject: [PATCH 5/5] Add default values for when self.turn_rate is nil --- api/behaviors.lua | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/api/behaviors.lua b/api/behaviors.lua index 28d29f8..c8a65c5 100644 --- a/api/behaviors.lua +++ b/api/behaviors.lua @@ -155,7 +155,7 @@ creatura.register_movement_method("draconis:fly_pathfind", function(self) local steer_to local steer_timer = 0.01 local width = self.width - local wayp_threshold = width + (width / self.turn_rate) + local wayp_threshold = width + (width / self.turn_rate or 6) self:set_gravity(0) local function func(_self, goal, speed_x) @@ -196,7 +196,7 @@ creatura.register_movement_method("draconis:fly_simple", function(self) local steer_to local steer_timer = 0.25 local width = self.width - local wayp_threshold = width + (width / self.turn_rate) + local wayp_threshold = width + (width / (self.turn_rate or 6)) self:set_gravity(0) local function func(_self, goal, speed_factor) @@ -216,7 +216,7 @@ creatura.register_movement_method("draconis:fly_simple", function(self) local dir = (steer_to or vec_dir(pos, goal)) _self:set_forward_velocity(speed) _self:set_vertical_velocity(speed * dir.y) - _self:tilt_to(dir2yaw(dir), turn_rate) + _self:tilt_to(dir2yaw(dir), turn_rate or 6) end return func end)