Move configuration to in-game settings

This commit is contained in:
2025-04-29 10:14:20 +02:00
parent 63960f3de1
commit 9b57098fca
17 changed files with 36 additions and 28 deletions

View File

@@ -66,7 +66,7 @@ function industrialtest.ActivatedMachine.activate(self,pos)
param2=minetest.get_node(pos).param2
})
self:afterActivation(pos)
minetest.get_node_timer(pos):start(industrialtest.updateDelay)
minetest.get_node_timer(pos):start(industrialtest.config.updateDelay)
end
function industrialtest.ActivatedMachine.deactivate(self,pos)
@@ -75,7 +75,7 @@ function industrialtest.ActivatedMachine.deactivate(self,pos)
param2=minetest.get_node(pos).param2
})
self:afterDeactivation(pos)
minetest.get_node_timer(pos):start(industrialtest.updateDelay)
minetest.get_node_timer(pos):start(industrialtest.config.updateDelay)
end
function industrialtest.ActivatedMachine.shouldActivate(self,pos)

View File

@@ -140,7 +140,7 @@ function industrialtest.CanningMachine.allowMetadataInventoryTake(self,pos,listn
local targetSlot=inv:get_stack("dst",1)
if ((listname=="src" and stack:get_count()==fuelSlot:get_count()) or (listname=="dst" and stack:get_count()==targetSlot:get_count())) and meta:get_float("srcTime")>0 then
meta:set_float("srcTime",0)
minetest.get_node_timer(pos):start(industrialtest.updateDelay)
self:updateFormspec(pos)
end
return industrialtest.ActivatedElectricMachine.allowMetadataInventoryTake(self,pos,listname,index,stack,player)
end
@@ -153,12 +153,12 @@ function industrialtest.CanningMachine.onMetadataInventoryMove(self,pos,fromList
local targetSlot=inv:get_stack("dst",1)
if ((fromList=="src" and count==fuelSlot:get_count()) or (fromList=="dst" and count==targetSlot:get_count())) and meta:get_float("srcTime")>0 then
meta:set_float("srcTime",0)
meta:set_string("formspec",canningMachine.getFormspec(pos))
self:updateFormspec(pos)
end
end
function industrialtest.CanningMachine.onMetadataInventoryPut(self,pos,listname,index,stack)
minetest.get_node_timer(pos):start(industrialtest.updateDelay)
self:triggerIfNeeded(pos)
industrialtest.ActivatedElectricMachine.onMetadataInventoryPut(self,pos,listname,index,stack)
end

View File

@@ -291,7 +291,7 @@ industrialtest.MFSUChargepad:register()
minetest.register_abm({
label="Chargepad updating",
nodenames=industrialtest.internal.chargepads,
interval=industrialtest.updateDelay,
interval=industrialtest.config.updateDelay,
chance=1,
action=function(pos,node)
local def=minetest.registered_nodes[node.name]

View File

@@ -32,7 +32,7 @@ function industrialtest.ElectricMachine.onConstruct(self,pos)
def._industrialtest_self:flowPower(conn)
else
-- Support for bare definitions that don't use industrialtest pseudo-OOP
minetest.get_node_timer(conn):start(industrialtest.updateDelay)
minetest.get_node_timer(conn):start(industrialtest.config.updateDelay)
end
else
local def=minetest.registered_nodes[minetest.get_node(conn).name]
@@ -46,7 +46,7 @@ function industrialtest.ElectricMachine.onConstruct(self,pos)
def._industrialtest_self:flowPower(network)
else
-- Support for bare definitions that don't use industrialtest pseudo-OOP
minetest.get_node_timer(network):start(industrialtest.updateDelay)
minetest.get_node_timer(network):start(industrialtest.config.updateDelay)
end
end
end
@@ -177,7 +177,7 @@ function industrialtest.ElectricMachine.requestPower(self,pos)
def._industrialtest_self:flowPower(network)
else
-- Support for bare definitions that don't use industrialtest pseudo-OOP
minetest.get_node_timer(network):start(industrialtest.updateDelay)
minetest.get_node_timer(network):start(industrialtest.config.updateDelay)
end
end
end

View File

@@ -366,7 +366,7 @@ minetest.register_abm({
label="Water Mill generating",
nodenames={"industrialtest:water_mill"},
neighbors=neighbors,
interval=industrialtest.updateDelay,
interval=industrialtest.config.updateDelay,
chance=1,
action=function(pos)
industrialtest.WaterMill:action(pos)

View File

@@ -19,7 +19,7 @@ industrialtest.Generator=table.copy(industrialtest.ActivatedElectricMachine)
industrialtest.internal.unpackTableInto(industrialtest.Generator,{
name="industrialtest:generator",
description=S("Generator"),
tiles={
tiles={
"industrialtest_machine_block.png",
"industrialtest_machine_block.png",
"industrialtest_machine_block.png",
@@ -85,7 +85,7 @@ function industrialtest.Generator.getFormspec(self,pos)
end
function industrialtest.Generator.onMetadataInventoryPut(self,pos,listname,index,stack)
minetest.get_node_timer(pos):start(industrialtest.updateDelay)
self:triggerIfNeeded(pos)
industrialtest.ActivatedElectricMachine.onMetadataInventoryPut(self,pos,listname,index,stack)
end

View File

@@ -131,7 +131,7 @@ function industrialtest.IronFurnace.allowMetadataInventoryTake(self,pos,listname
self:updateFormspec(pos)
end
elseif listname=="dst" and dstSlot:get_free_space()==0 then
minetest.get_node_timer(pos):start(industrialtest.updateDelay)
self:triggerIfNeeded(pos)
end
return industrialtest.ActivatedMachine.allowMetadataInventoryTake(self,pos,listname,index,stack)
end
@@ -148,13 +148,13 @@ function industrialtest.IronFurnace.onMetadataInventoryMove(self,pos,fromList,fr
self:updateFormspec(pos)
end
elseif fromList=="dst" and dstSlot:get_free_space()==0 then
minetest.get_node_timer(pos):start(industrialtest.updateDelay)
self:triggerIfNeeded(pos)
end
industrialtest.ActivatedMachine.onMetadataInventoryMove(self,pos,fromList,fromIndex,toList,toIndex,count)
end
function industrialtest.IronFurnace.onMetadataInventoryPut(self,pos,listname,index,stack)
minetest.get_node_timer(pos):start(industrialtest.updateDelay)
self:triggerIfNeeded(pos)
industrialtest.ActivatedMachine.onMetadataInventoryPut(self,pos,listname,index,stack)
end

View File

@@ -73,7 +73,7 @@ end
function industrialtest.Machine.trigger(self,pos)
local timer=minetest.get_node_timer(pos)
if not timer:is_started() then
timer:start(industrialtest.updateDelay)
timer:start(industrialtest.config.updateDelay)
end
end
@@ -259,7 +259,7 @@ function industrialtest.Machine.createDefinitionTable(self)
return inv, "src", mcl_util.select_stack(hop_inv, hop_list, inv, "src")
end
def._mcl_hoppers_on_after_push=function(pos)
minetest.get_node_timer(pos):start(industrialtest.updateDelay)
self:triggerIfNeeded(pos)
end
end

View File

@@ -193,7 +193,7 @@ minetest.register_craft({
minetest.register_abm({
name="Solar panel updating",
nodenames=solarPanels,
interval=industrialtest.updateDelay,
interval=industrialtest.config.updateDelay,
chance=1,
action=function(pos,node)
local def=minetest.registered_nodes[node.name]

View File

@@ -122,7 +122,7 @@ minetest.register_craft({
minetest.register_abm({
name="Wind mill updating",
nodenames={"industrialtest:wind_mill"},
interval=industrialtest.updateDelay,
interval=industrialtest.config.updateDelay,
chance=1,
action=function(pos)
industrialtest.WindMill:action(pos)