mirror of
https://github.com/ComfyFactory/ComfyFactorio.git
synced 2025-02-01 13:08:05 +02:00
minor changes to rpg and mtn fortress
This commit is contained in:
parent
7af65b9baf
commit
062d63ca6e
@ -2,6 +2,7 @@ local Utils = require 'utils.core'
|
||||
local Color = require 'utils.color_presets'
|
||||
local Task = require 'utils.task'
|
||||
local Token = require 'utils.token'
|
||||
local IC_Gui = require 'maps.mountain_fortress_v3.ic.gui'
|
||||
|
||||
local Public = {}
|
||||
local random = math.random
|
||||
@ -789,8 +790,8 @@ function Public.remove_invalid_cars(ic)
|
||||
ic.doors[key] = nil
|
||||
end
|
||||
end
|
||||
kick_player_from_surface(ic, car)
|
||||
end
|
||||
kick_player_from_surface(ic, car)
|
||||
end
|
||||
for k, surface in pairs(ic.surfaces) do
|
||||
if not ic.cars[tonumber(surface.name)] then
|
||||
@ -896,56 +897,55 @@ end
|
||||
|
||||
function Public.teleport_players_around(ic)
|
||||
for _, player in pairs(game.connected_players) do
|
||||
if not validate_player(player) then
|
||||
return
|
||||
end
|
||||
if validate_player(player) then
|
||||
if player.surface.find_entity('player-port', player.position) then
|
||||
local door = player.surface.find_entity('player-port', player.position)
|
||||
if validate_entity(door) then
|
||||
local doors = ic.doors
|
||||
local cars = ic.cars
|
||||
|
||||
if player.surface.find_entity('player-port', player.position) then
|
||||
local door = player.surface.find_entity('player-port', player.position)
|
||||
if validate_entity(door) then
|
||||
local doors = ic.doors
|
||||
local cars = ic.cars
|
||||
|
||||
local car = false
|
||||
if doors[door.unit_number] then
|
||||
car = cars[doors[door.unit_number]]
|
||||
end
|
||||
if cars[door.unit_number] then
|
||||
car = cars[door.unit_number]
|
||||
end
|
||||
if not car then
|
||||
return
|
||||
end
|
||||
|
||||
local player_data = get_player_data(ic, player)
|
||||
if player_data.state then
|
||||
player_data.state = player_data.state - 1
|
||||
if player_data.state == 0 then
|
||||
player_data.state = nil
|
||||
local car = false
|
||||
if doors[door.unit_number] then
|
||||
car = cars[doors[door.unit_number]]
|
||||
end
|
||||
return
|
||||
end
|
||||
|
||||
if not validate_entity(car.entity) then
|
||||
return
|
||||
end
|
||||
|
||||
if car.entity.surface.name ~= player.surface.name then
|
||||
if validate_entity(car.entity) and car.owner == player.index then
|
||||
car.entity.minable = true
|
||||
if cars[door.unit_number] then
|
||||
car = cars[door.unit_number]
|
||||
end
|
||||
local surface = car.entity.surface
|
||||
local x_vector = (door.position.x / math.abs(door.position.x)) * 2
|
||||
local position = {car.entity.position.x + x_vector, car.entity.position.y}
|
||||
local surface_position = surface.find_non_colliding_position('character', position, 128, 0.5)
|
||||
if car.entity.type == 'car' or car.entity.name == 'spidertron' then
|
||||
player.teleport(surface_position, surface)
|
||||
player_data.state = 2
|
||||
player.driving = true
|
||||
else
|
||||
player.teleport(surface_position, surface)
|
||||
if not car then
|
||||
return
|
||||
end
|
||||
|
||||
local player_data = get_player_data(ic, player)
|
||||
if player_data.state then
|
||||
player_data.state = player_data.state - 1
|
||||
if player_data.state == 0 then
|
||||
player_data.state = nil
|
||||
end
|
||||
return
|
||||
end
|
||||
|
||||
if not validate_entity(car.entity) then
|
||||
return
|
||||
end
|
||||
|
||||
if car.entity.surface.name ~= player.surface.name then
|
||||
if validate_entity(car.entity) and car.owner == player.index then
|
||||
IC_Gui.remove_toolbar(player)
|
||||
car.entity.minable = true
|
||||
end
|
||||
local surface = car.entity.surface
|
||||
local x_vector = (door.position.x / math.abs(door.position.x)) * 2
|
||||
local position = {car.entity.position.x + x_vector, car.entity.position.y}
|
||||
local surface_position = surface.find_non_colliding_position('character', position, 128, 0.5)
|
||||
if car.entity.type == 'car' or car.entity.name == 'spidertron' then
|
||||
player.teleport(surface_position, surface)
|
||||
player_data.state = 2
|
||||
player.driving = true
|
||||
else
|
||||
player.teleport(surface_position, surface)
|
||||
end
|
||||
player_data.surface = surface.index
|
||||
end
|
||||
player_data.surface = surface.index
|
||||
end
|
||||
end
|
||||
end
|
||||
@ -984,6 +984,7 @@ function Public.use_door_with_entity(ic, player, door)
|
||||
|
||||
local surface = car.surface
|
||||
if validate_entity(car.entity) and car.owner == player.index then
|
||||
IC_Gui.add_toolbar(player)
|
||||
car.entity.minable = false
|
||||
end
|
||||
|
||||
|
354
maps/mountain_fortress_v3/ic/gui.lua
Normal file
354
maps/mountain_fortress_v3/ic/gui.lua
Normal file
@ -0,0 +1,354 @@
|
||||
local ic = require 'maps.mountain_fortress_v3.ic.table'
|
||||
local Color = require 'utils.color_presets'
|
||||
local Gui = require 'utils.gui'
|
||||
local Tabs = require 'comfy_panel.main'
|
||||
|
||||
local Public = {}
|
||||
|
||||
--! Gui Frames
|
||||
local save_button_name = Gui.uid_name()
|
||||
local discard_button_name = Gui.uid_name()
|
||||
local main_frame_name = Gui.uid_name()
|
||||
local main_toolbar_name = Gui.uid_name()
|
||||
|
||||
local function increment(t, k)
|
||||
t[k] = true
|
||||
end
|
||||
|
||||
local function decrement(t, k)
|
||||
t[k] = nil
|
||||
end
|
||||
|
||||
local function create_player_table(this, player)
|
||||
if not this.trust_system[player.index] then
|
||||
this.trust_system[player.index] = {}
|
||||
end
|
||||
return this.trust_system[player.index]
|
||||
end
|
||||
|
||||
local function create_input_element(frame, type, value, items, index)
|
||||
if type == 'slider' then
|
||||
return frame.add({type = 'slider', value = value, minimum_value = 0, maximum_value = 1})
|
||||
end
|
||||
if type == 'boolean' then
|
||||
return frame.add({type = 'checkbox', state = value})
|
||||
end
|
||||
if type == 'dropdown' then
|
||||
return frame.add({type = 'drop-down', name = 'admin_player_select', items = items, selected_index = index})
|
||||
end
|
||||
return frame.add({type = 'text-box', text = value})
|
||||
end
|
||||
|
||||
local function remove_main_frame(main_frame)
|
||||
Gui.remove_data_recursively(main_frame)
|
||||
main_frame.destroy()
|
||||
end
|
||||
|
||||
local function draw_main_frame(player)
|
||||
local this = ic.get()
|
||||
local player_list = create_player_table(this, player)
|
||||
|
||||
local main_frame =
|
||||
player.gui.screen.add(
|
||||
{
|
||||
type = 'frame',
|
||||
name = main_frame_name,
|
||||
caption = 'Car Settings',
|
||||
direction = 'vertical'
|
||||
}
|
||||
)
|
||||
main_frame.auto_center = true
|
||||
local main_frame_style = main_frame.style
|
||||
main_frame_style.width = 400
|
||||
main_frame_style.use_header_filler = true
|
||||
|
||||
local inside_frame = main_frame.add {type = 'frame', style = 'inside_shallow_frame'}
|
||||
local inside_frame_style = inside_frame.style
|
||||
inside_frame_style.padding = 0
|
||||
local inside_table = inside_frame.add {type = 'table', column_count = 1}
|
||||
local inside_table_style = inside_table.style
|
||||
inside_table_style.vertical_spacing = 0
|
||||
|
||||
inside_table.add({type = 'line'})
|
||||
|
||||
local info_text = inside_table.add({type = 'label', caption = 'Trust List'})
|
||||
local info_text_style = info_text.style
|
||||
info_text_style.font = 'default-bold'
|
||||
info_text_style.padding = 0
|
||||
info_text_style.left_padding = 10
|
||||
info_text_style.horizontal_align = 'left'
|
||||
info_text_style.vertical_align = 'bottom'
|
||||
info_text_style.font_color = {0.55, 0.55, 0.99}
|
||||
|
||||
inside_table.add({type = 'line'})
|
||||
|
||||
local settings_frame = inside_table.add({type = 'scroll-pane'})
|
||||
local settings_style = settings_frame.style
|
||||
settings_style.vertically_squashable = true
|
||||
settings_style.bottom_padding = 5
|
||||
settings_style.left_padding = 5
|
||||
settings_style.right_padding = 5
|
||||
settings_style.top_padding = 5
|
||||
|
||||
local settings_grid = settings_frame.add({type = 'table', column_count = 2})
|
||||
|
||||
local accept_label =
|
||||
settings_grid.add(
|
||||
{
|
||||
type = 'label',
|
||||
caption = 'Add a trusted player.',
|
||||
tooltip = ''
|
||||
}
|
||||
)
|
||||
accept_label.tooltip = 'This will allow the given player to join your vehicle.'
|
||||
|
||||
local players = game.connected_players
|
||||
|
||||
local allowed = {}
|
||||
for _, p in pairs(players) do
|
||||
if not player_list[p.name] then
|
||||
allowed[#allowed + 1] = tostring(p.name)
|
||||
end
|
||||
end
|
||||
|
||||
local accept_label_style = accept_label.style
|
||||
accept_label_style.horizontally_stretchable = true
|
||||
accept_label_style.height = 35
|
||||
accept_label_style.vertical_align = 'center'
|
||||
|
||||
local name_input = settings_grid.add({type = 'flow'})
|
||||
local name_input_style = name_input.style
|
||||
name_input_style.height = 35
|
||||
name_input_style.vertical_align = 'center'
|
||||
local trusted_players_input = create_input_element(name_input, 'dropdown', false, allowed, 1)
|
||||
|
||||
local denied = {}
|
||||
local deny_players_input
|
||||
if next(player_list) then
|
||||
for _, p in pairs(player_list) do
|
||||
denied[#denied + 1] = p
|
||||
end
|
||||
|
||||
local deny_label =
|
||||
settings_grid.add(
|
||||
{
|
||||
type = 'label',
|
||||
caption = 'Remove a trusted player.',
|
||||
tooltip = ''
|
||||
}
|
||||
)
|
||||
deny_label.tooltip = 'This will instantly kick the player from your vehicle.'
|
||||
|
||||
local deny_label_style = deny_label.style
|
||||
deny_label_style.horizontally_stretchable = true
|
||||
deny_label_style.height = 35
|
||||
deny_label_style.vertical_align = 'center'
|
||||
|
||||
local deny_input = settings_grid.add({type = 'flow'})
|
||||
local deny_input_style = deny_input.style
|
||||
deny_input_style.height = 35
|
||||
deny_input_style.vertical_align = 'center'
|
||||
deny_players_input = create_input_element(deny_input, 'dropdown', false, denied, 1)
|
||||
end
|
||||
|
||||
local data = {
|
||||
trusted_players_input = trusted_players_input
|
||||
}
|
||||
|
||||
if deny_players_input then
|
||||
data.deny_players_input = deny_players_input
|
||||
end
|
||||
|
||||
local bottom_flow = main_frame.add({type = 'flow', direction = 'horizontal'})
|
||||
|
||||
local left_flow = bottom_flow.add({type = 'flow'})
|
||||
left_flow.style.horizontal_align = 'left'
|
||||
left_flow.style.horizontally_stretchable = true
|
||||
|
||||
local close_button = left_flow.add({type = 'button', name = discard_button_name, caption = 'Discard changes'})
|
||||
close_button.style = 'back_button'
|
||||
|
||||
local right_flow = bottom_flow.add({type = 'flow'})
|
||||
right_flow.style.horizontal_align = 'right'
|
||||
|
||||
local save_button = right_flow.add({type = 'button', name = save_button_name, caption = 'Save changes'})
|
||||
save_button.style = 'confirm_button'
|
||||
|
||||
Gui.set_data(save_button, data)
|
||||
|
||||
player.opened = main_frame
|
||||
end
|
||||
|
||||
local function toggle(player, recreate)
|
||||
local screen = player.gui.screen
|
||||
local main_frame = screen[main_frame_name]
|
||||
|
||||
if recreate and main_frame then
|
||||
local location = main_frame.location
|
||||
remove_main_frame(main_frame)
|
||||
draw_main_frame(player, location)
|
||||
return
|
||||
end
|
||||
if main_frame then
|
||||
remove_main_frame(main_frame)
|
||||
Tabs.comfy_panel_restore_left_gui(player)
|
||||
else
|
||||
Tabs.comfy_panel_clear_left_gui(player)
|
||||
draw_main_frame(player)
|
||||
end
|
||||
end
|
||||
|
||||
local function add_toolbar(player, remove)
|
||||
if remove then
|
||||
if player.gui.top[main_toolbar_name] then
|
||||
player.gui.top[main_toolbar_name].destroy()
|
||||
return
|
||||
end
|
||||
end
|
||||
if player.gui.top[main_toolbar_name] then
|
||||
return
|
||||
end
|
||||
|
||||
local tooltip = 'Control who may enter your vehicle.'
|
||||
local b =
|
||||
player.gui.top.add(
|
||||
{
|
||||
type = 'sprite-button',
|
||||
sprite = 'item/spidertron',
|
||||
name = main_toolbar_name,
|
||||
tooltip = tooltip
|
||||
}
|
||||
)
|
||||
b.style.font_color = {r = 0.11, g = 0.8, b = 0.44}
|
||||
b.style.font = 'heading-1'
|
||||
b.style.minimal_height = 38
|
||||
b.style.minimal_width = 38
|
||||
b.style.maximal_height = 38
|
||||
b.style.maximal_width = 38
|
||||
b.style.padding = 1
|
||||
b.style.margin = 0
|
||||
end
|
||||
|
||||
local function remove_toolbar(player)
|
||||
local screen = player.gui.screen
|
||||
local main_frame = screen[main_frame_name]
|
||||
|
||||
if main_frame and main_frame.valid then
|
||||
remove_main_frame(main_frame)
|
||||
end
|
||||
|
||||
if player.gui.top[main_toolbar_name] then
|
||||
player.gui.top[main_toolbar_name].destroy()
|
||||
return
|
||||
end
|
||||
end
|
||||
|
||||
Gui.on_click(
|
||||
save_button_name,
|
||||
function(event)
|
||||
local player = event.player
|
||||
if not player or not player.valid or not player.character then
|
||||
return
|
||||
end
|
||||
|
||||
local this = ic.get()
|
||||
|
||||
local player_list = this.trust_system[player.index]
|
||||
|
||||
local screen = player.gui.screen
|
||||
local frame = screen[main_frame_name]
|
||||
local data = Gui.get_data(event.element)
|
||||
local trusted_players_input = data.trusted_players_input
|
||||
local deny_players_input = data.deny_players_input
|
||||
|
||||
if frame and frame.valid then
|
||||
if trusted_players_input and trusted_players_input.valid and trusted_players_input.selected_index then
|
||||
local index = trusted_players_input.selected_index
|
||||
if not index then
|
||||
return
|
||||
end
|
||||
|
||||
local target = game.players[index]
|
||||
if not target or not target.valid then
|
||||
return player.print('Target player was not valid.', Color.warning)
|
||||
end
|
||||
local name = target.name
|
||||
|
||||
if target.index == player.index then
|
||||
return player.print('Target player is not valid.', Color.warning)
|
||||
end
|
||||
if not player_list[name] then
|
||||
player.print(name .. ' was added to your vehicle.', Color.info)
|
||||
increment(this.trust_system[player.index], name)
|
||||
end
|
||||
end
|
||||
|
||||
if deny_players_input and deny_players_input.valid and deny_players_input.selected_index then
|
||||
local index = deny_players_input.selected_index
|
||||
if not index then
|
||||
return
|
||||
end
|
||||
local target = game.players[index]
|
||||
if not target or not target.valid then
|
||||
player.print('Target player was not valid.', Color.warning)
|
||||
return
|
||||
end
|
||||
local name = target.name
|
||||
|
||||
if target.index == player.index then
|
||||
return player.print('Target player is not valid.', Color.warning)
|
||||
end
|
||||
if player_list[name] then
|
||||
player.print(name .. ' was removed from your vehicle.', Color.info)
|
||||
decrement(this.trust_system[player.index], name)
|
||||
end
|
||||
end
|
||||
|
||||
remove_main_frame(event.element)
|
||||
|
||||
if player.gui.screen[main_frame_name] then
|
||||
toggle(player, true)
|
||||
end
|
||||
end
|
||||
end
|
||||
)
|
||||
|
||||
Gui.on_click(
|
||||
discard_button_name,
|
||||
function(event)
|
||||
local player = event.player
|
||||
local screen = player.gui.screen
|
||||
local frame = screen[main_frame_name]
|
||||
if not player or not player.valid or not player.character then
|
||||
return
|
||||
end
|
||||
if frame and frame.valid then
|
||||
frame.destroy()
|
||||
end
|
||||
end
|
||||
)
|
||||
|
||||
Gui.on_click(
|
||||
main_toolbar_name,
|
||||
function(event)
|
||||
local player = event.player
|
||||
local screen = player.gui.screen
|
||||
local frame = screen[main_frame_name]
|
||||
if not player or not player.valid or not player.character then
|
||||
return
|
||||
end
|
||||
|
||||
if frame and frame.valid then
|
||||
frame.destroy()
|
||||
else
|
||||
draw_main_frame(player)
|
||||
end
|
||||
end
|
||||
)
|
||||
|
||||
Public.draw_main_frame = draw_main_frame
|
||||
Public.toggle = toggle
|
||||
Public.add_toolbar = add_toolbar
|
||||
Public.remove_toolbar = remove_toolbar
|
||||
|
||||
return Public
|
@ -27,6 +27,7 @@ function Public.reset()
|
||||
this.cars = {}
|
||||
this.saved_surfaces = {}
|
||||
this.allowed_surface = 'nauvis'
|
||||
this.trust_system = {}
|
||||
this.players = {}
|
||||
this.surfaces = {}
|
||||
this.infinity_scrap_enabled = true
|
||||
|
@ -126,7 +126,7 @@ function Public.add_player_to_permission_group(player, group, forced)
|
||||
|
||||
if enable_permission_group_disconnect then
|
||||
local locomotive_group = game.permissions.get_group('locomotive')
|
||||
local plebs_group = game.permissions.create_group('plebs')
|
||||
local plebs_group = game.permissions.get_group('plebs')
|
||||
if locomotive_group then
|
||||
locomotive_group.set_allows_action(defines.input_action.disconnect_rolling_stock, true)
|
||||
end
|
||||
@ -135,7 +135,7 @@ function Public.add_player_to_permission_group(player, group, forced)
|
||||
end
|
||||
else
|
||||
local locomotive_group = game.permissions.get_group('locomotive')
|
||||
local plebs_group = game.permissions.create_group('plebs')
|
||||
local plebs_group = game.permissions.get_group('plebs')
|
||||
if locomotive_group then
|
||||
locomotive_group.set_allows_action(defines.input_action.disconnect_rolling_stock, false)
|
||||
end
|
||||
|
@ -302,6 +302,7 @@ function Public.reset_map()
|
||||
RPG_Settings.enable_stone_path(true)
|
||||
RPG_Settings.enable_one_punch(true)
|
||||
RPG_Settings.enable_one_punch_globally(false)
|
||||
RPG_Settings.enable_auto_allocate(true)
|
||||
RPG_Settings.disable_cooldowns_on_spells()
|
||||
|
||||
Group.reset_groups()
|
||||
|
@ -22,34 +22,6 @@ local science_loot = {
|
||||
output = {item = 'logistic-science-pack', min_rate = 0.5 / 8 / 60, distance_factor = 1 / 15 / 60 / 512}
|
||||
},
|
||||
weight = 2
|
||||
},
|
||||
{
|
||||
stack = {
|
||||
recipe = 'military-science-pack',
|
||||
output = {item = 'military-science-pack', min_rate = 0.5 / 8 / 60, distance_factor = 1 / 25 / 60 / 512}
|
||||
},
|
||||
weight = 1
|
||||
},
|
||||
{
|
||||
stack = {
|
||||
recipe = 'chemical-science-pack',
|
||||
output = {item = 'chemical-science-pack', min_rate = 0.5 / 8 / 60, distance_factor = 1 / 33 / 60 / 512}
|
||||
},
|
||||
weight = 0.20
|
||||
},
|
||||
{
|
||||
stack = {
|
||||
recipe = 'production-science-pack',
|
||||
output = {item = 'production-science-pack', min_rate = 0.5 / 8 / 60, distance_factor = 1 / 45 / 60 / 512}
|
||||
},
|
||||
weight = 0.10
|
||||
},
|
||||
{
|
||||
stack = {
|
||||
recipe = 'utility-science-pack',
|
||||
output = {item = 'utility-science-pack', min_rate = 0.5 / 8 / 60, distance_factor = 1 / 55 / 60 / 512}
|
||||
},
|
||||
weight = 0.010
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -104,6 +104,7 @@ end
|
||||
local function level_up(player)
|
||||
local rpg_t = RPG.get('rpg_t')
|
||||
local RPG_GUI = package.loaded['modules.rpg.gui']
|
||||
local names = RPG.auto_allocate_nodes
|
||||
|
||||
local distribute_points_gain = 0
|
||||
for i = rpg_t[player.index].level + 1, #experience_levels, 1 do
|
||||
@ -121,9 +122,17 @@ local function level_up(player)
|
||||
rpg_t[player.index].points_to_distribute = rpg_t[player.index].points_to_distribute + distribute_points_gain
|
||||
RPG_GUI.update_char_button(player)
|
||||
table.shuffle_table(rpg_frame_icons)
|
||||
if rpg_t[player.index].allocate_index ~= 1 then
|
||||
local node = rpg_t[player.index].allocate_index
|
||||
local index = names[node]:lower()
|
||||
rpg_t[player.index][index] = rpg_t[player.index][index] + distribute_points_gain
|
||||
rpg_t[player.index].points_to_distribute = rpg_t[player.index].points_to_distribute - distribute_points_gain
|
||||
RPG_GUI.update_player_stats(player)
|
||||
end
|
||||
if player.gui.screen[main_frame_name] then
|
||||
RPG_GUI.toggle(player, true)
|
||||
end
|
||||
|
||||
Public.level_up_effects(player)
|
||||
end
|
||||
|
||||
@ -503,6 +512,7 @@ function Public.rpg_reset_player(player, one_time_reset)
|
||||
mana_max = 0,
|
||||
last_spawned = 0,
|
||||
dropdown_select_index = 1,
|
||||
allocate_index = 1,
|
||||
flame_boots = false,
|
||||
enable_entity_spawn = false,
|
||||
health_bar = rpg_t[player.index].health_bar,
|
||||
@ -534,6 +544,7 @@ function Public.rpg_reset_player(player, one_time_reset)
|
||||
mana_max = 0,
|
||||
last_spawned = 0,
|
||||
dropdown_select_index = 1,
|
||||
allocate_index = 1,
|
||||
flame_boots = false,
|
||||
enable_entity_spawn = false,
|
||||
points_to_distribute = 0,
|
||||
|
@ -592,10 +592,15 @@ Gui.on_click(
|
||||
local enable_entity_gui_input = data.enable_entity_gui_input
|
||||
local stone_path_gui_input = data.stone_path_gui_input
|
||||
local one_punch_gui_input = data.one_punch_gui_input
|
||||
local auto_allocate_gui_input = data.auto_allocate_gui_input
|
||||
|
||||
local rpg_t = RPG.get('rpg_t')
|
||||
|
||||
if frame and frame.valid then
|
||||
if auto_allocate_gui_input and auto_allocate_gui_input.valid and auto_allocate_gui_input.selected_index then
|
||||
rpg_t[player.index].allocate_index = auto_allocate_gui_input.selected_index
|
||||
end
|
||||
|
||||
if one_punch_gui_input and one_punch_gui_input.valid then
|
||||
if not one_punch_gui_input.state then
|
||||
rpg_t[player.index].one_punch = false
|
||||
|
@ -205,6 +205,7 @@ function Public.extra_settings(player)
|
||||
local flame_boots_gui_input
|
||||
local stone_path_gui_input
|
||||
local one_punch_gui_input
|
||||
local auto_allocate_gui_input
|
||||
|
||||
if rpg_extra.enable_stone_path then
|
||||
local stone_path_label =
|
||||
@ -431,6 +432,54 @@ function Public.extra_settings(player)
|
||||
end
|
||||
end
|
||||
|
||||
if rpg_extra.enable_auto_allocate then
|
||||
local allocate_frame = inside_table.add({type = 'scroll-pane'})
|
||||
local allocate_style = allocate_frame.style
|
||||
allocate_style.vertically_squashable = true
|
||||
allocate_style.bottom_padding = 5
|
||||
allocate_style.left_padding = 5
|
||||
allocate_style.right_padding = 5
|
||||
allocate_style.top_padding = 5
|
||||
|
||||
allocate_frame.add({type = 'line'})
|
||||
|
||||
local a_label = allocate_frame.add({type = 'label', caption = 'Allocations Settings:'})
|
||||
a_label.style.font = 'default-bold'
|
||||
a_label.style.padding = 0
|
||||
a_label.style.left_padding = 10
|
||||
a_label.style.horizontal_align = 'left'
|
||||
a_label.style.vertical_align = 'bottom'
|
||||
a_label.style.font_color = {0.55, 0.55, 0.99}
|
||||
|
||||
allocate_frame.add({type = 'line'})
|
||||
|
||||
local allocate_grid = allocate_frame.add({type = 'table', column_count = 2})
|
||||
|
||||
local allocate_label =
|
||||
allocate_grid.add(
|
||||
{
|
||||
type = 'label',
|
||||
caption = 'Select what skill to auto-allocate.',
|
||||
tooltip = ''
|
||||
}
|
||||
)
|
||||
allocate_label.tooltip = 'This will automatically allocate all available points to the given node.'
|
||||
|
||||
local names = RPG.auto_allocate_nodes
|
||||
|
||||
local allocate_label_style = allocate_label.style
|
||||
allocate_label_style.horizontally_stretchable = true
|
||||
allocate_label_style.height = 35
|
||||
allocate_label_style.vertical_align = 'center'
|
||||
|
||||
local name_input = allocate_grid.add({type = 'flow'})
|
||||
local name_input_style = name_input.style
|
||||
name_input_style.height = 35
|
||||
name_input_style.vertical_align = 'center'
|
||||
auto_allocate_gui_input =
|
||||
create_input_element(name_input, 'dropdown', false, names, rpg_t[player.index].allocate_index)
|
||||
end
|
||||
|
||||
local data = {
|
||||
reset_gui_input = reset_gui_input,
|
||||
magic_pickup_gui_input = magic_pickup_gui_input,
|
||||
@ -458,6 +507,10 @@ function Public.extra_settings(player)
|
||||
data.one_punch_gui_input = one_punch_gui_input
|
||||
end
|
||||
|
||||
if rpg_extra.enable_auto_allocate then
|
||||
data.auto_allocate_gui_input = auto_allocate_gui_input
|
||||
end
|
||||
|
||||
local bottom_flow = main_frame.add({type = 'flow', direction = 'horizontal'})
|
||||
|
||||
local left_flow = bottom_flow.add({type = 'flow'})
|
||||
|
@ -81,6 +81,14 @@ Public.classes = {
|
||||
['vitality'] = 'SOLDIER'
|
||||
}
|
||||
|
||||
Public.auto_allocate_nodes = {
|
||||
'Deactivated',
|
||||
'Strength',
|
||||
'Magicka',
|
||||
'Dexterity',
|
||||
'Vitality'
|
||||
}
|
||||
|
||||
function Public.reset_table()
|
||||
this.rpg_extra.debug = false
|
||||
this.rpg_extra.breached_walls = 1
|
||||
@ -100,6 +108,7 @@ function Public.reset_table()
|
||||
this.rpg_extra.mana_per_tick = 0.1
|
||||
this.rpg_extra.force_mana_per_tick = false
|
||||
this.rpg_extra.enable_stone_path = false
|
||||
this.rpg_extra.enable_auto_allocate = false
|
||||
this.rpg_extra.enable_one_punch = true
|
||||
this.rpg_extra.enable_one_punch_globally = false
|
||||
this.rpg_t = {}
|
||||
@ -250,6 +259,18 @@ function Public.enable_stone_path(value)
|
||||
return this.rpg_extra.enable_stone_path
|
||||
end
|
||||
|
||||
--- Enables/disabled auto-allocations of skill-points.
|
||||
---@param value <boolean>
|
||||
function Public.enable_auto_allocate(value)
|
||||
if value then
|
||||
this.rpg_extra.enable_auto_allocate = value
|
||||
else
|
||||
this.rpg_extra.enable_auto_allocate = false
|
||||
end
|
||||
|
||||
return this.rpg_extra.enable_auto_allocate
|
||||
end
|
||||
|
||||
--- Enables/disabled stone-path-tile creation on mined.
|
||||
---@param value <boolean>
|
||||
function Public.enable_one_punch(value)
|
||||
|
Loading…
x
Reference in New Issue
Block a user