mirror of
https://github.com/PHIDIAS0303/ExpCluster.git
synced 2025-12-27 11:35:22 +09:00
Bonus GUI (#300)
* Update _file_loader.lua * Update roles.lua * Update bonus.lua * Update bonus.lua * Create bonus.lua * Update commands.cfg * Update commands.cfg * Update commands.cfg * Update gui.cfg * Update gui.cfg * Update gui.cfg * Update bonus.lua * Update roles.lua * Update roles.lua * Update gui.cfg * Update gui.cfg * Update bonus.lua * Update bonus.lua * Update bonus.lua * Update gui.cfg * Update gui.cfg * Update bonus.lua * Update bonus.lua * Update gui.cfg * Update gui.cfg * Update gui.cfg * Update bonus.lua * Update bonus.lua * Update bonus.lua * Update bonus.lua * Update bonus.lua * Update bonus.lua * Update bonus.lua * Update bonus.lua * Update bonus.lua * Update bonus.lua * Update bonus.lua * Update bonus.lua * Update gui.cfg * Update commands.cfg * Update bonus.lua * Update bonus.lua
This commit is contained in:
@@ -63,9 +63,9 @@ return {
|
|||||||
'modules.addons.afk-kick',
|
'modules.addons.afk-kick',
|
||||||
'modules.addons.report-jail',
|
'modules.addons.report-jail',
|
||||||
'modules.addons.protection-jail',
|
'modules.addons.protection-jail',
|
||||||
'modules.addons.deconlog',
|
'modules.addons.deconlog',
|
||||||
'modules.addons.nukeprotect',
|
'modules.addons.nukeprotect',
|
||||||
'modules.addons.inserter',
|
'modules.addons.inserter',
|
||||||
'modules.addons.miner',
|
'modules.addons.miner',
|
||||||
|
|
||||||
-- Control
|
-- Control
|
||||||
@@ -78,7 +78,7 @@ return {
|
|||||||
'modules.data.quickbar',
|
'modules.data.quickbar',
|
||||||
'modules.data.alt-view',
|
'modules.data.alt-view',
|
||||||
'modules.data.tag',
|
'modules.data.tag',
|
||||||
'modules.data.bonus',
|
-- 'modules.data.bonus',
|
||||||
'modules.data.personal-logistic',
|
'modules.data.personal-logistic',
|
||||||
'modules.data.language',
|
'modules.data.language',
|
||||||
|
|
||||||
@@ -91,12 +91,13 @@ return {
|
|||||||
'modules.gui.task-list',
|
'modules.gui.task-list',
|
||||||
'modules.gui.player-list',
|
'modules.gui.player-list',
|
||||||
'modules.gui.server-ups',
|
'modules.gui.server-ups',
|
||||||
|
'modules.gui.bonus',
|
||||||
'modules.gui.vlayer',
|
'modules.gui.vlayer',
|
||||||
'modules.gui.research',
|
'modules.gui.research',
|
||||||
'modules.gui.module',
|
'modules.gui.module',
|
||||||
'modules.gui.playerdata',
|
'modules.gui.playerdata',
|
||||||
'modules.gui.surveillance',
|
'modules.gui.surveillance',
|
||||||
'modules.graftorio.require', -- graftorio
|
'modules.graftorio.require', -- graftorio
|
||||||
'modules.gui.toolbar', -- must be loaded last to register toolbar handlers
|
'modules.gui.toolbar', -- must be loaded last to register toolbar handlers
|
||||||
|
|
||||||
--- Config Files
|
--- Config Files
|
||||||
|
|||||||
448
config/bonus.lua
448
config/bonus.lua
@@ -2,222 +2,308 @@
|
|||||||
-- @config Bonuses
|
-- @config Bonuses
|
||||||
|
|
||||||
return {
|
return {
|
||||||
-- level of player bonus for lower roles, 1 level is 10 %
|
--[[
|
||||||
player_bonus_level = 1,
|
TODO
|
||||||
|
force bonus
|
||||||
|
vlayer battery recharge (auto)
|
||||||
|
quick health regeneration
|
||||||
|
|
||||||
|
Base point is equal to the amount of standard value in each parameter.
|
||||||
|
|
||||||
|
CMMS CRS CCS CISB CHB CRDB
|
||||||
|
STD 30 90 32 20 16 12
|
||||||
|
= 200
|
||||||
|
|
||||||
|
MAX 60 180 64 40 32 24
|
||||||
|
= 400
|
||||||
|
]]
|
||||||
|
pts = {
|
||||||
|
base = 200
|
||||||
|
},
|
||||||
|
gui_display_width = {
|
||||||
|
half = 180,
|
||||||
|
label = 80,
|
||||||
|
slider = 200,
|
||||||
|
count = 80
|
||||||
|
},
|
||||||
|
conversion = {
|
||||||
|
['cmms'] = 'character_mining_speed_modifier',
|
||||||
|
['crs'] = 'character_running_speed_modifier',
|
||||||
|
['ccs'] = 'character_crafting_speed_modifier',
|
||||||
|
['cisb'] = 'character_inventory_slots_bonus',
|
||||||
|
['chb'] = 'character_health_bonus',
|
||||||
|
['crdb'] = 'character_reach_distance_bonus'
|
||||||
|
--[[
|
||||||
|
['cpdb'] = 'character_item_pickup_distance_bonus'
|
||||||
|
]]
|
||||||
|
},
|
||||||
player_bonus = {
|
player_bonus = {
|
||||||
{
|
['character_mining_speed_modifier'] = {
|
||||||
name = 'character_mining_speed_modifier',
|
value = 3,
|
||||||
enabled = true,
|
max = 6,
|
||||||
min = 0,
|
scale = 0.5,
|
||||||
max = 2
|
cost_scale = 1,
|
||||||
|
cost = 10,
|
||||||
|
is_percentage = true
|
||||||
},
|
},
|
||||||
{
|
['character_running_speed_modifier'] = {
|
||||||
name = 'character_running_speed_modifier',
|
value = 1.5,
|
||||||
enabled = true,
|
max = 3,
|
||||||
min = 0,
|
scale = 0.25,
|
||||||
max = 1.5
|
cost_scale = 1,
|
||||||
|
cost = 60,
|
||||||
|
is_percentage = true
|
||||||
},
|
},
|
||||||
{
|
['character_crafting_speed_modifier'] = {
|
||||||
name = 'character_crafting_speed_modifier',
|
value = 8,
|
||||||
enabled = true,
|
max = 16,
|
||||||
min = 0,
|
scale = 1,
|
||||||
max = 5
|
cost_scale = 1,
|
||||||
|
cost = 4,
|
||||||
|
is_percentage = true
|
||||||
},
|
},
|
||||||
{
|
['character_inventory_slots_bonus'] = {
|
||||||
name = 'character_reach_distance_bonus',
|
value = 100,
|
||||||
enabled = true,
|
max = 200,
|
||||||
min = 0,
|
scale = 10,
|
||||||
max = 10
|
cost_scale = 10,
|
||||||
|
cost = 2,
|
||||||
|
is_percentage = false
|
||||||
},
|
},
|
||||||
{
|
['character_health_bonus'] = {
|
||||||
name = 'character_resource_reach_distance_bonus',
|
value = 200,
|
||||||
enabled = true,
|
max = 400,
|
||||||
min = 0,
|
scale = 50,
|
||||||
max = 10
|
cost_scale = 50,
|
||||||
|
cost = 4,
|
||||||
|
is_percentage = false
|
||||||
},
|
},
|
||||||
{
|
['character_reach_distance_bonus'] = {
|
||||||
name = 'character_build_distance_bonus',
|
value = 12,
|
||||||
enabled = true,
|
max = 24,
|
||||||
min = 0,
|
scale = 2,
|
||||||
max = 10
|
cost_scale = 1,
|
||||||
|
cost = 1,
|
||||||
|
is_percentage = false,
|
||||||
|
combined_bonus = {
|
||||||
|
'character_resource_reach_distance_bonus',
|
||||||
|
'character_build_distance_bonus'
|
||||||
|
}
|
||||||
},
|
},
|
||||||
{
|
--[[
|
||||||
name = 'character_item_pickup_distance_bonus',
|
['character_item_pickup_distance_bonus'] = {
|
||||||
enabled = false,
|
value = 0,
|
||||||
min = 0,
|
max = 20,
|
||||||
max = 0
|
scale = 1,
|
||||||
|
cost_scale = 1,
|
||||||
|
cost = 1,
|
||||||
|
is_percentage = false
|
||||||
},
|
},
|
||||||
{
|
['character_loot_pickup_distance_bonus'] = {
|
||||||
name = 'character_loot_pickup_distance_bonus',
|
value = 0,
|
||||||
enabled = false,
|
max = 20,
|
||||||
min = 0,
|
scale = 1,
|
||||||
max = 0
|
cost_scale = 1,
|
||||||
|
cost = 1,
|
||||||
|
is_percentage = false
|
||||||
},
|
},
|
||||||
{
|
['character_item_drop_distance_bonus'] = {
|
||||||
name = 'character_item_drop_distance_bonus',
|
value = 0,
|
||||||
enabled = false,
|
max = 20,
|
||||||
min = 0,
|
scale = 1,
|
||||||
max = 5
|
cost_scale = 1,
|
||||||
},
|
cost = 1,
|
||||||
{
|
is_percentage = false
|
||||||
name = 'character_inventory_slots_bonus',
|
|
||||||
enabled = true,
|
|
||||||
min = 0,
|
|
||||||
max = 100
|
|
||||||
},
|
|
||||||
{
|
|
||||||
name = 'character_health_bonus',
|
|
||||||
enabled = true,
|
|
||||||
min = 0,
|
|
||||||
max = 200
|
|
||||||
}
|
}
|
||||||
|
]]
|
||||||
},
|
},
|
||||||
force_bonus = {
|
force_bonus = {
|
||||||
{
|
--[[
|
||||||
name = 'manual_mining_speed_modifier',
|
['character_mining_speed_modifier'] = {
|
||||||
enabled = false,
|
value = 0,
|
||||||
min = 0,
|
max = 6,
|
||||||
max = 2
|
scale = 0.5,
|
||||||
|
cost_scale = 1,
|
||||||
|
cost = 10,
|
||||||
|
is_percentage = true
|
||||||
},
|
},
|
||||||
{
|
['character_running_speed_modifier'] = {
|
||||||
name = 'character_running_speed_modifier',
|
value = 0,
|
||||||
enabled = false,
|
max = 3,
|
||||||
min = 0,
|
scale = 0.25,
|
||||||
max = 1
|
cost_scale = 1,
|
||||||
|
cost = 40,
|
||||||
|
is_percentage = true
|
||||||
},
|
},
|
||||||
{
|
['character_crafting_speed_modifier'] = {
|
||||||
name = 'character_crafting_speed_modifier',
|
value = 0,
|
||||||
enabled = false,
|
max = 16,
|
||||||
min = 0,
|
scale = 1,
|
||||||
max = 5
|
cost_scale = 1,
|
||||||
|
cost = 4,
|
||||||
|
is_percentage = true
|
||||||
},
|
},
|
||||||
{
|
['character_inventory_slots_bonus'] = {
|
||||||
name = 'character_reach_distance_bonus',
|
value = 0,
|
||||||
enabled = false,
|
max = 200,
|
||||||
min = 0,
|
scale = 10,
|
||||||
max = 10
|
cost_scale = 100,
|
||||||
|
cost = 2,
|
||||||
|
is_percentage = false
|
||||||
},
|
},
|
||||||
{
|
['character_health_bonus'] = {
|
||||||
name = 'character_resource_reach_distance_bonus',
|
value = 0,
|
||||||
enabled = false,
|
max = 400,
|
||||||
min = 0,
|
scale = 50,
|
||||||
max = 10
|
cost = 4,
|
||||||
|
is_percentage = false
|
||||||
},
|
},
|
||||||
{
|
['character_reach_distance_bonus'] = {
|
||||||
name = 'character_build_distance_bonus',
|
value = 0,
|
||||||
enabled = false,
|
max = 24,
|
||||||
min = 0,
|
scale = 2,
|
||||||
max = 10
|
cost_scale = 1,
|
||||||
|
cost = 1,
|
||||||
|
is_percentage = false,
|
||||||
|
combined_bonus = {
|
||||||
|
'character_resource_reach_distance_bonus',
|
||||||
|
'character_build_distance_bonus'
|
||||||
|
}
|
||||||
},
|
},
|
||||||
{
|
['worker_robots_speed_modifier'] = {
|
||||||
name = 'character_item_pickup_distance_bonus',
|
value = 0,
|
||||||
enabled = false,
|
max = 0,
|
||||||
min = 0,
|
scale = 0,
|
||||||
max = 0
|
cost_scale = 1,
|
||||||
|
cost = 1,
|
||||||
|
is_percentage = false
|
||||||
},
|
},
|
||||||
{
|
]]
|
||||||
name = 'character_loot_pickup_distance_bonus',
|
['worker_robots_battery_modifier'] = {
|
||||||
enabled = false,
|
value = 1,
|
||||||
min = 0,
|
max = 1,
|
||||||
max = 0
|
scale = 1,
|
||||||
|
cost_scale = 1,
|
||||||
|
cost = 1,
|
||||||
|
is_percentage = false
|
||||||
},
|
},
|
||||||
{
|
['worker_robots_storage_bonus'] = {
|
||||||
name = 'character_item_drop_distance_bonus',
|
value = 1,
|
||||||
enabled = false,
|
max = 1,
|
||||||
min = 0,
|
scale = 1,
|
||||||
max = 5
|
cost_scale = 1,
|
||||||
|
cost = 1,
|
||||||
|
is_percentage = false
|
||||||
},
|
},
|
||||||
{
|
['following_robots_lifetime_modifier'] = {
|
||||||
name = 'character_inventory_slots_bonus',
|
value = 1,
|
||||||
enabled = false,
|
max = 1,
|
||||||
min = 0,
|
scale = 1,
|
||||||
max = 100
|
cost_scale = 1,
|
||||||
|
cost = 1,
|
||||||
|
is_percentage = false
|
||||||
},
|
},
|
||||||
{
|
--[[
|
||||||
name = 'character_health_bonus',
|
['character_item_pickup_distance_bonus'] = {
|
||||||
enabled = false,
|
value = 0,
|
||||||
min = 0,
|
max = 20,
|
||||||
max = 200
|
scale = 1,
|
||||||
|
cost_scale = 1,
|
||||||
|
cost = 1,
|
||||||
|
is_percentage = false
|
||||||
},
|
},
|
||||||
{
|
['character_loot_pickup_distance_bonus'] = {
|
||||||
name = 'worker_robots_speed_modifier',
|
value = 0,
|
||||||
enabled = false,
|
max = 20,
|
||||||
min = 0,
|
scale = 1,
|
||||||
max = 1.3
|
cost_scale = 1,
|
||||||
|
cost = 1,
|
||||||
|
is_percentage = false
|
||||||
},
|
},
|
||||||
{
|
['character_item_drop_distance_bonus'] = {
|
||||||
name = 'worker_robots_battery_modifier',
|
value = 0,
|
||||||
enabled = true,
|
max = 20,
|
||||||
min = 0,
|
scale = 1,
|
||||||
max = 1
|
cost_scale = 1,
|
||||||
|
cost = 1,
|
||||||
|
is_percentage = false
|
||||||
},
|
},
|
||||||
{
|
['character_trash_slot_count'] = {
|
||||||
name = 'worker_robots_storage_bonus',
|
value = 0,
|
||||||
enabled = true,
|
max = 0,
|
||||||
min = 0,
|
scale = 0,
|
||||||
max = 1
|
cost_scale = 1,
|
||||||
|
cost = 1,
|
||||||
|
is_percentage = false
|
||||||
},
|
},
|
||||||
{
|
['mining_drill_productivity_bonus'] = {
|
||||||
name = 'following_robots_lifetime_modifier',
|
value = 0,
|
||||||
enabled = true,
|
max = 0,
|
||||||
min = 0,
|
scale = 0,
|
||||||
max = 1
|
cost_scale = 1,
|
||||||
|
cost = 1,
|
||||||
|
is_percentage = false
|
||||||
},
|
},
|
||||||
{
|
['train_braking_force_bonus'] = {
|
||||||
name = 'character_trash_slot_count',
|
value = 0,
|
||||||
enabled = false,
|
max = 0,
|
||||||
min = 0,
|
scale = 0,
|
||||||
max = 20
|
cost_scale = 1,
|
||||||
|
cost = 1,
|
||||||
|
is_percentage = false
|
||||||
},
|
},
|
||||||
{
|
['laboratory_speed_modifier'] = {
|
||||||
name = 'mining_drill_productivity_bonus',
|
value = 0,
|
||||||
enabled = false,
|
max = 0,
|
||||||
min = 0,
|
scale = 0,
|
||||||
max = 0
|
cost_scale = 1,
|
||||||
|
cost = 1,
|
||||||
|
is_percentage = false
|
||||||
},
|
},
|
||||||
{
|
['laboratory_productivity_bonus'] = {
|
||||||
name = 'train_braking_force_bonus',
|
value = 0,
|
||||||
enabled = false,
|
max = 0,
|
||||||
min = 0,
|
scale = 0,
|
||||||
max = 0
|
cost_scale = 1,
|
||||||
|
cost = 1,
|
||||||
|
is_percentage = false
|
||||||
},
|
},
|
||||||
{
|
['inserter_stack_size_bonus'] = {
|
||||||
name = 'laboratory_speed_modifier',
|
value = 0,
|
||||||
enabled = false,
|
max = 0,
|
||||||
min = 0,
|
scale = 0,
|
||||||
max = 0
|
cost_scale = 1,
|
||||||
|
cost = 1,
|
||||||
|
is_percentage = false
|
||||||
},
|
},
|
||||||
{
|
['stack_inserter_capacity_bonus'] = {
|
||||||
name = 'laboratory_productivity_bonus',
|
value = 0,
|
||||||
enabled = false,
|
max = 0,
|
||||||
min = 0,
|
scale = 0,
|
||||||
max = 0
|
cost_scale = 1,
|
||||||
|
cost = 1,
|
||||||
|
is_percentage = false
|
||||||
},
|
},
|
||||||
{
|
['artillery_range_modifier'] = {
|
||||||
name = 'inserter_stack_size_bonus',
|
value = 0,
|
||||||
enabled = false,
|
max = 0,
|
||||||
min = 0,
|
scale = 0,
|
||||||
max = 0
|
cost_scale = 1,
|
||||||
},
|
cost = 1,
|
||||||
{
|
is_percentage = false
|
||||||
name = 'stack_inserter_capacity_bonus',
|
|
||||||
enabled = false,
|
|
||||||
min = 0,
|
|
||||||
max = 0
|
|
||||||
},
|
|
||||||
{
|
|
||||||
name = 'artillery_range_modifier',
|
|
||||||
enabled = false,
|
|
||||||
min = 0,
|
|
||||||
max = 0
|
|
||||||
}
|
}
|
||||||
|
]]
|
||||||
},
|
},
|
||||||
surface_bonus = {
|
surface_bonus = {
|
||||||
{
|
--[[
|
||||||
name = 'solar_power_multiplier',
|
['solar_power_multiplier'] = {
|
||||||
enabled = false,
|
value = 1,
|
||||||
min = 0,
|
max = 1000,
|
||||||
max = 0
|
scale = 1,
|
||||||
|
cost_scale = 1,
|
||||||
|
cost = 1,
|
||||||
|
is_percentage = false
|
||||||
}
|
}
|
||||||
|
]]
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -54,7 +54,7 @@ Roles.new_role('Administrator','Admin')
|
|||||||
'gui/warp-list/bypass-proximity',
|
'gui/warp-list/bypass-proximity',
|
||||||
'gui/warp-list/bypass-cooldown',
|
'gui/warp-list/bypass-cooldown',
|
||||||
'command/connect-all',
|
'command/connect-all',
|
||||||
'command/collectdata'
|
'command/collectdata'
|
||||||
}
|
}
|
||||||
|
|
||||||
Roles.new_role('Moderator','Mod')
|
Roles.new_role('Moderator','Mod')
|
||||||
@@ -75,8 +75,8 @@ Roles.new_role('Moderator','Mod')
|
|||||||
'command/clear-reports',
|
'command/clear-reports',
|
||||||
'command/clear-warnings',
|
'command/clear-warnings',
|
||||||
'command/clear-inventory',
|
'command/clear-inventory',
|
||||||
'command/bonus',
|
-- 'command/bonus',
|
||||||
'command/bonus/2',
|
'gui/bonus',
|
||||||
'command/home',
|
'command/home',
|
||||||
'command/home-set',
|
'command/home-set',
|
||||||
'command/home-get',
|
'command/home-get',
|
||||||
@@ -165,8 +165,8 @@ Roles.new_role('Sponsor','Spon')
|
|||||||
:allow{
|
:allow{
|
||||||
'gui/rocket-info/toggle-active',
|
'gui/rocket-info/toggle-active',
|
||||||
'gui/rocket-info/remote_launch',
|
'gui/rocket-info/remote_launch',
|
||||||
'command/bonus',
|
-- 'command/bonus',
|
||||||
'command/bonus/2',
|
'gui/bonus',
|
||||||
'command/home',
|
'command/home',
|
||||||
'command/home-set',
|
'command/home-set',
|
||||||
'command/home-get',
|
'command/home-get',
|
||||||
|
|||||||
@@ -56,7 +56,6 @@ result=__1__ entites were revived and __2__ were healed to max health.
|
|||||||
[expcom-bonus]
|
[expcom-bonus]
|
||||||
set=Your bonus has been set to __1__.
|
set=Your bonus has been set to __1__.
|
||||||
perm=You dont have enough permission to set more than __1__.
|
perm=You dont have enough permission to set more than __1__.
|
||||||
wip=This command is temporary and will be replaced at some point in the future.
|
|
||||||
|
|
||||||
[expcom-ratio]
|
[expcom-ratio]
|
||||||
notSelecting=Please select an entity with a recipe.
|
notSelecting=Please select an entity with a recipe.
|
||||||
|
|||||||
@@ -60,7 +60,7 @@ main-tooltip=Science Info
|
|||||||
eta-caption=ETA:
|
eta-caption=ETA:
|
||||||
eta-tooltip=The estimated time left for the current research
|
eta-tooltip=The estimated time left for the current research
|
||||||
eta-time=T- __1__
|
eta-time=T- __1__
|
||||||
unit=__1__spm
|
unit=__1__ spm
|
||||||
pos-tooltip=Total made: __1__
|
pos-tooltip=Total made: __1__
|
||||||
neg-tooltip=Total used: __1__
|
neg-tooltip=Total used: __1__
|
||||||
net-tooltip=Total net: __1__
|
net-tooltip=Total net: __1__
|
||||||
@@ -209,6 +209,47 @@ enabled=enabled
|
|||||||
disabled=disabled
|
disabled=disabled
|
||||||
toggle-msg=Fast decon has been __1__
|
toggle-msg=Fast decon has been __1__
|
||||||
|
|
||||||
|
[bonus]
|
||||||
|
main-tooltip=Bonus
|
||||||
|
control-pts-a=Points available
|
||||||
|
control-pts-n=Points needed
|
||||||
|
control-pts-r=Points remaining
|
||||||
|
control-reset=Reset
|
||||||
|
control-apply=Apply
|
||||||
|
control-pts-exceed=Points allocated exceeded allowance
|
||||||
|
display-cmms=Mining
|
||||||
|
display-cmms-tooltip=Character manual mining speed
|
||||||
|
display-crs=Running
|
||||||
|
display-crs-tooltip=Character running speed
|
||||||
|
display-ccs=Crafting
|
||||||
|
display-ccs-tooltip=Character crafting speed
|
||||||
|
display-cisb=Inventory
|
||||||
|
display-cisb-tooltip=Character inventory slots bonus
|
||||||
|
display-chb=Health
|
||||||
|
display-chb-tooltip=Character health bonus
|
||||||
|
display-crdb=Reach
|
||||||
|
display-crdb-tooltip=Character reach distance bonus
|
||||||
|
display-fmms=Mining
|
||||||
|
display-fmms-tooltip=Force manual mining speed
|
||||||
|
display-frs=Running
|
||||||
|
display-frs-tooltip=Force running speed
|
||||||
|
display-fcs=Crafting
|
||||||
|
display-fcs-tooltip=Force crafting speed
|
||||||
|
display-fisb=Inventory
|
||||||
|
display-fisb-tooltip=Force inventory slots bonus
|
||||||
|
display-fhb=Health
|
||||||
|
display-fhb-tooltip=Force health bonus
|
||||||
|
display-frdb=Reach
|
||||||
|
display-frdb-tooltip=Force reach distance bonus
|
||||||
|
display-fwrsm=Robot Speed
|
||||||
|
display-fwrsm-tooltip=Force worker robots speed modifier
|
||||||
|
display-fwrbm=Robot Battery
|
||||||
|
display-fwrbm-tooltip=Force worker robots battery modifier
|
||||||
|
display-fwrsb=Robot Storage
|
||||||
|
display-fwrsb-tooltip=Force worker robots storage bonus
|
||||||
|
display-ffrlm=Robot Lifetime
|
||||||
|
display-ffrlm-tooltip=Force following robots lifetime modifier
|
||||||
|
|
||||||
[vlayer]
|
[vlayer]
|
||||||
main-tooltip=Vlayer
|
main-tooltip=Vlayer
|
||||||
display-item-solar=[img=entity/solar-panel] Solar Panel
|
display-item-solar=[img=entity/solar-panel] Solar Panel
|
||||||
|
|||||||
@@ -214,40 +214,40 @@ main-tooltip=Bonus 介面
|
|||||||
control-pts-a=可用分數
|
control-pts-a=可用分數
|
||||||
control-pts-n=必要分數
|
control-pts-n=必要分數
|
||||||
control-pts-r=餘下分數
|
control-pts-r=餘下分數
|
||||||
control-refresh=刷新
|
control-reset=重置
|
||||||
control-apply=套用
|
control-apply=套用
|
||||||
control-pts-exceed=分數超出可用上限
|
control-pts-exceed=分數超出可用上限
|
||||||
display-cmms=CMMS
|
display-cmms=挖掘速度
|
||||||
display-cmms-tooltip=個人挖掘速度
|
display-cmms-tooltip=個人挖掘速度
|
||||||
display-crs=CRS
|
display-crs=跑步速度
|
||||||
display-crs-tooltip=個人跑步速度
|
display-crs-tooltip=個人跑步速度
|
||||||
display-ccs=CCS
|
display-ccs=合成速度
|
||||||
display-ccs-tooltip=個人合成速度
|
display-ccs-tooltip=個人合成速度
|
||||||
display-cisb=CISB
|
display-cisb=儲存位
|
||||||
display-cisb-tooltip=個人儲存位
|
display-cisb-tooltip=個人儲存位
|
||||||
display-chb=CHB
|
display-chb=生命
|
||||||
display-chb-tooltip=個人生命
|
display-chb-tooltip=個人生命
|
||||||
display-crdb=CRDB
|
display-crdb=到達距離
|
||||||
display-crdb-tooltip=個人到達距離
|
display-crdb-tooltip=個人到達距離
|
||||||
display-fmms=FMMS
|
display-fmms=挖掘速度
|
||||||
display-fmms-tooltip=勢力挖掘速度
|
display-fmms-tooltip=勢力挖掘速度
|
||||||
display-frs=FRS
|
display-frs=跑步速度
|
||||||
display-frs-tooltip=勢力跑步速度
|
display-frs-tooltip=勢力跑步速度
|
||||||
display-fcs=FCS
|
display-fcs=合成速度
|
||||||
display-fcs-tooltip=勢力合成速度
|
display-fcs-tooltip=勢力合成速度
|
||||||
display-fisb=FISB
|
display-fisb=儲存位
|
||||||
display-fisb-tooltip=勢力儲存位
|
display-fisb-tooltip=勢力儲存位
|
||||||
display-fhb=FHB
|
display-fhb=生命
|
||||||
display-fhb-tooltip=勢力生命
|
display-fhb-tooltip=勢力生命
|
||||||
display-frdb=FRDB
|
display-frdb=到達距離
|
||||||
display-frdb-tooltip=勢力到達距離
|
display-frdb-tooltip=勢力到達距離
|
||||||
display-fwrsm=FWRSM
|
display-fwrsm=機械人速度
|
||||||
display-fwrsm-tooltip=勢力機械人速度
|
display-fwrsm-tooltip=勢力機械人速度
|
||||||
display-fwrbm=FWRBM
|
display-fwrbm=機械人電力
|
||||||
display-fwrbm-tooltip=勢力機械人電力
|
display-fwrbm-tooltip=勢力機械人電力
|
||||||
display-fwrsb=FWRSB
|
display-fwrsb=械人儲存
|
||||||
display-fwrsb-tooltip=勢力機械人儲存
|
display-fwrsb-tooltip=勢力機械人儲存
|
||||||
display-ffrlm=FFRLM
|
display-ffrlm=機械人生命
|
||||||
display-ffrlm-tooltip=勢力戰鬥機械人生命時間
|
display-ffrlm-tooltip=勢力戰鬥機械人生命時間
|
||||||
|
|
||||||
[vlayer]
|
[vlayer]
|
||||||
|
|||||||
@@ -214,40 +214,40 @@ main-tooltip=Bonus 介面
|
|||||||
control-pts-a=可用分數
|
control-pts-a=可用分數
|
||||||
control-pts-n=必要分數
|
control-pts-n=必要分數
|
||||||
control-pts-r=餘下分數
|
control-pts-r=餘下分數
|
||||||
control-refresh=刷新
|
control-reset=重置
|
||||||
control-apply=套用
|
control-apply=套用
|
||||||
control-pts-exceed=分數超出可用上限
|
control-pts-exceed=分數超出可用上限
|
||||||
display-cmms=CMMS
|
display-cmms=挖掘速度
|
||||||
display-cmms-tooltip=個人挖掘速度
|
display-cmms-tooltip=個人挖掘速度
|
||||||
display-crs=CRS
|
display-crs=跑步速度
|
||||||
display-crs-tooltip=個人跑步速度
|
display-crs-tooltip=個人跑步速度
|
||||||
display-ccs=CCS
|
display-ccs=合成速度
|
||||||
display-ccs-tooltip=個人合成速度
|
display-ccs-tooltip=個人合成速度
|
||||||
display-cisb=CISB
|
display-cisb=儲存位
|
||||||
display-cisb-tooltip=個人儲存位
|
display-cisb-tooltip=個人儲存位
|
||||||
display-chb=CHB
|
display-chb=生命
|
||||||
display-chb-tooltip=個人生命
|
display-chb-tooltip=個人生命
|
||||||
display-crdb=CRDB
|
display-crdb=到達距離
|
||||||
display-crdb-tooltip=個人到達距離
|
display-crdb-tooltip=個人到達距離
|
||||||
display-fmms=FMMS
|
display-fmms=挖掘速度
|
||||||
display-fmms-tooltip=勢力挖掘速度
|
display-fmms-tooltip=勢力挖掘速度
|
||||||
display-frs=FRS
|
display-frs=跑步速度
|
||||||
display-frs-tooltip=勢力跑步速度
|
display-frs-tooltip=勢力跑步速度
|
||||||
display-fcs=FCS
|
display-fcs=合成速度
|
||||||
display-fcs-tooltip=勢力合成速度
|
display-fcs-tooltip=勢力合成速度
|
||||||
display-fisb=FISB
|
display-fisb=儲存位
|
||||||
display-fisb-tooltip=勢力儲存位
|
display-fisb-tooltip=勢力儲存位
|
||||||
display-fhb=FHB
|
display-fhb=生命
|
||||||
display-fhb-tooltip=勢力生命
|
display-fhb-tooltip=勢力生命
|
||||||
display-frdb=FRDB
|
display-frdb=到達距離
|
||||||
display-frdb-tooltip=勢力到達距離
|
display-frdb-tooltip=勢力到達距離
|
||||||
display-fwrsm=FWRSM
|
display-fwrsm=機械人速度
|
||||||
display-fwrsm-tooltip=勢力機械人速度
|
display-fwrsm-tooltip=勢力機械人速度
|
||||||
display-fwrbm=FWRBM
|
display-fwrbm=機械人電力
|
||||||
display-fwrbm-tooltip=勢力機械人電力
|
display-fwrbm-tooltip=勢力機械人電力
|
||||||
display-fwrsb=FWRSB
|
display-fwrsb=械人儲存
|
||||||
display-fwrsb-tooltip=勢力機械人儲存
|
display-fwrsb-tooltip=勢力機械人儲存
|
||||||
display-ffrlm=FFRLM
|
display-ffrlm=機械人生命
|
||||||
display-ffrlm-tooltip=勢力戰鬥機械人生命時間
|
display-ffrlm-tooltip=勢力戰鬥機械人生命時間
|
||||||
|
|
||||||
[vlayer]
|
[vlayer]
|
||||||
|
|||||||
@@ -30,12 +30,12 @@ local function apply_bonus(player, stage)
|
|||||||
return
|
return
|
||||||
end
|
end
|
||||||
|
|
||||||
for _, v in pairs(config.player_bonus) do
|
for k, v in pairs(config.player_bonus) do
|
||||||
if v.enabled then
|
player[k] = v.value * stage / 10
|
||||||
if stage == 0 then
|
|
||||||
player[v.name] = v.min
|
if v.combined_bonus then
|
||||||
else
|
for i=1, #v.combined_bonus, 1 do
|
||||||
player[v.name] = v.min + (v.max - v.min) * stage / 10
|
player[v.combined_bonus[i]] = v.value * stage / 10
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
@@ -52,16 +52,9 @@ end)
|
|||||||
Commands.new_command('bonus', 'Changes the amount of bonus you receive')
|
Commands.new_command('bonus', 'Changes the amount of bonus you receive')
|
||||||
:add_param('amount', 'integer-range', 0, 10)
|
:add_param('amount', 'integer-range', 0, 10)
|
||||||
:register(function(player, amount)
|
:register(function(player, amount)
|
||||||
if amount > config.player_bonus_level then
|
if not Roles.player_allowed(player, 'command/bonus') then
|
||||||
if not Roles.player_allowed(player, 'command/bonus/2') then
|
Commands.print{'expcom-bonus.perm', 1}
|
||||||
Commands.print{'expcom-bonus.perm', 2}
|
return
|
||||||
return
|
|
||||||
end
|
|
||||||
elseif amount <= config.player_bonus_level then
|
|
||||||
if not Roles.player_allowed(player, 'command/bonus') then
|
|
||||||
Commands.print{'expcom-bonus.perm', 1}
|
|
||||||
return
|
|
||||||
end
|
|
||||||
end
|
end
|
||||||
|
|
||||||
PlayerBonus:set(player, amount)
|
PlayerBonus:set(player, amount)
|
||||||
@@ -97,16 +90,12 @@ Event.add(defines.events.on_player_created, function(event)
|
|||||||
return
|
return
|
||||||
end
|
end
|
||||||
|
|
||||||
for _, v in pairs(config.force_bonus) do
|
for k, v in pairs(config.force_bonus) do
|
||||||
if v.enabled then
|
game.players[event.player_index].force[k] = v.value
|
||||||
game.players[event.player_index].force[v.name] = game.players[event.player_index].force[v.name] + v.max
|
|
||||||
end
|
|
||||||
end
|
end
|
||||||
|
|
||||||
for _, v in pairs(config.surface_bonus) do
|
for k, v in pairs(config.surface_bonus) do
|
||||||
if v.enabled then
|
game.players[event.player_index].surface[k] = v.value
|
||||||
game.players[event.player_index].surface[v.name] = game.players[event.player_index].surface[v.name] + v.max
|
|
||||||
end
|
|
||||||
end
|
end
|
||||||
end)
|
end)
|
||||||
|
|
||||||
|
|||||||
345
modules/gui/bonus.lua
Normal file
345
modules/gui/bonus.lua
Normal file
@@ -0,0 +1,345 @@
|
|||||||
|
--[[-- Gui Module - Bonus
|
||||||
|
@gui Bonus
|
||||||
|
@alias bonus_container
|
||||||
|
]]
|
||||||
|
|
||||||
|
local Gui = require 'expcore.gui' --- @dep expcore.gui
|
||||||
|
local Roles = require 'expcore.roles' --- @dep expcore.roles
|
||||||
|
local Event = require 'utils.event' --- @dep utils.event
|
||||||
|
local config = require 'config.bonus' --- @dep config.bonus
|
||||||
|
local format_number = require('util').format_number --- @dep util
|
||||||
|
local bonus_container
|
||||||
|
|
||||||
|
local function bonus_gui_pts_needed(player)
|
||||||
|
local frame = Gui.get_left_element(player, bonus_container)
|
||||||
|
local disp = frame.container['bonus_st_2'].disp.table
|
||||||
|
local total = 0
|
||||||
|
|
||||||
|
for k, v in pairs(config.conversion) do
|
||||||
|
total = total + (disp['bonus_display_' .. k .. '_slider'].slider_value / config.player_bonus[v].cost_scale * config.player_bonus[v].cost)
|
||||||
|
end
|
||||||
|
|
||||||
|
return total
|
||||||
|
end
|
||||||
|
|
||||||
|
local function apply_bonus(player)
|
||||||
|
if not Roles.player_allowed(player, 'gui/bonus') then
|
||||||
|
for k, v in pairs(config.player_bonus) do
|
||||||
|
player[k] = 0
|
||||||
|
|
||||||
|
if v.combined_bonus then
|
||||||
|
for i=1, #v.combined_bonus do
|
||||||
|
player[v.combined_bonus[i]] = 0
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
return
|
||||||
|
end
|
||||||
|
|
||||||
|
if not player.character then
|
||||||
|
return
|
||||||
|
end
|
||||||
|
|
||||||
|
local frame = Gui.get_left_element(player, bonus_container)
|
||||||
|
local disp = frame.container['bonus_st_2'].disp.table
|
||||||
|
|
||||||
|
for k, v in pairs(config.conversion) do
|
||||||
|
player[v] = disp['bonus_display_' .. k .. '_slider'].slider_value
|
||||||
|
|
||||||
|
if config.player_bonus[v].combined_bonus then
|
||||||
|
for i=1, #config.player_bonus[v].combined_bonus do
|
||||||
|
player[config.player_bonus[v].combined_bonus[i]] = 0
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
--- Control label for the bonus points available
|
||||||
|
-- @element bonus_gui_control_pts_a
|
||||||
|
local bonus_gui_control_pts_a =
|
||||||
|
Gui.element{
|
||||||
|
type = 'label',
|
||||||
|
name = 'bonus_control_pts_a',
|
||||||
|
caption = {'bonus.control-pts-a'},
|
||||||
|
style = 'heading_1_label'
|
||||||
|
}:style{
|
||||||
|
width = config.gui_display_width['half']
|
||||||
|
}
|
||||||
|
|
||||||
|
local bonus_gui_control_pts_a_count =
|
||||||
|
Gui.element{
|
||||||
|
type = 'label',
|
||||||
|
name = 'bonus_control_pts_a_count',
|
||||||
|
caption = config.pts.base,
|
||||||
|
style = 'heading_1_label'
|
||||||
|
}:style{
|
||||||
|
width = config.gui_display_width['half']
|
||||||
|
}
|
||||||
|
|
||||||
|
--- Control label for the bonus points needed
|
||||||
|
-- @element bonus_gui_control_pts_n
|
||||||
|
local bonus_gui_control_pts_n =
|
||||||
|
Gui.element{
|
||||||
|
type = 'label',
|
||||||
|
name = 'bonus_control_pts_n',
|
||||||
|
caption = {'bonus.control-pts-n'},
|
||||||
|
style = 'heading_1_label'
|
||||||
|
}:style{
|
||||||
|
width = config.gui_display_width['half']
|
||||||
|
}
|
||||||
|
|
||||||
|
local bonus_gui_control_pts_n_count =
|
||||||
|
Gui.element{
|
||||||
|
type = 'label',
|
||||||
|
name = 'bonus_control_pts_n_count',
|
||||||
|
caption = '0',
|
||||||
|
style = 'heading_1_label'
|
||||||
|
}:style{
|
||||||
|
width =config.gui_display_width['half']
|
||||||
|
}
|
||||||
|
|
||||||
|
--- Control label for the bonus points remaining
|
||||||
|
-- @element bonus_gui_control_pts_r
|
||||||
|
local bonus_gui_control_pts_r =
|
||||||
|
Gui.element{
|
||||||
|
type = 'label',
|
||||||
|
name = 'bonus_control_pts_r',
|
||||||
|
caption = {'bonus.control-pts-r'},
|
||||||
|
style = 'heading_1_label'
|
||||||
|
}:style{
|
||||||
|
width = config.gui_display_width['half']
|
||||||
|
}
|
||||||
|
|
||||||
|
local bonus_gui_control_pts_r_count =
|
||||||
|
Gui.element{
|
||||||
|
type = 'label',
|
||||||
|
name = 'bonus_control_pts_r_count',
|
||||||
|
caption = '0',
|
||||||
|
style = 'heading_1_label'
|
||||||
|
}:style{
|
||||||
|
width = config.gui_display_width['half']
|
||||||
|
}
|
||||||
|
|
||||||
|
--- A button used for pts calculations
|
||||||
|
-- @element bonus_gui_control_refresh
|
||||||
|
local bonus_gui_control_reset =
|
||||||
|
Gui.element{
|
||||||
|
type = 'button',
|
||||||
|
name = Gui.unique_static_name,
|
||||||
|
caption = {'bonus.control-reset'}
|
||||||
|
}:style{
|
||||||
|
width = config.gui_display_width['half']
|
||||||
|
}:on_click(function(player, element, _)
|
||||||
|
local frame = Gui.get_left_element(player, bonus_container)
|
||||||
|
local disp = frame.container['bonus_st_2'].disp.table
|
||||||
|
|
||||||
|
for k, v in pairs(config.conversion) do
|
||||||
|
local s = 'bonus_display_' .. k .. '_slider'
|
||||||
|
disp[s].slider_value = config.player_bonus[v].value
|
||||||
|
|
||||||
|
if config.player_bonus[v].is_percentage then
|
||||||
|
disp[disp[s].tags.counter].caption = format_number(disp[s].slider_value * 100) .. ' %'
|
||||||
|
|
||||||
|
else
|
||||||
|
disp[disp[s].tags.counter].caption = format_number(disp[s].slider_value)
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
local r = bonus_gui_pts_needed(player)
|
||||||
|
element.parent[bonus_gui_control_pts_n_count.name].caption = r
|
||||||
|
element.parent[bonus_gui_control_pts_r_count.name].caption = tonumber(element.parent[bonus_gui_control_pts_a_count.name].caption) - r
|
||||||
|
end)
|
||||||
|
|
||||||
|
--- A button used for pts apply
|
||||||
|
-- @element bonus_gui_control_apply
|
||||||
|
local bonus_gui_control_apply =
|
||||||
|
Gui.element{
|
||||||
|
type = 'button',
|
||||||
|
name = Gui.unique_static_name,
|
||||||
|
caption = {'bonus.control-apply'}
|
||||||
|
}:style{
|
||||||
|
width = config.gui_display_width['half']
|
||||||
|
}:on_click(function(player, element, _)
|
||||||
|
local n = bonus_gui_pts_needed(player)
|
||||||
|
element.parent[bonus_gui_control_pts_n_count.name].caption = n
|
||||||
|
local r = tonumber(element.parent[bonus_gui_control_pts_a_count.name].caption) - n
|
||||||
|
element.parent[bonus_gui_control_pts_r_count.name].caption = r
|
||||||
|
|
||||||
|
if r >= 0 then
|
||||||
|
apply_bonus(player)
|
||||||
|
end
|
||||||
|
end)
|
||||||
|
|
||||||
|
--- A vertical flow containing all the bonus control
|
||||||
|
-- @element bonus_control_set
|
||||||
|
local bonus_control_set =
|
||||||
|
Gui.element(function(_, parent, name)
|
||||||
|
local bonus_set = parent.add{type='flow', direction='vertical', name=name}
|
||||||
|
local disp = Gui.scroll_table(bonus_set, 360, 2, 'disp')
|
||||||
|
|
||||||
|
bonus_gui_control_pts_a(disp)
|
||||||
|
bonus_gui_control_pts_a_count(disp)
|
||||||
|
|
||||||
|
bonus_gui_control_pts_n(disp)
|
||||||
|
bonus_gui_control_pts_n_count(disp)
|
||||||
|
|
||||||
|
bonus_gui_control_pts_r(disp)
|
||||||
|
bonus_gui_control_pts_r_count(disp)
|
||||||
|
|
||||||
|
bonus_gui_control_reset(disp)
|
||||||
|
bonus_gui_control_apply(disp)
|
||||||
|
|
||||||
|
return bonus_set
|
||||||
|
end)
|
||||||
|
|
||||||
|
--- Display group
|
||||||
|
-- @element bonus_gui_slider
|
||||||
|
local bonus_gui_slider =
|
||||||
|
Gui.element(function(_definition, parent, name, caption, tooltip, bonus)
|
||||||
|
local label = parent.add{
|
||||||
|
type = 'label',
|
||||||
|
caption = caption,
|
||||||
|
tooltip = tooltip,
|
||||||
|
style = 'heading_1_label'
|
||||||
|
}
|
||||||
|
label.style.width = config.gui_display_width['label']
|
||||||
|
|
||||||
|
local value = bonus.value
|
||||||
|
|
||||||
|
if bonus.is_percentage then
|
||||||
|
value = format_number(value * 100) .. ' %'
|
||||||
|
|
||||||
|
else
|
||||||
|
value = format_number(value)
|
||||||
|
end
|
||||||
|
|
||||||
|
local slider = parent.add{
|
||||||
|
type = 'slider',
|
||||||
|
name = name .. '_slider',
|
||||||
|
value = bonus.value,
|
||||||
|
maximum_value = bonus.max,
|
||||||
|
value_step = bonus.scale,
|
||||||
|
discrete_values = true,
|
||||||
|
style = 'notched_slider',
|
||||||
|
tags = {
|
||||||
|
counter = name .. '_count',
|
||||||
|
is_percentage = bonus.is_percentage
|
||||||
|
}
|
||||||
|
}
|
||||||
|
slider.style.width = config.gui_display_width['slider']
|
||||||
|
slider.style.horizontally_stretchable = true
|
||||||
|
|
||||||
|
local count = parent.add{
|
||||||
|
type = 'label',
|
||||||
|
name = name .. '_count',
|
||||||
|
caption = value,
|
||||||
|
style = 'heading_1_label',
|
||||||
|
}
|
||||||
|
count.style.width = config.gui_display_width['count']
|
||||||
|
|
||||||
|
return slider
|
||||||
|
end)
|
||||||
|
:on_value_changed(function(player, element, _event)
|
||||||
|
if element.tags.is_percentage then
|
||||||
|
element.parent[element.tags.counter].caption = format_number(element.slider_value * 100) .. ' %'
|
||||||
|
|
||||||
|
else
|
||||||
|
element.parent[element.tags.counter].caption = format_number(element.slider_value)
|
||||||
|
end
|
||||||
|
|
||||||
|
local r = bonus_gui_pts_needed(player)
|
||||||
|
local frame = Gui.get_left_element(player, bonus_container)
|
||||||
|
local disp = frame.container['bonus_st_1'].disp.table
|
||||||
|
disp[bonus_gui_control_pts_n_count.name].caption = r
|
||||||
|
disp[bonus_gui_control_pts_r_count.name].caption = tonumber(disp[bonus_gui_control_pts_a_count.name].caption) - r
|
||||||
|
end)
|
||||||
|
|
||||||
|
--- A vertical flow containing all the bonus data
|
||||||
|
-- @element bonus_data_set
|
||||||
|
local bonus_data_set =
|
||||||
|
Gui.element(function(_, parent, name)
|
||||||
|
local bonus_set = parent.add{type='flow', direction='vertical', name=name}
|
||||||
|
local disp = Gui.scroll_table(bonus_set, 360, 3, 'disp')
|
||||||
|
|
||||||
|
for k, v in pairs(config.conversion) do
|
||||||
|
bonus_gui_slider(disp, 'bonus_display_' .. k, {'bonus.display-' .. k}, {'bonus.display-' .. k .. '-tooltip'}, config.player_bonus[v])
|
||||||
|
end
|
||||||
|
|
||||||
|
return bonus_set
|
||||||
|
end)
|
||||||
|
|
||||||
|
--- The main container for the bonus gui
|
||||||
|
-- @element bonus_container
|
||||||
|
bonus_container =
|
||||||
|
Gui.element(function(definition, parent)
|
||||||
|
local player = Gui.get_player_from_element(parent)
|
||||||
|
local container = Gui.container(parent, definition.name, 320)
|
||||||
|
|
||||||
|
bonus_control_set(container, 'bonus_st_1')
|
||||||
|
bonus_data_set(container, 'bonus_st_2')
|
||||||
|
|
||||||
|
local frame = Gui.get_left_element(player, bonus_container)
|
||||||
|
local disp = frame.container['bonus_st_1'].disp.table
|
||||||
|
local n = bonus_gui_pts_needed(player)
|
||||||
|
disp[bonus_gui_control_pts_n_count.name].caption = n
|
||||||
|
local r = tonumber(disp[bonus_gui_control_pts_a_count.name].caption) - n
|
||||||
|
disp[bonus_gui_control_pts_r_count.name].caption = r
|
||||||
|
|
||||||
|
apply_bonus(player)
|
||||||
|
return container.parent
|
||||||
|
end)
|
||||||
|
:static_name(Gui.unique_static_name)
|
||||||
|
:add_to_left_flow()
|
||||||
|
|
||||||
|
--- Button on the top flow used to toggle the task list container
|
||||||
|
-- @element toggle_left_element
|
||||||
|
Gui.left_toolbar_button('item/exoskeleton-equipment', {'bonus.main-tooltip'}, bonus_container, function(player)
|
||||||
|
return Roles.player_allowed(player, 'gui/bonus')
|
||||||
|
end)
|
||||||
|
|
||||||
|
Event.add(defines.events.on_player_created, function(event)
|
||||||
|
if event.player_index ~= 1 then
|
||||||
|
return
|
||||||
|
end
|
||||||
|
|
||||||
|
for k, v in pairs(config.force_bonus) do
|
||||||
|
game.players[event.player_index].force[k] = v.value
|
||||||
|
end
|
||||||
|
|
||||||
|
for k, v in pairs(config.surface_bonus) do
|
||||||
|
game.players[event.player_index].surface[k] = v.value
|
||||||
|
end
|
||||||
|
end)
|
||||||
|
|
||||||
|
Event.add(Roles.events.on_role_assigned, function(event)
|
||||||
|
apply_bonus(game.players[event.player_index])
|
||||||
|
end)
|
||||||
|
|
||||||
|
Event.add(Roles.events.on_role_unassigned, function(event)
|
||||||
|
apply_bonus(game.players[event.player_index])
|
||||||
|
end)
|
||||||
|
|
||||||
|
--- When a player respawns re-apply bonus
|
||||||
|
Event.add(defines.events.on_player_respawned, function(event)
|
||||||
|
local player = game.players[event.player_index]
|
||||||
|
local frame = Gui.get_left_element(player, bonus_container)
|
||||||
|
local disp = frame.container['bonus_st_1'].disp.table
|
||||||
|
local n = bonus_gui_pts_needed(player)
|
||||||
|
disp[bonus_gui_control_pts_n_count.name].caption = n
|
||||||
|
local r = tonumber(disp[bonus_gui_control_pts_a_count.name].caption) - n
|
||||||
|
disp[bonus_gui_control_pts_r_count.name].caption = r
|
||||||
|
|
||||||
|
if r >= 0 then
|
||||||
|
apply_bonus(player)
|
||||||
|
end
|
||||||
|
end)
|
||||||
|
|
||||||
|
--- When a player dies allow them to have instant respawn
|
||||||
|
Event.add(defines.events.on_player_died, function(event)
|
||||||
|
local player = game.players[event.player_index]
|
||||||
|
|
||||||
|
if Roles.player_has_flag(player, 'instant-respawn') then
|
||||||
|
player.ticks_to_respawn = 120
|
||||||
|
end
|
||||||
|
end)
|
||||||
Reference in New Issue
Block a user