Compare commits
No commits in common. "371ef36ce303799e6491fab8b05bae4b9e888182" and "09a0d9c8552242aed0dfa0fc975fd2c213fbace7" have entirely different histories.
371ef36ce3
...
09a0d9c855
@ -16,26 +16,28 @@
|
|||||||
|
|
||||||
industrialtest.ActivatedElectricMachine=table.copy(industrialtest.ElectricMachine)
|
industrialtest.ActivatedElectricMachine=table.copy(industrialtest.ElectricMachine)
|
||||||
|
|
||||||
-- Forward methods from ActivatedMachine
|
|
||||||
industrialtest.internal.unpackTableInto(industrialtest.ActivatedElectricMachine,{
|
|
||||||
canUpdate=industrialtest.ActivatedMachine.canUpdate,
|
|
||||||
register=industrialtest.ActivatedMachine.register,
|
|
||||||
createDefinitionTable=industrialtest.ActivatedMachine.createDefinitionTable,
|
|
||||||
createActiveDefinitionTable=industrialtest.ActivatedMachine.createActiveDefinitionTable,
|
|
||||||
activate=industrialtest.ActivatedMachine.activate,
|
|
||||||
deactivate=industrialtest.ActivatedMachine.deactivate,
|
|
||||||
shouldActivate=industrialtest.ActivatedMachine.shouldActivate,
|
|
||||||
shouldDeactivate=industrialtest.ActivatedMachine.shouldDeactivate,
|
|
||||||
afterActivation=industrialtest.ActivatedMachine.afterActivation,
|
|
||||||
afterDeactivation=industrialtest.ActivatedMachine.afterDeactivation
|
|
||||||
})
|
|
||||||
|
|
||||||
function industrialtest.ActivatedElectricMachine.onTimer(self,pos,elapsed)
|
function industrialtest.ActivatedElectricMachine.onTimer(self,pos,elapsed)
|
||||||
local result=self:powerExchange(pos)
|
local result=self:powerExchange(pos)
|
||||||
local result2=industrialtest.ActivatedMachine.onTimer(self,pos,elapsed)
|
local result2=industrialtest.ActivatedMachine.onTimer(self,pos,elapsed)
|
||||||
return result or result2
|
return result or result2
|
||||||
end
|
end
|
||||||
|
|
||||||
|
industrialtest.ActivatedElectricMachine.canUpdate=industrialtest.ActivatedMachine.canUpdate
|
||||||
|
|
||||||
|
industrialtest.ActivatedElectricMachine.register=industrialtest.ActivatedMachine.register
|
||||||
|
|
||||||
|
industrialtest.ActivatedElectricMachine.createDefinitionTable=industrialtest.ActivatedMachine.createDefinitionTable
|
||||||
|
|
||||||
|
industrialtest.ActivatedElectricMachine.createActiveDefinitionTable=industrialtest.ActivatedMachine.createActiveDefinitionTable
|
||||||
|
|
||||||
|
industrialtest.ActivatedElectricMachine.shouldActivate=industrialtest.ActivatedMachine.shouldActivate
|
||||||
|
|
||||||
|
industrialtest.ActivatedElectricMachine.shouldDeactivate=industrialtest.ActivatedMachine.shouldDeactivate
|
||||||
|
|
||||||
|
industrialtest.ActivatedElectricMachine.afterActivation=industrialtest.ActivatedMachine.afterActivation
|
||||||
|
|
||||||
|
industrialtest.ActivatedElectricMachine.afterDeactivation=industrialtest.ActivatedMachine.afterDeactivation
|
||||||
|
|
||||||
function industrialtest.ActivatedElectricMachine.activeOnTimer(self,pos,elapsed)
|
function industrialtest.ActivatedElectricMachine.activeOnTimer(self,pos,elapsed)
|
||||||
local result=self:powerExchange(pos)
|
local result=self:powerExchange(pos)
|
||||||
local result2=industrialtest.ActivatedMachine.activeOnTimer(self,pos,elapsed)
|
local result2=industrialtest.ActivatedMachine.activeOnTimer(self,pos,elapsed)
|
||||||
|
@ -24,7 +24,12 @@ function industrialtest.ActivatedMachine.onTimer(self,pos,elapsed)
|
|||||||
local result=industrialtest.Machine.onTimer(self,pos,elapsed)
|
local result=industrialtest.Machine.onTimer(self,pos,elapsed)
|
||||||
|
|
||||||
if self:shouldActivate(pos) then
|
if self:shouldActivate(pos) then
|
||||||
self:activate(pos)
|
minetest.swap_node(pos,{
|
||||||
|
name=self.name.."_active",
|
||||||
|
param2=minetest.get_node(pos).param2
|
||||||
|
})
|
||||||
|
self:afterActivation(pos)
|
||||||
|
minetest.get_node_timer(pos):start(industrialtest.updateDelay)
|
||||||
return false
|
return false
|
||||||
end
|
end
|
||||||
|
|
||||||
@ -60,24 +65,6 @@ function industrialtest.ActivatedMachine.createActiveDefinitionTable(self)
|
|||||||
return def
|
return def
|
||||||
end
|
end
|
||||||
|
|
||||||
function industrialtest.ActivatedMachine.activate(self,pos)
|
|
||||||
minetest.swap_node(pos,{
|
|
||||||
name=self.name.."_active",
|
|
||||||
param2=minetest.get_node(pos).param2
|
|
||||||
})
|
|
||||||
self:afterActivation(pos)
|
|
||||||
minetest.get_node_timer(pos):start(industrialtest.updateDelay)
|
|
||||||
end
|
|
||||||
|
|
||||||
function industrialtest.ActivatedMachine.deactivate(self,pos)
|
|
||||||
minetest.swap_node(pos,{
|
|
||||||
name=self.name,
|
|
||||||
param2=minetest.get_node(pos).param2
|
|
||||||
})
|
|
||||||
self:afterDeactivation(pos)
|
|
||||||
minetest.get_node_timer(pos):start(industrialtest.updateDelay)
|
|
||||||
end
|
|
||||||
|
|
||||||
function industrialtest.ActivatedMachine.shouldActivate(self,pos)
|
function industrialtest.ActivatedMachine.shouldActivate(self,pos)
|
||||||
return false
|
return false
|
||||||
end
|
end
|
||||||
@ -99,7 +86,12 @@ function industrialtest.ActivatedMachine.activeOnTimer(self,pos,elapsed)
|
|||||||
local shouldUpdateFormspec=false
|
local shouldUpdateFormspec=false
|
||||||
|
|
||||||
if self:shouldDeactivate(pos) then
|
if self:shouldDeactivate(pos) then
|
||||||
self:deactivate(pos)
|
minetest.swap_node(pos,{
|
||||||
|
name=self.name,
|
||||||
|
param2=minetest.get_node(pos).param2
|
||||||
|
})
|
||||||
|
self:afterDeactivation(pos)
|
||||||
|
minetest.get_node_timer(pos):start(industrialtest.updateDelay)
|
||||||
return false
|
return false
|
||||||
end
|
end
|
||||||
|
|
||||||
|
@ -15,71 +15,11 @@
|
|||||||
-- along with this program. If not, see <http://www.gnu.org/licenses/>.
|
-- along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
|
||||||
local S=minetest.get_translator("industrialtest")
|
local S=minetest.get_translator("industrialtest")
|
||||||
|
|
||||||
|
local chargepad={}
|
||||||
industrialtest.internal.chargepads={}
|
industrialtest.internal.chargepads={}
|
||||||
industrialtest.Chargepad=table.copy(industrialtest.ActivatedElectricMachine)
|
|
||||||
industrialtest.internal.unpackTableInto(industrialtest.Chargepad,{
|
|
||||||
storageLists={
|
|
||||||
"charged",
|
|
||||||
"discharged"
|
|
||||||
},
|
|
||||||
powerLists={
|
|
||||||
{
|
|
||||||
list="charged",
|
|
||||||
direction="o"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
list="discharged",
|
|
||||||
direction="i"
|
|
||||||
}
|
|
||||||
},
|
|
||||||
facedir=true,
|
|
||||||
ioConfig="iiiioi",
|
|
||||||
hasPowerInput=true,
|
|
||||||
hasPowerOutput=true
|
|
||||||
})
|
|
||||||
|
|
||||||
function industrialtest.Chargepad.onConstruct(self,pos)
|
local function chargePlayer(meta,player,flow)
|
||||||
local meta=minetest.get_meta(pos)
|
|
||||||
local inv=meta:get_inventory()
|
|
||||||
inv:set_size("charged",1)
|
|
||||||
inv:set_size("discharged",1)
|
|
||||||
meta:set_int("active",0)
|
|
||||||
industrialtest.ActivatedElectricMachine.onConstruct(self,pos)
|
|
||||||
end
|
|
||||||
|
|
||||||
function industrialtest.Chargepad.getFormspec(self,pos)
|
|
||||||
local meta=minetest.get_meta(pos)
|
|
||||||
local parentFormspec=industrialtest.ActivatedElectricMachine.getFormspec(self,pos)
|
|
||||||
local charged=meta:get_int("industrialtest.powerAmount")/meta:get_int("industrialtest.powerCapacity")
|
|
||||||
local formspec={
|
|
||||||
"list[context;charged;1,2.5;1,1]",
|
|
||||||
industrialtest.internal.getItemSlotBg(1,2.5,1,1),
|
|
||||||
"label[0.9,3.9;"..S("Charge").."]",
|
|
||||||
"list[context;discharged;3,2.5;1,1]",
|
|
||||||
industrialtest.internal.getItemSlotBg(3,2.5,1,1),
|
|
||||||
"label[2.7,3.9;"..S("Discharge").."]",
|
|
||||||
self.createPowerIndicatorWidget(charged,9,1),
|
|
||||||
"listring[context;charged]",
|
|
||||||
"listring[context;discharged]"
|
|
||||||
}
|
|
||||||
return parentFormspec..table.concat(formspec,"")
|
|
||||||
end
|
|
||||||
|
|
||||||
function industrialtest.Chargepad.register(self)
|
|
||||||
industrialtest.ActivatedElectricMachine.register(self)
|
|
||||||
table.insert(industrialtest.internal.chargepads,self.name)
|
|
||||||
table.insert(industrialtest.internal.chargepads,self.name.."_active")
|
|
||||||
minetest.register_craft({
|
|
||||||
type="shaped",
|
|
||||||
output=self.name,
|
|
||||||
recipe={
|
|
||||||
{"industrialtest:electronic_circuit",industrialtest.elementKeys.stoneSlab,"industrialtest:electronic_circuit"},
|
|
||||||
{industrialtest.elementKeys.rubber,self._basePowerStorage,industrialtest.elementKeys.rubber}
|
|
||||||
}
|
|
||||||
})
|
|
||||||
end
|
|
||||||
|
|
||||||
function industrialtest.Chargepad.chargePlayer(meta,player,flow)
|
|
||||||
local inv
|
local inv
|
||||||
if industrialtest.mtgAvailable then
|
if industrialtest.mtgAvailable then
|
||||||
_,inv=armor:get_valid_player(player,"")
|
_,inv=armor:get_valid_player(player,"")
|
||||||
@ -128,7 +68,31 @@ function industrialtest.Chargepad.chargePlayer(meta,player,flow)
|
|||||||
return true
|
return true
|
||||||
end
|
end
|
||||||
|
|
||||||
function industrialtest.Chargepad.action(self,pos,node)
|
chargepad.getFormspec=function(pos)
|
||||||
|
local meta=minetest.get_meta(pos)
|
||||||
|
local charged=meta:get_int("industrialtest.powerAmount")/meta:get_int("industrialtest.powerCapacity")
|
||||||
|
local formspec={
|
||||||
|
"list[context;charged;1,2.5;1,1]",
|
||||||
|
industrialtest.internal.getItemSlotBg(1,2.5,1,1),
|
||||||
|
"label[0.9,3.9;"..S("Charge").."]",
|
||||||
|
"list[context;discharged;3,2.5;1,1]",
|
||||||
|
industrialtest.internal.getItemSlotBg(3,2.5,1,1),
|
||||||
|
"label[2.7,3.9;"..S("Discharge").."]",
|
||||||
|
"box[9,1;0.3,4.8;#202020]",
|
||||||
|
(charged>0 and "box[9,"..(1+4.8-(charged*4.8))..";0.3,"..(charged*4.8)..";#FF1010]" or ""),
|
||||||
|
"listring[context;charged]",
|
||||||
|
"listring[context;discharged]"
|
||||||
|
}
|
||||||
|
return table.concat(formspec,"")
|
||||||
|
end
|
||||||
|
|
||||||
|
chargepad.onConstruct=function(pos,meta,inv)
|
||||||
|
inv:set_size("charged",1)
|
||||||
|
inv:set_size("discharged",1)
|
||||||
|
meta:set_int("active",0)
|
||||||
|
end
|
||||||
|
|
||||||
|
chargepad.action=function(pos,node)
|
||||||
local meta=minetest.get_meta(pos)
|
local meta=minetest.get_meta(pos)
|
||||||
local inv=meta:get_inventory()
|
local inv=meta:get_inventory()
|
||||||
local chargedSlot=inv:get_stack("charged",1)
|
local chargedSlot=inv:get_stack("charged",1)
|
||||||
@ -152,149 +116,138 @@ function industrialtest.Chargepad.action(self,pos,node)
|
|||||||
for _,player in ipairs(players) do
|
for _,player in ipairs(players) do
|
||||||
if vector.in_area(player:get_pos(),p1,p2) then
|
if vector.in_area(player:get_pos(),p1,p2) then
|
||||||
playerFound=true
|
playerFound=true
|
||||||
shouldUpdateFormspec=shouldUpdateFormspec or self.chargePlayer(meta,player,flow)
|
shouldUpdateFormspec=shouldUpdateFormspec or chargePlayer(meta,player,flow)
|
||||||
break
|
break
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
local active=meta:get_int("active")==1
|
local active=meta:get_int("active")==1
|
||||||
if playerFound and not active then
|
if playerFound and not active then
|
||||||
self:activate(pos)
|
minetest.swap_node(pos,{
|
||||||
|
name=node.name.."_active",
|
||||||
|
param2=node.param2
|
||||||
|
})
|
||||||
meta:set_int("active",1)
|
meta:set_int("active",1)
|
||||||
elseif (not playerFound or meta:get_int("industrialtest.powerAmount")==0) and active then
|
elseif (not playerFound or meta:get_int("industrialtest.powerAmount")==0) and active then
|
||||||
self:deactivate(pos)
|
local def=minetest.registered_nodes[node.name]
|
||||||
|
minetest.swap_node(pos,{
|
||||||
|
name=def._industrialtest_baseNodeName,
|
||||||
|
param2=node.param2
|
||||||
|
})
|
||||||
meta:set_int("active",0)
|
meta:set_int("active",0)
|
||||||
end
|
end
|
||||||
|
|
||||||
if shouldUpdateFormspec then
|
if shouldUpdateFormspec then
|
||||||
self:updateFormspec(pos)
|
local def=minetest.registered_nodes[node.name]
|
||||||
|
def._industrialtest_updateFormspec(pos)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
industrialtest.BatboxChargepad=table.copy(industrialtest.Chargepad)
|
local function registerChargepad(config)
|
||||||
industrialtest.internal.unpackTableInto(industrialtest.BatboxChargepad,{
|
industrialtest.internal.registerMachine({
|
||||||
name="industrialtest:batbox_chargepad",
|
name=config.name,
|
||||||
description=S("BatBox Chargepad"),
|
displayName=config.displayName,
|
||||||
tiles={
|
capacity=config.capacity,
|
||||||
"industrialtest_wood_machine_block.png^industrialtest_chargepad_top.png",
|
flow=config.flow,
|
||||||
"industrialtest_wood_machine_block.png",
|
ioConfig="iiiioi",
|
||||||
"industrialtest_wood_machine_block.png",
|
sounds=config.sounds,
|
||||||
"industrialtest_wood_machine_block.png",
|
powerSlots={"charged","discharged"},
|
||||||
"industrialtest_wood_machine_block.png",
|
storageSlots={"charged","discharged"},
|
||||||
"industrialtest_wood_machine_block.png^industrialtest_batbox_front.png"
|
requiresWrench=config.requiresWrench,
|
||||||
},
|
registerActiveVariant=true,
|
||||||
sounds="wood",
|
groups={
|
||||||
active={
|
_industrialtest_hasPowerOutput=1,
|
||||||
tiles={
|
_industrialtest_hasPowerInput=1
|
||||||
"industrialtest_wood_machine_block.png^industrialtest_chargepad_top_active.png",
|
},
|
||||||
"industrialtest_wood_machine_block.png",
|
customKeys={
|
||||||
"industrialtest_wood_machine_block.png",
|
tiles={
|
||||||
"industrialtest_wood_machine_block.png",
|
config.machineBlockTexture.."^industrialtest_chargepad_top.png",
|
||||||
"industrialtest_wood_machine_block.png",
|
config.machineBlockTexture,
|
||||||
"industrialtest_wood_machine_block.png^industrialtest_batbox_front.png"
|
config.machineBlockTexture,
|
||||||
|
config.machineBlockTexture,
|
||||||
|
config.machineBlockTexture,
|
||||||
|
config.machineBlockTexture.."^"..config.frontTexture
|
||||||
|
},
|
||||||
|
paramtype2="facedir",
|
||||||
|
legacy_facedir_simple=true
|
||||||
|
},
|
||||||
|
activeCustomKeys={
|
||||||
|
tiles={
|
||||||
|
config.machineBlockTexture.."^industrialtest_chargepad_top_active.png",
|
||||||
|
config.machineBlockTexture,
|
||||||
|
config.machineBlockTexture,
|
||||||
|
config.machineBlockTexture,
|
||||||
|
config.machineBlockTexture,
|
||||||
|
config.machineBlockTexture.."^"..config.frontTexture
|
||||||
|
},
|
||||||
|
_industrialtest_baseNodeName="industrialtest:"..config.name
|
||||||
|
},
|
||||||
|
getFormspec=chargepad.getFormspec,
|
||||||
|
onConstruct=chargepad.onConstruct
|
||||||
|
})
|
||||||
|
minetest.register_craft({
|
||||||
|
type="shaped",
|
||||||
|
output="industrialtest:"..config.name,
|
||||||
|
recipe={
|
||||||
|
{"industrialtest:electronic_circuit",industrialtest.elementKeys.stoneSlab,"industrialtest:electronic_circuit"},
|
||||||
|
{industrialtest.elementKeys.rubber,"industrialtest:"..config.basePowerStorage,industrialtest.elementKeys.rubber}
|
||||||
}
|
}
|
||||||
},
|
})
|
||||||
|
table.insert(industrialtest.internal.chargepads,"industrialtest:"..config.name)
|
||||||
|
table.insert(industrialtest.internal.chargepads,"industrialtest:"..config.name.."_active")
|
||||||
|
end
|
||||||
|
|
||||||
|
registerChargepad({
|
||||||
|
name="batbox_chargepad",
|
||||||
|
displayName=S("BatBox Chargepad"),
|
||||||
capacity=25000,
|
capacity=25000,
|
||||||
flow=industrialtest.api.lvPowerFlow,
|
flow=industrialtest.api.lvPowerFlow,
|
||||||
_basePowerStorage="industrialtest:batbox"
|
sounds="wood",
|
||||||
|
machineBlockTexture="industrialtest_wood_machine_block.png",
|
||||||
|
frontTexture="industrialtest_batbox_front.png",
|
||||||
|
requiresWrench=false,
|
||||||
|
basePowerStorage="batbox"
|
||||||
})
|
})
|
||||||
industrialtest.BatboxChargepad:register()
|
|
||||||
|
|
||||||
industrialtest.CESUChargepad=table.copy(industrialtest.Chargepad)
|
registerChargepad({
|
||||||
industrialtest.internal.unpackTableInto(industrialtest.CESUChargepad,{
|
name="cesu_chargepad",
|
||||||
name="industrialtest:cesu_chargepad",
|
displayName=S("CESU Chargepad"),
|
||||||
description=S("CESU Chargepad"),
|
|
||||||
tiles={
|
|
||||||
"industrialtest_bronze_machine_block.png^industrialtest_chargepad_top.png",
|
|
||||||
"industrialtest_bronze_machine_block.png",
|
|
||||||
"industrialtest_bronze_machine_block.png",
|
|
||||||
"industrialtest_bronze_machine_block.png",
|
|
||||||
"industrialtest_bronze_machine_block.png",
|
|
||||||
"industrialtest_bronze_machine_block.png^industrialtest_cesu_front.png"
|
|
||||||
},
|
|
||||||
sounds="metal",
|
|
||||||
active={
|
|
||||||
tiles={
|
|
||||||
"industrialtest_bronze_machine_block.png^industrialtest_chargepad_top_active.png",
|
|
||||||
"industrialtest_bronze_machine_block.png",
|
|
||||||
"industrialtest_bronze_machine_block.png",
|
|
||||||
"industrialtest_bronze_machine_block.png",
|
|
||||||
"industrialtest_bronze_machine_block.png",
|
|
||||||
"industrialtest_bronze_machine_block.png^industrialtest_cesu_front.png"
|
|
||||||
}
|
|
||||||
},
|
|
||||||
capacity=400000,
|
capacity=400000,
|
||||||
flow=industrialtest.api.mvPowerFlow,
|
flow=industrialtest.api.mvPowerFlow,
|
||||||
_basePowerStorage="industrialtest:cesu"
|
|
||||||
})
|
|
||||||
industrialtest.CESUChargepad:register()
|
|
||||||
|
|
||||||
industrialtest.MFEChargepad=table.copy(industrialtest.Chargepad)
|
|
||||||
industrialtest.internal.unpackTableInto(industrialtest.MFEChargepad,{
|
|
||||||
name="industrialtest:mfe_chargepad",
|
|
||||||
description=S("MFE Chargepad"),
|
|
||||||
tiles={
|
|
||||||
"industrialtest_machine_block.png^industrialtest_chargepad_top.png",
|
|
||||||
"industrialtest_machine_block.png",
|
|
||||||
"industrialtest_machine_block.png",
|
|
||||||
"industrialtest_machine_block.png",
|
|
||||||
"industrialtest_machine_block.png",
|
|
||||||
"industrialtest_machine_block.png^industrialtest_mfe_front.png"
|
|
||||||
},
|
|
||||||
sounds="metal",
|
sounds="metal",
|
||||||
requiresWrench=true,
|
machineBlockTexture="industrialtest_bronze_machine_block.png",
|
||||||
active={
|
frontTexture="industrialtest_cesu_front.png",
|
||||||
tiles={
|
requiresWrench=false,
|
||||||
"industrialtest_machine_block.png^industrialtest_chargepad_top_active.png",
|
basePowerStorage="cesu"
|
||||||
"industrialtest_machine_block.png",
|
})
|
||||||
"industrialtest_machine_block.png",
|
|
||||||
"industrialtest_machine_block.png",
|
registerChargepad({
|
||||||
"industrialtest_machine_block.png",
|
name="mfe_chargepad",
|
||||||
"industrialtest_machine_block.png^industrialtest_mfe_front.png"
|
displayName=S("MFE Chargepad"),
|
||||||
}
|
|
||||||
},
|
|
||||||
capacity=3000000,
|
capacity=3000000,
|
||||||
flow=industrialtest.api.hvPowerFlow,
|
flow=industrialtest.api.hvPowerFlow,
|
||||||
_basePowerStorage="industrialtest:mfe"
|
|
||||||
})
|
|
||||||
industrialtest.MFEChargepad:register()
|
|
||||||
|
|
||||||
industrialtest.MFSUChargepad=table.copy(industrialtest.Chargepad)
|
|
||||||
industrialtest.internal.unpackTableInto(industrialtest.MFSUChargepad,{
|
|
||||||
name="industrialtest:mfsu_chargepad",
|
|
||||||
description=S("MFSU Chargepad"),
|
|
||||||
tiles={
|
|
||||||
"industrialtest_advanced_machine_block.png^industrialtest_chargepad_top.png",
|
|
||||||
"industrialtest_advanced_machine_block.png",
|
|
||||||
"industrialtest_advanced_machine_block.png",
|
|
||||||
"industrialtest_advanced_machine_block.png",
|
|
||||||
"industrialtest_advanced_machine_block.png",
|
|
||||||
"industrialtest_advanced_machine_block.png^industrialtest_mfsu_front.png"
|
|
||||||
},
|
|
||||||
sounds="metal",
|
sounds="metal",
|
||||||
|
machineBlockTexture="industrialtest_machine_block.png",
|
||||||
|
frontTexture="industrialtest_mfe_front.png",
|
||||||
requiresWrench=true,
|
requiresWrench=true,
|
||||||
active={
|
basePowerStorage="mfe"
|
||||||
tiles={
|
})
|
||||||
"industrialtest_advanced_machine_block.png^industrialtest_chargepad_top_active.png",
|
|
||||||
"industrialtest_advanced_machine_block.png",
|
registerChargepad({
|
||||||
"industrialtest_advanced_machine_block.png",
|
name="mfsu_chargepad",
|
||||||
"industrialtest_advanced_machine_block.png",
|
displayName=S("MFSU Chargepad"),
|
||||||
"industrialtest_advanced_machine_block.png",
|
|
||||||
"industrialtest_advanced_machine_block.png^industrialtest_mfsu_front.png"
|
|
||||||
}
|
|
||||||
},
|
|
||||||
capacity=30000000,
|
capacity=30000000,
|
||||||
flow=industrialtest.api.evPowerFlow,
|
flow=industrialtest.api.evPowerFlow,
|
||||||
_basePowerStorage="industrialtest:mfsu"
|
sounds="metal",
|
||||||
|
machineBlockTexture="industrialtest_advanced_machine_block.png",
|
||||||
|
frontTexture="industrialtest_mfsu_front.png",
|
||||||
|
requiresWrench=true,
|
||||||
|
basePowerStorage="mfsu"
|
||||||
})
|
})
|
||||||
industrialtest.MFSUChargepad:register()
|
|
||||||
|
|
||||||
minetest.register_abm({
|
minetest.register_abm({
|
||||||
label="Chargepad updating",
|
label="Chargepad updating",
|
||||||
nodenames=industrialtest.internal.chargepads,
|
nodenames=industrialtest.internal.chargepads,
|
||||||
interval=industrialtest.updateDelay,
|
interval=industrialtest.updateDelay,
|
||||||
chance=1,
|
chance=1,
|
||||||
action=function(pos,node)
|
action=chargepad.action
|
||||||
local def=minetest.registered_nodes[node.name]
|
|
||||||
def._industrialtest_self:action(pos,node)
|
|
||||||
end
|
|
||||||
})
|
})
|
||||||
|
@ -179,8 +179,6 @@ function industrialtest.Machine.createDefinitionTable(self)
|
|||||||
def.groups={cracky=2}
|
def.groups={cracky=2}
|
||||||
if self.sounds=="metal" then
|
if self.sounds=="metal" then
|
||||||
def.sounds=default.node_sound_metal_defaults()
|
def.sounds=default.node_sound_metal_defaults()
|
||||||
elseif self.sounds=="wood" then
|
|
||||||
def.sounds=default.node_sound_wood_defaults()
|
|
||||||
end
|
end
|
||||||
def.can_dig=function(pos)
|
def.can_dig=function(pos)
|
||||||
local meta=minetest.get_meta(pos)
|
local meta=minetest.get_meta(pos)
|
||||||
@ -198,8 +196,6 @@ function industrialtest.Machine.createDefinitionTable(self)
|
|||||||
end
|
end
|
||||||
if self.sounds=="metal" then
|
if self.sounds=="metal" then
|
||||||
def.sounds=mcl_sounds.node_sound_metal_defaults()
|
def.sounds=mcl_sounds.node_sound_metal_defaults()
|
||||||
elseif sounds=="wood" then
|
|
||||||
def.sounds=mcl_sounds.node_sound_wood_defaults()
|
|
||||||
end
|
end
|
||||||
def.groups={
|
def.groups={
|
||||||
pickaxey=1,
|
pickaxey=1,
|
||||||
@ -236,13 +232,6 @@ function industrialtest.Machine.createDefinitionTable(self)
|
|||||||
def.legacy_facedir_simple=true
|
def.legacy_facedir_simple=true
|
||||||
end
|
end
|
||||||
|
|
||||||
if self.hasPowerInput then
|
|
||||||
def.groups._industrialtest_hasPowerInput=1
|
|
||||||
end
|
|
||||||
if self.hasPowerOutput then
|
|
||||||
def.groups._industrialtest_hasPowerOutput=1
|
|
||||||
end
|
|
||||||
|
|
||||||
return def
|
return def
|
||||||
end
|
end
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user