mirror of
https://github.com/PHIDIAS0303/ExpCluster.git
synced 2025-12-27 11:35:22 +09:00
Merge pull request #249 from PHIDIAS0303/dev2
cmd personal logistics for spidertron
This commit is contained in:
@@ -1,30 +1,30 @@
|
|||||||
local Commands = require 'expcore.commands' --- @dep expcore.commands
|
local Commands = require 'expcore.commands' --- @dep expcore.commands
|
||||||
local config = require 'config.personal_logistic' --- @dep config.personal-logistic
|
local config = require 'config.personal_logistic' --- @dep config.personal-logistic
|
||||||
|
|
||||||
--[[
|
local function pl(type, target, amount)
|
||||||
Command 2:
|
local c
|
||||||
add filter based of inventory
|
local s
|
||||||
|
|
||||||
Command 3:
|
if type == 'p' then
|
||||||
add filter of those not in inventory: all 0
|
c = target.clear_personal_logistic_slot
|
||||||
game.item_prototypes
|
s = target.set_personal_logistic_slot
|
||||||
|
|
||||||
Command 4:
|
elseif type == 's' then
|
||||||
Spidertron request
|
c = target.clear_vehicle_logistic_slot
|
||||||
]]
|
s = target.set_vehicle_logistic_slot
|
||||||
|
|
||||||
local function pl(player, amount)
|
else
|
||||||
local c = player.clear_personal_logistic_slot
|
return
|
||||||
|
end
|
||||||
|
|
||||||
for k, v in pairs(config.request) do
|
for _, v in pairs(config.request) do
|
||||||
c(config.start + v.key)
|
c(config.start + v.key)
|
||||||
end
|
end
|
||||||
|
|
||||||
if (amount == 0) then
|
if (amount == 0) then
|
||||||
return
|
return
|
||||||
else
|
else
|
||||||
local stats = player.force.item_production_statistics
|
local stats = target.force.item_production_statistics
|
||||||
local s = player.set_personal_logistic_slot
|
|
||||||
|
|
||||||
for k, v in pairs(config.request) do
|
for k, v in pairs(config.request) do
|
||||||
local v_min = math.ceil(v.min * amount)
|
local v_min = math.ceil(v.min * amount)
|
||||||
@@ -63,13 +63,20 @@ local function pl(player, amount)
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
Commands.new_command('personal-logistic', 'Set Personal Logistic (0 to cancel all)')
|
Commands.new_command('personal-logistic', 'Set Personal Logistic (0 to cancel all) (Select spidertron to edit spidertron)')
|
||||||
:add_param('amount', 'integer-range', 0, 10)
|
:add_param('amount', 'integer-range', 0, 10)
|
||||||
:add_alias('pl')
|
:add_alias('pl')
|
||||||
:register(function(player, amount)
|
:register(function(player, amount)
|
||||||
if player.force.technologies['logistic-robotics'].researched then
|
if player.force.technologies['logistic-robotics'].researched then
|
||||||
pl(player, amount / 10)
|
if player.selected ~= nil then
|
||||||
return Commands.success
|
if player.selected.name == 'spidertron' then
|
||||||
|
pl('s', player.selected, amount / 10)
|
||||||
|
return Commands.success
|
||||||
|
end
|
||||||
|
else
|
||||||
|
pl('p', player, amount / 10)
|
||||||
|
return Commands.success
|
||||||
|
end
|
||||||
else
|
else
|
||||||
player.print('Player logistic not researched')
|
player.print('Player logistic not researched')
|
||||||
end
|
end
|
||||||
|
|||||||
Reference in New Issue
Block a user