mirror of
https://github.com/PHIDIAS0303/factorio-mod-PHI.git
synced 2025-12-27 11:05:22 +09:00
.
This commit is contained in:
@@ -1,3 +1,6 @@
|
||||
local items = require 'config'
|
||||
local main = require 'main'
|
||||
|
||||
local function clock_display(sec)
|
||||
local s = math.floor(sec) % 60
|
||||
local m = math.floor(sec / 60) % 60
|
||||
@@ -21,3 +24,35 @@ if settings.startup['PHI-XC'].value then
|
||||
end
|
||||
end)
|
||||
end
|
||||
|
||||
if settings.startup['PHI-PB'].value then
|
||||
commands.add_command('bonus', nil, function(command)
|
||||
local player
|
||||
|
||||
if command.player_index then
|
||||
player = game.get_player(command.player_index)
|
||||
|
||||
else
|
||||
game.print('Command Error')
|
||||
return
|
||||
end
|
||||
|
||||
if type(command.parameter) ~= 'number' then
|
||||
player.print('Parameter need to be number')
|
||||
return
|
||||
end
|
||||
|
||||
local bonus = tonumber(command.parameter)
|
||||
|
||||
if (bonus < 0) or (bonus > 10) then
|
||||
player.print('Parameter need to be in range of 0 - 10')
|
||||
return
|
||||
end
|
||||
|
||||
for _, v in pairs(items['bonus']['player_bonus']) do
|
||||
if v.enabled then
|
||||
game.players[command.player_index][v.name] = game.players[command.player_index][v.name] + (bonus / 10)
|
||||
end
|
||||
end
|
||||
end)
|
||||
end
|
||||
|
||||
Reference in New Issue
Block a user