Merge pull request #145 from explosivegaming/feature/gui-v5

Gui v5
This commit is contained in:
Cooldude2606
2020-03-21 13:07:12 +00:00
committed by GitHub
135 changed files with 5761 additions and 15918 deletions

View File

@@ -55,5 +55,4 @@ return {
'config.expcore-commands.auth_runtime_disable', -- allows commands to be enabled and disabled during runtime
'config.permission_groups', -- loads some predefined permission groups
'config.roles', -- loads some predefined roles
'expcore.gui.test' -- loads multiple gui defines to test the gui system
}

View File

@@ -22,13 +22,6 @@ local function set_store_uids(player,action)
selected_action_store = action
end
-- common style used by all action buttons
local function tool_button_style(style)
Gui.set_padding_style(style,-1,-1,-1,-1)
style.height = 28
style.width = 28
end
-- auth that will only allow when on player's of lower roles
local function auth_lower_role(player,selected_player_name)
local player_highest = Roles.get_player_highest_role(player)
@@ -56,14 +49,23 @@ local function teleport(from_player,to_player)
return true
end
local function new_button(sprite,tooltip)
return Gui.element{
type = 'sprite-button',
style = 'tool_button',
sprite = sprite,
tooltip = tooltip
}:style{
padding = -1,
height = 28,
width = 28
}
end
--- Teleports the user to the action player
-- @element goto_player
local goto_player =
Gui.new_button()
:set_sprites('utility/export')
:set_tooltip{'player-list.goto-player'}
:set_style('tool_button',tool_button_style)
:on_click(function(player,element)
local goto_player = new_button('utility/export',{'player-list.goto-player'})
:on_click(function(player)
local selected_player_name = get_action_player_name(player)
local selected_player = Game.get_player_from_any(selected_player_name)
if not player.character or not selected_player.character then
@@ -75,12 +77,8 @@ end)
--- Teleports the action player to the user
-- @element bring_player
local bring_player =
Gui.new_button()
:set_sprites('utility/import')
:set_tooltip{'player-list.bring-player'}
:set_style('tool_button',tool_button_style)
:on_click(function(player,element)
local bring_player = new_button('utility/import',{'player-list.bring-player'})
:on_click(function(player)
local selected_player_name = get_action_player_name(player)
local selected_player = Game.get_player_from_any(selected_player_name)
if not player.character or not selected_player.character then
@@ -92,12 +90,8 @@ end)
--- Kills the action player, if there are alive
-- @element kill_player
local kill_player =
Gui.new_button()
:set_sprites('utility/too_far')
:set_tooltip{'player-list.kill-player'}
:set_style('tool_button',tool_button_style)
:on_click(function(player,element)
local kill_player = new_button('utility/too_far',{'player-list.kill-player'})
:on_click(function(player)
local selected_player_name = get_action_player_name(player)
local selected_player = Game.get_player_from_any(selected_player_name)
if selected_player.character then
@@ -109,12 +103,8 @@ end)
--- Reports the action player, requires a reason to be given
-- @element report_player
local report_player =
Gui.new_button()
:set_sprites('utility/spawn_flag')
:set_tooltip{'player-list.report-player'}
:set_style('tool_button',tool_button_style)
:on_click(function(player,element)
local report_player = new_button('utility/spawn_flag',{'player-list.report-player'})
:on_click(function(player)
local selected_player_name = get_action_player_name(player)
if Reports.is_reported(selected_player_name,player.name) then
player.print({'expcom-report.already-reported'},Colors.orange_red)
@@ -133,12 +123,8 @@ end
--- Gives the action player a warning, requires a reason
-- @element warn_player
local warn_player =
Gui.new_button()
:set_sprites('utility/spawn_flag')
:set_tooltip{'player-list.warn-player'}
:set_style('tool_button',tool_button_style)
:on_click(function(player,element)
local warn_player = new_button('utility/spawn_flag',{'player-list.warn-player'})
:on_click(function(player)
Store.set(selected_action_store,player,'command/give-warning')
end)
@@ -151,12 +137,8 @@ end
--- Jails the action player, requires a reason
-- @element jail_player
local jail_player =
Gui.new_button()
:set_sprites('utility/item_editor_icon')
:set_tooltip{'player-list.jail-player'}
:set_style('tool_button',tool_button_style)
:on_click(function(player,element)
local jail_player = new_button('utility/multiplayer_waiting_icon',{'player-list.jail-player'})
:on_click(function(player)
local selected_player_name, selected_player_color = get_action_player_name(player)
if Jail.is_jailed(selected_player_name) then
player.print({'expcom-jail.already-jailed', selected_player_color},Colors.orange_red)
@@ -174,12 +156,8 @@ end
--- Temp bans the action player, requires a reason
-- @element temp_ban_player
local temp_ban_player =
Gui.new_button()
:set_sprites('utility/clock')
:set_tooltip{'player-list.temp-ban-player'}
:set_style('tool_button',tool_button_style)
:on_click(function(player,element)
local temp_ban_player = new_button('utility/warning_white',{'player-list.temp-ban-player'})
:on_click(function(player)
local selected_player_name, selected_player_color = get_action_player_name(player)
if Jail.is_jailed(selected_player_name) then
player.print({'expcom-jail.already-banned', selected_player_color},Colors.orange_red)
@@ -197,12 +175,8 @@ end
--- Kicks the action player, requires a reason
-- @element kick_player
local kick_player =
Gui.new_button()
:set_sprites('utility/warning_icon')
:set_tooltip{'player-list.kick-player'}
:set_style('tool_button',tool_button_style)
:on_click(function(player,element)
local kick_player = new_button('utility/warning_icon',{'player-list.kick-player'})
:on_click(function(player)
Store.set(selected_action_store,player,'command/kick')
end)
@@ -213,12 +187,8 @@ end
--- Bans the action player, requires a reason
-- @element ban_player
local ban_player =
Gui.new_button()
:set_sprites('utility/danger_icon')
:set_tooltip{'player-list.ban-player'}
:set_style('tool_button',tool_button_style)
:on_click(function(player,element)
local ban_player = new_button('utility/danger_icon',{'player-list.ban-player'})
:on_click(function(player)
Store.set(selected_action_store,player,'command/ban')
end)

View File

@@ -61,7 +61,8 @@ Roles.new_role('Administrator','Admin')
:set_flag('instance-respawn')
:set_parent('Moderator')
:allow{
'gui/warp-list/no-limit',
'gui/warp-list/bypass-cooldown',
'gui/warp-list/bypass-proximity',
}
Roles.new_role('Moderator','Mod')
@@ -181,7 +182,9 @@ Roles.new_role('Member','Mem')
:set_custom_color{r=24,g=172,b=188}
:set_parent('Regular')
:allow{
'gui/task-list/add',
'gui/task-list/edit',
'gui/warp-list/add',
'gui/warp-list/edit'
}
@@ -217,7 +220,7 @@ local default = Roles.new_role('Guest','')
'gui/rocket-info',
'gui/science-info',
'gui/task-list',
'gui/warp-list',
'gui/warp-list'
}
--- Jail role

View File

@@ -2,8 +2,12 @@
-- @config Tasks
return {
any_user_can_add_new_task = true, --- @setting any_user_can_add_new_task when false only people with edit permission can make new reports
user_can_edit_own_tasks = true, --- @setting user_can_edit_own_tasks when false only people with edit permission can edit reports
only_admins_can_edit = false, --- @setting only_admins_can_edit true will hide the edit and delete buttons from non (game) admins
edit_tasks_role_permission = 'gui/task-list/edit' --- @setting edit_tasks_role_permission value used with custom permission system
-- Adding tasks
allow_add_task = 'all', --- @setting allow_add_task dictates who is allowed to add new tasks; values: all, admin, expcore.roles, none
expcore_roles_allow_add_task = 'gui/task-list/add', --- @setting expcore_roles_allow_add_task if expcore.roles is used then this is the required permission
-- Editing tasks
allow_edit_task = 'expcore.roles', --- @setting allow_edit_task dictates who is allowed to edit existing tasks; values: all, admin, expcore.roles, none
expcore_roles_allow_edit_task = 'gui/task-list/edit', --- @setting expcore_roles_allow_edit_task if expcore.roles is used then this is the required permission
user_can_edit_own_tasks = true --- @settings if true then the user who made the task can edit it regardless of the allow_edit_task setting
}

View File

@@ -2,24 +2,39 @@
-- @config Warps
return {
recharge_time = 60, --- @setting recharge_time The amount of time in seconds that the player must wait between warps, acts as a balance
update_smoothing = 10, --- @setting update_smoothing Higher is better, the amount of smoothing applied to recharge timer and other gui updates, max is 60
minimum_distance = 100, --- @setting minimum_distance The minimum distance that must be between warp points, creating new ones is blocked when too close
activation_range = 4, --- @setting activation_range The distance the player must be to a warp in order to use the warp gui, gui can still be viewed but not used
spawn_activation_range = 20, --- @setting spawn_activation_range A second activation range which is used for the forces spawn point
default_icon = 'discharge-defense-equipment', --- @setting default_icon The default icon which is used by warps; must be an item name
user_can_edit_own_warps = false, --- @setting user_can_edit_own_warps When true the user can always edit warps which they created regardless of other settings
any_user_can_add_new_warp = false, --- @setting any_user_can_add_new_warp When true any user is able to create new warps, however editing may still be restricted
only_admins_can_edit = false, --- @setting only_admins_can_edit When true only admins can edit warps
edit_warps_role_permission = 'gui/warp-list/edit', --- @setting edit_warps_role_permission Role permission used by the role system to allow editing warps
bypass_warp_limits_permission = 'gui/warp-list/no-limit', --- @setting bypass_warp_limits_permission Role permission used by the role system to allow bypassing the time and distance restrictions
entities = { --- @setting entities The entities which are created for warps
-- General config
update_smoothing = 10, --- @setting update_smoothing the amount of smoothing applied to updates to the cooldown timer, higher is better, max is 60
minimum_distance = 100, --- @setting minimum_distance the minimum distance that is allowed between warps on the same force
default_icon = 'discharge-defense-equipment', --- @setting default_icon the default icon that will be used for warps
-- Warp cooldowns
bypass_warp_cooldown = 'expcore.roles', --- @setting bypass_warp_cooldown dictates who the warp cooldown is applied to; values: all, admin, expcore.roles, none
expcore_roles_bypass_warp_cooldown = 'gui/warp-list/bypass-cooldown', --- @setting expcore_roles_bypass_warp_cooldown if expcore.roles is used then this is the required permission
cooldown_duraction = 60, --- @setting cooldown_duraction the duration of the warp cooldown in seconds
-- Warp proximity
bypass_warp_proximity = 'expcore.roles', --- @setting bypass_warp_proximity dictates who the warp proximity is applied to; values: all, admin, expcore.roles, none
expcore_roles_bypass_warp_proximity = 'gui/warp-list/bypass-proximity', --- @setting expcore_roles_bypass_warp_proximity if expcore.roles is used then this is the required permission
standard_proximity_radius = 4, --- @setting standard_proximity_radius the minimum distance a player is allowed to be to a warp in order to use it
spawn_proximity_radius = 20, --- @setting spawn_proximity_radius the minimum distance a player is allowed to be from they spawn point to use warps
-- Adding warps
allow_add_warp = 'expcore.roles', --- @setting allow_add_warp dictates who is allowed to add warps; values: all, admin, expcore.roles, none
expcore_roles_allow_add_warp = 'gui/warp-list/add', --- @setting expcore_roles_allow_add_warp if expcore.roles is used then this is the required permission
-- Editing warps
allow_edit_warp = 'expcore.roles', --- @setting allow_edit_warp dictates who is allowed to edit warps; values: all, admin, expcore.roles, none
expcore_roles_allow_edit_warp = 'gui/warp-list/edit', --- @setting expcore_roles_allow_edit_warp if expcore.roles is used then this is the required permission
user_can_edit_own_warps = false, --- @settings user_can_edit_own_warps if true then the user who made the warp can edit it regardless of the allow_edit_warp setting
-- Warp area generation
entities = { --- @setting entities The entities which are created for warp areas
{'small-lamp',-3,-2},{'small-lamp',-3,2},{'small-lamp',3,-2},{'small-lamp',3,2},
{'small-lamp',-2,-3},{'small-lamp',2,-3},{'small-lamp',-2,3},{'small-lamp',2,3},
{'small-electric-pole',-3,-3},{'small-electric-pole',3,3},{'small-electric-pole',-3,3},{'small-electric-pole',3,-3}
},
base_tile = 'tutorial-grid', --- @setting base_tile The tile which is used for the warps
tiles = { --- @setting tiles The tiles which are created for warps
base_tile = 'tutorial-grid', --- @setting base_tile The tile which is used for the warp areas
tiles = { --- @setting tiles The tiles which are created for warp areas
{-3,-2},{-3,-1},{-3,0},{-3,1},{-3,2},{3,-2},{3,-1},{3,0},{3,1},{3,2},
{-2,-3},{-1,-3},{0,-3},{1,-3},{2,-3},{-2,3},{-1,3},{0,3},{1,3},{2,3}
}