Balance nuclear reactor

This commit is contained in:
mrkubax10 2023-11-21 12:47:02 +01:00
parent c56c0a9c5c
commit f3d05ac5bb
1 changed files with 17 additions and 17 deletions

View File

@ -70,7 +70,7 @@ local function findMaxFuelCluster(fuelList)
for y=1,4 do
for x=1,5 do
local iy=y-1
local stack=fuelList[iy*4+x]
local stack=fuelList[iy*5+x]
local def=minetest.registered_tools[stack:get_name()]
if def and def.groups._industrialtest_nuclearReactorFuel then
local cluster={
@ -79,60 +79,60 @@ local function findMaxFuelCluster(fuelList)
y=iy
}
}
if x>1 and fuelList[iy*4+x-1]:get_name()==stack:get_name() then
if x>1 and fuelList[iy*5+x-1]:get_name()==stack:get_name() then
table.insert(cluster,{
x=x-1,
y=iy
})
end
if x<5 and fuelList[iy*4+x+1]:get_name()==stack:get_name() then
if x<5 and fuelList[iy*5+x+1]:get_name()==stack:get_name() then
table.insert(cluster,{
x=x+1,
y=iy
})
end
if y>1 and fuelList[(iy-1)*4+x]:get_name()==stack:get_name() then
if y>1 and fuelList[(iy-1)*5+x]:get_name()==stack:get_name() then
table.insert(cluster,{
x=x,
i=iy-1
y=iy-1
})
end
if y<4 and fuelList[(iy+1)*4+x]:get_name()==stack:get_name() then
if y<4 and fuelList[(iy+1)*5+x]:get_name()==stack:get_name() then
table.insert(cluster,{
x=x,
y=iy+1
})
end
if x>1 and y>1 and fuelList[(iy-1)*4+x-1]:get_name()==stack:get_name() then
if x>1 and y>1 and fuelList[(iy-1)*5+x-1]:get_name()==stack:get_name() then
table.insert(cluster,{
x=x-1,
y=iy-1
})
end
if x<5 and y>1 and fuelList[(iy-1)*4+x+1]:get_name()==stack:get_name() then
if x<5 and y>1 and fuelList[(iy-1)*5+x+1]:get_name()==stack:get_name() then
table.insert(cluster,{
x=x+1,
y=iy-1
})
end
if x>1 and y<4 and fuelList[(iy+1)*4+x-1]:get_name()==stack:get_name() then
if x>1 and y<4 and fuelList[(iy+1)*5+x-1]:get_name()==stack:get_name() then
table.insert(cluster,{
x=x-1,
y=iy+1
})
end
if x<5 and y<4 and fuelList[(iy+1)*4+x+1]:get_name()==stack:get_name() then
if x<5 and y<4 and fuelList[(iy+1)*5+x+1]:get_name()==stack:get_name() then
table.insert(cluster,{
x=x+1,
y=iy+1
})
end
if #cluster==9 then
return cluster
end
if #cluster>#maxCluster then
maxCluster=cluster
end
if #cluster==4 then
return maxCluster
end
end
end
end
@ -224,11 +224,11 @@ reactor.activeOnTimer=function(pos,elapsed,meta,inv)
local maxCluster=findMaxFuelCluster(fuelList)
for _,stack in ipairs(maxCluster) do
local index=stack.y*4+stack.x
local index=stack.y*5+stack.x
local usedStack,_=useFuel(fuelList[index],5)
inv:set_stack("fuel",index,usedStack)
end
local generatedPowerAmount=math.pow(20,#maxCluster)
local generatedPowerAmount=math.pow(3,#maxCluster)
if industrialtest.api.addPower(meta,generatedPowerAmount)>0 then
shouldUpdateFormspec=true
end
@ -325,8 +325,8 @@ industrialtest.internal.registerMachine({
name="nuclear_reactor",
displayName=S("Nuclear Reactor"),
getFormspec=reactor.getFormspec,
capacity=industrialtest.api.ivPowerFlow*2,
flow=industrialtest.api.ivPowerFlow,
capacity=industrialtest.api.evPowerFlow,
flow=industrialtest.api.evPowerFlow,
ioConfig="oooooo",
requiresWrench=true,
registerActiveVariant=true,