From cb9bbb09895e9a170e07e7ede898c83fc03c20f3 Mon Sep 17 00:00:00 2001 From: tour Date: Sun, 7 Sep 2025 16:10:53 +0200 Subject: [PATCH] make some globals local --- nodes_doorlike.lua | 4 ++-- nodes_furniture.lua | 2 +- nodes_pitchfork.lua | 2 +- nodes_water.lua | 2 +- 4 files changed, 5 insertions(+), 5 deletions(-) diff --git a/nodes_doorlike.lua b/nodes_doorlike.lua index d989c05..469361f 100644 --- a/nodes_doorlike.lua +++ b/nodes_doorlike.lua @@ -17,7 +17,7 @@ local S = cottages.S ----------------------------------------------------------------------------------------------------------- -- propagate shutting/closing of window shutters to window shutters below/above this one -cottages_window_sutter_operate = function( pos, old_node_state_name, new_node_state_name ) +local cottages_window_sutter_operate = function( pos, old_node_state_name, new_node_state_name ) local offsets = {-1,1,-2,2,-3,3}; local stop_up = 0; @@ -298,7 +298,7 @@ minetest.register_node("cottages:gate_open", { -- hatches rotate around their axis -- old facedir: 0, 1, 2, 3, 4, 5, 6, 7, 8, 9,10,11,12,13,14,15,16,17,18,19,20,21,22,23 -new_facedirs = { 10,19, 4,13, 2,18,22,14,20,16, 0,12,11, 3, 7,21, 9,23, 5, 1, 8,15, 6,17}; +local new_facedirs = { 10,19, 4,13, 2,18,22,14,20,16, 0,12,11, 3, 7,21, 9,23, 5, 1, 8,15, 6,17}; cottages.register_hatch = function( nodename, description, texture, receipe_item ) diff --git a/nodes_furniture.lua b/nodes_furniture.lua index 424764c..8d3662a 100644 --- a/nodes_furniture.lua +++ b/nodes_furniture.lua @@ -509,7 +509,7 @@ cottages.sleep_in_bed = function( pos, node, clicker, itemstack, pointed_thing ) -- search for a second mat right next to this one local offset = {{x=0,z=-1}, {x=-1,z=0}, {x=0,z=1}, {x=1,z=0}}; for i,off in ipairs( offset ) do - node2 = minetest.get_node( {x=pos.x+off.x, y=pos.y, z=pos.z+off.z} ); + local node2 = minetest.get_node( {x=pos.x+off.x, y=pos.y, z=pos.z+off.z} ); if( node2.name == 'cottages:sleeping_mat' or node2.name=='cottages:straw_mat' or node.name=='cottages:sleeping_mat_head' ) then -- if a second mat is found, sleeping is possible allow_sleep = true; diff --git a/nodes_pitchfork.lua b/nodes_pitchfork.lua index 8e0cad9..5743ad1 100644 --- a/nodes_pitchfork.lua +++ b/nodes_pitchfork.lua @@ -8,7 +8,7 @@ local S = cottages.S local add_hay_group = {"farming:straw", "dryplants:reed", "darkage:straw_bale"} for i, v in ipairs(add_hay_group) do if( minetest.registered_items[v]) then - new_groups = minetest.registered_items[v].groups + local new_groups = minetest.registered_items[v].groups new_groups.hay = 3 minetest.override_item(v, {groups = new_groups}) end diff --git a/nodes_water.lua b/nodes_water.lua index 1984779..2bf99a8 100644 --- a/nodes_water.lua +++ b/nodes_water.lua @@ -87,7 +87,7 @@ cottages.water_gen_fill_bucket = function(pos) end -- abort if the water has not been running long enough -- (the player may have removed a bucket before it was full) - start = meta:get_string("fillstarttime") + local start = meta:get_string("fillstarttime") if( (minetest.get_us_time()/1000000) - tonumber(start) < cottages.water_fill_time -2) then return end