mirror of
https://github.com/PHIDIAS0303/ExpCluster.git
synced 2026-03-30 10:44:39 +09:00
Add Command Description Locale (#323)
* Update admin-chat.lua * Update admin-markers.lua * Update artillery.lua * Update bot-queue.lua * Update cheat-mode.lua * Update clear-inventory.lua * Update connect.lua * Update debug.lua * Update enemy.lua * Update find.lua * Update friendly-fire.lua * Update help.lua * Update home.lua * Update interface.lua * Update jail.lua * Update kill.lua * Update last-location.lua * Update me.lua * Update pollution.lua * Update protection.lua * Update rainbow.lua * Update ratio.lua * Update repair.lua * Update reports.lua * Update research.lua * Update roles.lua * Update roles.lua * Update search.lua * Update spawn.lua * Update spectate.lua * Update speed.lua * Update surface-clearing.lua * Update teleport.lua * Update train.lua * Update vlayer.lua * Update warnings.lua * Update waterfill.lua * Update gui.cfg * Update gui.cfg * Update gui.cfg * Update commands.cfg * Update commands.cfg * Update commands.cfg * Update connect.lua * Update cheat-mode.lua * Update commands.cfg * Update commands.cfg * Update commands.cfg * Update commands.cfg * Update commands.cfg * Update commands.cfg * Update admin-chat.lua * Update admin-markers.lua * Update vlayer.lua * Update artillery.lua * Update bot-queue.lua * Update cheat-mode.lua * Update clear-inventory.lua * Update connect.lua * Update debug.lua * Update enemy.lua * Update find.lua * Update friendly-fire.lua * Update help.lua * Update home.lua * Update interface.lua * Update jail.lua * Update kill.lua * Update last-location.lua * Update me.lua * Update pollution.lua * Update protection.lua * Update rainbow.lua * Update ratio.lua * Update repair.lua * Update reports.lua * Update research.lua * Update roles.lua * Update search.lua * Update spawn.lua * Update spectate.lua * Update speed.lua * Update surface-clearing.lua * Update teleport.lua * Update train.lua * Update warnings.lua * Update waterfill.lua * Update gui.cfg * Update gui.cfg * Update gui.cfg * Update gui.cfg * Update gui.cfg * Update commands.cfg * Update commands.cfg * Update addons.cfg * Update addons.cfg * Update data.cfg * Update data.cfg * Update gui.cfg * Update gui.cfg * Update data.cfg * Update data.cfg * Update gui.cfg * Update gui.cfg * Update gui.cfg * Update gui.cfg * Update gui.cfg * Update gui.cfg * Update commands.lua * Update admin-chat.lua * Update admin-markers.lua * Update artillery.lua * Update bot-queue.lua * Update cheat-mode.lua * Update clear-inventory.lua * Update connect.lua * Update debug.lua * Update enemy.lua * Update find.lua * Update help.lua * Update interface.lua * Update home.lua * Update jail.lua * Update kill.lua * Update last-location.lua * Update me.lua * Update pollution.lua * Update protection.lua * Update rainbow.lua * Update ratio.lua * Update repair.lua * Update reports.lua * Update research.lua * Update roles.lua * Update search.lua * Update spawn.lua * Update spectate.lua * Update speed.lua * Update surface-clearing.lua * Update teleport.lua * Update train.lua * Update vlayer.lua * Update warnings.lua * Update waterfill.lua * Update commands.cfg * Update commands.cfg * Update enemy.lua * Update friendly-fire.lua * Update roles.lua * Update spectate.lua * Update spectate.lua
This commit is contained in:
@@ -17,66 +17,70 @@ local function AmountOfMachines(itemsPerSecond, output)
|
||||
end
|
||||
end
|
||||
|
||||
Commands.new_command('ratio', 'This command will give the input and output ratios of the selected machine. Use the parameter for calculating the machines needed for that amount of items per second.')
|
||||
:add_param('itemsPerSecond', true, 'number')
|
||||
:register(function(player, itemsPerSecond)
|
||||
local machine = player.selected -- selected machine
|
||||
if not machine then --nil check
|
||||
return Commands.error{'expcom-ratio.notSelecting'}
|
||||
Commands.new_command('ratio', {'expcom-ratio.description'}, 'This command will give the input and output ratios of the selected machine. Use the parameter for calculating the machines needed for that amount of items per second.')
|
||||
:add_param('itemsPerSecond', true, 'number')
|
||||
:register(function(player, itemsPerSecond)
|
||||
local machine = player.selected -- selected machine
|
||||
|
||||
if not machine then --nil check
|
||||
return Commands.error{'expcom-ratio.notSelecting'}
|
||||
end
|
||||
|
||||
if machine.type ~= "assembling-machine" and machine.type ~= "furnace" then
|
||||
return Commands.error{'expcom-ratio.notSelecting'}
|
||||
end
|
||||
|
||||
local recipe = machine.get_recipe() -- recipe
|
||||
|
||||
if not recipe then --nil check
|
||||
return Commands.error{'expcom-ratio.notSelecting'}
|
||||
end
|
||||
|
||||
local items = recipe.ingredients -- items in that recipe
|
||||
local products = recipe.products -- output items
|
||||
local amountOfMachines
|
||||
local moduleInventory = machine.get_module_inventory()--the module Inventory of the machine
|
||||
local multi = Modules(moduleInventory) --function for the productively modals
|
||||
|
||||
if itemsPerSecond then
|
||||
amountOfMachines = math.ceil( AmountOfMachines(itemsPerSecond, 1/recipe.energy*machine.crafting_speed*products[1].amount*multi)) -- amount of machines
|
||||
end
|
||||
|
||||
if not amountOfMachines then
|
||||
amountOfMachines = 1 --set to 1 to make it not nil
|
||||
end
|
||||
|
||||
----------------------------items----------------------------
|
||||
for i, item in ipairs(items) do
|
||||
local sprite -- string to make the icon work either fluid ore item
|
||||
|
||||
if item.type == "item" then
|
||||
sprite = 'expcom-ratio.item-in'
|
||||
|
||||
else
|
||||
sprite = 'expcom-ratio.fluid-in'
|
||||
end
|
||||
|
||||
if machine.type ~= "assembling-machine" and machine.type ~= "furnace" then
|
||||
return Commands.error{'expcom-ratio.notSelecting'}
|
||||
end
|
||||
local recipe = machine.get_recipe() -- recipe
|
||||
local ips = item.amount/recipe.energy*machine.crafting_speed*amountOfMachines --math on the items/fluids per second
|
||||
Commands.print{sprite, math.round(ips, 3), item.name} -- full string
|
||||
end
|
||||
|
||||
if not recipe then --nil check
|
||||
return Commands.error{'expcom-ratio.notSelecting'}
|
||||
----------------------------products----------------------------
|
||||
for i, product in ipairs(products) do
|
||||
local sprite -- string to make the icon work either fluid ore item
|
||||
|
||||
if product.type == "item" then
|
||||
sprite = 'expcom-ratio.item-out'
|
||||
else
|
||||
sprite = 'expcom-ratio.fluid-out'
|
||||
end
|
||||
|
||||
local items = recipe.ingredients -- items in that recipe
|
||||
local products = recipe.products -- output items
|
||||
local amountOfMachines
|
||||
local moduleInventory = machine.get_module_inventory()--the module Inventory of the machine
|
||||
local multi = Modules(moduleInventory) --function for the productively modals
|
||||
local output = 1/recipe.energy*machine.crafting_speed*product.amount*multi --math on the outputs per second
|
||||
Commands.print {sprite, math.round(output*amountOfMachines, 3), product.name} -- full string
|
||||
|
||||
if itemsPerSecond then
|
||||
amountOfMachines = math.ceil( AmountOfMachines(itemsPerSecond, 1/recipe.energy*machine.crafting_speed*products[1].amount*multi)) -- amount of machines
|
||||
end
|
||||
if not amountOfMachines then
|
||||
amountOfMachines = 1 --set to 1 to make it not nil
|
||||
end
|
||||
----------------------------items----------------------------
|
||||
for i, item in ipairs(items) do
|
||||
local sprite -- string to make the icon work either fluid ore item
|
||||
end
|
||||
|
||||
if item.type == "item" then
|
||||
sprite = 'expcom-ratio.item-in'
|
||||
else
|
||||
sprite = 'expcom-ratio.fluid-in'
|
||||
end
|
||||
|
||||
local ips = item.amount/recipe.energy*machine.crafting_speed*amountOfMachines --math on the items/fluids per second
|
||||
Commands.print {sprite, math.round(ips, 3), item.name}-- full string
|
||||
end
|
||||
----------------------------products----------------------------
|
||||
|
||||
for i, product in ipairs(products) do
|
||||
local sprite -- string to make the icon work either fluid ore item
|
||||
|
||||
if product.type == "item" then
|
||||
sprite = 'expcom-ratio.item-out'
|
||||
else
|
||||
sprite = 'expcom-ratio.fluid-out'
|
||||
end
|
||||
|
||||
local output = 1/recipe.energy*machine.crafting_speed*product.amount*multi --math on the outputs per second
|
||||
Commands.print {sprite, math.round(output*amountOfMachines, 3), product.name} -- full string
|
||||
|
||||
end
|
||||
|
||||
if amountOfMachines ~= 1 then
|
||||
Commands.print{'expcom-ratio.machines', amountOfMachines}
|
||||
end
|
||||
|
||||
end)
|
||||
if amountOfMachines ~= 1 then
|
||||
Commands.print{'expcom-ratio.machines', amountOfMachines}
|
||||
end
|
||||
end)
|
||||
|
||||
Reference in New Issue
Block a user