From 1de57191b0afa4df320c4319de0d7ea6b33d2b27 Mon Sep 17 00:00:00 2001 From: FaceDeer Date: Fri, 17 Nov 2017 18:49:43 -0700 Subject: [PATCH] configurable duration for crate markers --- config.lua | 6 +++++- entities.lua | 4 ++-- settingtypes.txt | 5 ++++- util_item_place_node.lua | 4 ++-- 4 files changed, 13 insertions(+), 6 deletions(-) diff --git a/config.lua b/config.lua index 8ab432f..79cc42d 100644 --- a/config.lua +++ b/config.lua @@ -56,4 +56,8 @@ setting("float", "build_cost", 1.0, "Build cost") -- How much charge (an RE battery holds 10000 EU) is equivalent to 1 unit of heat produced by burning coal -- With 100, the battery is 2.5 better than a coal lump, yet 3.7 less powerful than a coal block -- Being rechargeable should pay off for this "average" performance. -setting("int", "power_ratio", 100, "The electrical charge to 1 coal heat unit conversion ratio") \ No newline at end of file +setting("int", "power_ratio", 100, "The electrical charge to 1 coal heat unit conversion ratio") + + +setting("float", "marker_crate_good_duration", 3.0, "Duration that 'good' crate markers last") +setting("float", "marker_crate_bad_duration", 9.0, "Duration that 'bad' crate markers last") diff --git a/entities.lua b/entities.lua index cafe962..1a95cf6 100644 --- a/entities.lua +++ b/entities.lua @@ -60,7 +60,7 @@ minetest.register_entity("digtron:marker_crate_good", { }, on_activate = function(self, staticdata) - minetest.after(5.0, + minetest.after(digtron.config.marker_crate_good_duration, function(self) self.object:remove() end, @@ -86,7 +86,7 @@ minetest.register_entity("digtron:marker_crate_bad", { }, on_activate = function(self, staticdata) - minetest.after(5.0, + minetest.after(digtron.config.marker_crate_bad_duration, function(self) self.object:remove() end, diff --git a/settingtypes.txt b/settingtypes.txt index ed731ba..6deee8b 100644 --- a/settingtypes.txt +++ b/settingtypes.txt @@ -20,6 +20,9 @@ digtron_traction_factor (Digtron traction factor) float 3.0 0.0 1000.0 #The maximum extrusion setting permitted for a Digtron builder module. digtron_maximum_extrusion (Digtron maximum extrusion) int 25 1 100 +digtron_marker_crate_good_duration (Duration that 'good' crate markers last) float 3.0 0.0 100.0 +digtron_marker_crate_bad_duration (Duration that 'bad' crate markers last) float 9.0 0.0 100.0 + [Fuel costs] #eg, stone. @@ -40,4 +43,4 @@ digtron_build_cost (Fuel cost to build one block) float 1.0 0.0 100.0 #If the [technic] mod is installed Digtron can draw power from technic batteries. #A full battery holds 10000 electrical units. This is divided by the power ratio #setting to convert it into fuel units. -digtron_power_ratio (Electrical charge to coal heat conversion ratio) int 1 1000 100 \ No newline at end of file +digtron_power_ratio (Electrical charge to coal heat conversion ratio) int 1 1000 100 diff --git a/util_item_place_node.lua b/util_item_place_node.lua index 3ff580d..ab78526 100644 --- a/util_item_place_node.lua +++ b/util_item_place_node.lua @@ -114,8 +114,8 @@ digtron.item_place_node = function(itemstack, placer, place_to, param2) if minetest.registered_nodes[item_name] == nil then -- Permitted craft items are handled by the node-specific on_place call, above. -- if we are a craft item and we get here then we're not whitelisted and we should fail. - -- Note that builders should be filtering out craft items like this, but this will protect us - -- just in case. + -- Note that builder settings should be filtering out craft items like this before we get here, + -- but this will protect us just in case. return itemstack, false end