mirror of
https://github.com/PHIDIAS0303/ExpCluster.git
synced 2025-12-27 11:35:22 +09:00
Added changes requested by mark
This commit is contained in:
@@ -5,7 +5,7 @@ local e = defines.events -- order as per lua api as it was easier just to go dow
|
||||
return {
|
||||
Playtime = true, --- @setting Playtime If playtime is tracked for a player, play time measured in minutes
|
||||
AfkTime = true, --- @setting AfkTime If afk time is tracked for a player, play time measured in minutes, afk is once a player does nothing for 5 minutes
|
||||
DistanceTraveled = true, --- @setting DistanceTraveled If distance traveled is checked, only counts if not afk
|
||||
DistanceTravelled = true, --- @setting DistanceTravelled If distance Travelled is checked, only counts if not afk
|
||||
MachinesRemoved = true, --- @setting MachinesRemoved If removed machines are tracked, includes marked for decon and player mined entity
|
||||
TreesDestroyed = true, --- @setting OreMined If ore mined is tracked for a player, includes marked for decon and player mined entity but only trees
|
||||
OreMined = true, --- @setting OreMined If ore mined is tracked for a player, includes player mined entity but only ore
|
||||
@@ -22,7 +22,7 @@ return {
|
||||
TilesBuilt = e.on_player_built_tile,
|
||||
ItemsCrafted = e.on_player_crafted_item,
|
||||
MapsPlayed = e.on_player_created,
|
||||
DeconstructionPlanerUsed = e.on_player_deconstructed_area,
|
||||
DeconstructionPlannerUsed = e.on_player_deconstructed_area,
|
||||
Deaths = e.on_player_died,
|
||||
JoinCount = e.on_player_joined_game,
|
||||
TilesRemoved = e.on_player_mined_tile,
|
||||
@@ -30,8 +30,8 @@ return {
|
||||
EntityRepaired= e.on_player_repaired_entity
|
||||
},
|
||||
display_order = { --- @setting display_order The order that the statistics should be shown in when in a gui or command
|
||||
'MapsPlayed', 'JoinCount',
|
||||
'Playtime', 'AfkTime',
|
||||
'MapsPlayed', 'JoinCount',
|
||||
'ChatMessages', 'CommandsUsed',
|
||||
'RocketsLaunched', 'ResearchCompleted',
|
||||
'MachinesBuilt', 'MachinesRemoved',
|
||||
@@ -39,8 +39,8 @@ return {
|
||||
'TreesDestroyed', 'OreMined',
|
||||
'ItemsCrafted', 'ItemsPickedUp',
|
||||
'Kills', 'Deaths',
|
||||
'DamageDealt', 'DistanceTraveled',
|
||||
'DamageDealt', 'DistanceTravelled',
|
||||
'CapsulesUsed', 'EntityRepaired',
|
||||
'DeconstructionPlanerUsed', 'MapTagsMade',
|
||||
'DeconstructionPlannerUsed', 'MapTagsMade',
|
||||
}
|
||||
}
|
||||
@@ -46,9 +46,9 @@ removed=__1__ has one or more reports removed by __2__.
|
||||
received=__1__ received a warning from __2__ for __3__.
|
||||
player=__1__ has __2__ warnings and __3__/__4__ script warnings.
|
||||
player-detail=__1__ gave warning for: __2__
|
||||
list-title=The following player have this many warnings (and this many script warnings):
|
||||
list-title=The following players have this many warnings (and this many script warnings):
|
||||
list=__1__: __2__ (__3__/__4__)
|
||||
cleared=__1__ had all they warnings cleared by __2__.
|
||||
cleared=__1__ had all their warnings cleared by __2__.
|
||||
|
||||
[expcom-spawn]
|
||||
unavailable=They was a problem getting you to spawn, please try again later.
|
||||
|
||||
@@ -7,77 +7,77 @@ saved=Your quickbar filters have been saved.
|
||||
|
||||
[exp-required]
|
||||
Warnings=Warnings
|
||||
Warnings-tooltip=The number of warnings that have been given to you by staff
|
||||
Warnings-value-tooltip=The number of warnings that have been given to you by staff
|
||||
Warnings-tooltip=The total number of warnings you have recieved from staff
|
||||
Warnings-value-tooltip=The total number of warnings you have recieved from staff
|
||||
[exp-settings]
|
||||
Colour=Colour
|
||||
Colour-tooltip=Your player colour
|
||||
Colour-value-tooltip=Change by using /color
|
||||
JoinMessage=Join Message
|
||||
JoinMessage-tooltip=The message that is displayed when you join
|
||||
JoinMessage-tooltip=The message displayed when you join
|
||||
JoinMessage-value-tooltip=Change by using /join-message
|
||||
QuickbarFilters=Quickbar Filters
|
||||
QuickbarFilters-tooltip=The filters that are on your quickbar
|
||||
QuickbarFilters-tooltip=The filters on your quickbar
|
||||
QuickbarFilters-value-tooltip=Change by using /save-quickbar
|
||||
UsesAlt=Alt View
|
||||
UsesAlt-tooltip=If you use alt view when you play
|
||||
UsesAlt-tooltip=Whether you use alt view when you play
|
||||
UsesAlt-value-tooltip=Change by pressing __CONTROL__show-info__
|
||||
UsesServerUps=Server Ups
|
||||
UsesServerUps-tooltip=If you use server ups view when you play
|
||||
UsesServerUps=Server UPS
|
||||
UsesServerUps-tooltip=Whether the current server UPS is shown
|
||||
UsesServerUps-value-tooltip=Change by using /server-ups
|
||||
Tag=Player Tag
|
||||
Tag-tooltip=The tag that is shown after your name
|
||||
Tag-tooltip=The tag shown after your name
|
||||
Tag-value-tooltip=Change by using /tag
|
||||
Bonus=Player Bonus
|
||||
Bonus-tooltip=The bonus that is given to your character
|
||||
Bonus-tooltip=The bonus given to your character
|
||||
Bonus-value-tooltip=Change by using /bonus
|
||||
|
||||
[exp-statistics]
|
||||
MapsPlayed=Maps Played
|
||||
MapsPlayed-tooltip=The amount of maps you have played on
|
||||
MapsPlayed-tooltip=The number of unique maps you have played on
|
||||
JoinCount=Join Count
|
||||
JoinCount-tooltip=The amount of times you have joined our servers
|
||||
Playtime=Playtime
|
||||
Playtime-tooltip=The amount of time you have played on our servers
|
||||
Playtime-tooltip=The amount of time you have spent on our servers
|
||||
AfkTime=AFK Time
|
||||
AfkTime-tooltip=The amount of time you have been afk on our servers
|
||||
AfkTime-tooltip=The amount of time you have been AFK on our servers
|
||||
ChatMessages=Messages
|
||||
ChatMessages-tooltip=The amount of message you have sent in chat
|
||||
ChatMessages-tooltip=The number of messages you have sent in chat
|
||||
CommandsUsed=Commands
|
||||
CommandsUsed-tooltip=The amount of commands you have used
|
||||
CommandsUsed-tooltip=The number of commands you have used
|
||||
RocketsLaunched=Rockets Launched
|
||||
RocketsLaunched-tooltip=The amount of rockets launched while you were online
|
||||
RocketsLaunched-tooltip=The number of rockets launched while you were online
|
||||
ResearchCompleted=Research Completed
|
||||
ResearchCompleted-tooltip=The amount of research completed while you were online
|
||||
ResearchCompleted-tooltip=The number of research projects completed while you were online
|
||||
MachinesBuilt=Machines Built
|
||||
MachinesBuilt-tooltip=The amount of machines you have built
|
||||
MachinesBuilt-tooltip=The number of machines you have built
|
||||
MachinesRemoved=Machines Removed
|
||||
MachinesRemoved-tooltip=The amount of machines you have removed
|
||||
MachinesRemoved-tooltip=The number of machines you have removed
|
||||
TilesBuilt=Tiles Placed
|
||||
TilesBuilt-tooltip=The amount of tiles you have placed
|
||||
TilesBuilt-tooltip=The number of tiles you have placed
|
||||
TilesRemoved=Tiles Removed
|
||||
TilesRemoved-tooltip=The amount of tiles you have removed
|
||||
TilesRemoved-tooltip=The number of tiles you have removed
|
||||
TreesDestroyed=Trees Destroyed
|
||||
TreesDestroyed-tooltip=The amount of trees you have destroyed
|
||||
TreesDestroyed-tooltip=The number of trees you have destroyed
|
||||
OreMined=Ore Mined
|
||||
OreMined-tooltip=The amount of ore you have mined
|
||||
ItemsCrafted=Items Crafted
|
||||
ItemsCrafted-tooltip=The amount of items you have crafted
|
||||
ItemsCrafted-tooltip=The number of items you have crafted
|
||||
ItemsPickedUp=Items Picked Up
|
||||
ItemsPickedUp-tooltip=The amount of items you have picked up
|
||||
ItemsPickedUp-tooltip=The number of items you have picked up
|
||||
Kills=Kills
|
||||
Kills-tooltip=The amount of things you have killed
|
||||
Kills-tooltip=The number of biters and biter bases you have squished
|
||||
Deaths=Deaths
|
||||
Deaths-tooltip=The amount of times you have died
|
||||
DamageDealt=Damage Delt
|
||||
DamageDealt-tooltip=The amount of damage you have dealt to other forces
|
||||
DistanceTraveled=Distance Traveled
|
||||
DistanceTraveled-tooltip=The amount of tiles you have traveled across
|
||||
DistanceTravelled=Distance Travelled
|
||||
DistanceTravelled-tooltip=The total distance in tiles that you have travelled
|
||||
CapsulesUsed=Capsules Used
|
||||
CapsulesUsed-tooltip=The amount of capsules you have used
|
||||
CapsulesUsed-tooltip=The number of capsules you have used
|
||||
EntityRepaired=Machines Repaired
|
||||
EntityRepaired-tooltip=The amount of machines which you have repaired
|
||||
DeconstructionPlanerUsed=Decon Planner Used
|
||||
DeconstructionPlanerUsed-tooltip=The amount of times you have used the deconstruction planer
|
||||
MapTagsMade=Map Tags Used
|
||||
MapTagsMade-tooltip=The amount of map tags you have created
|
||||
EntityRepaired-tooltip=The number of machines which you have repaired
|
||||
DeconstructionPlannerUsed=Decon Planner Used
|
||||
DeconstructionPlannerUsed-tooltip=The amount of times you have used the deconstruction Planner
|
||||
MapTagsMade=Map Tags Created
|
||||
MapTagsMade-tooltip=The number of map tags you have created
|
||||
@@ -44,5 +44,9 @@ get-data=Your player data has been writen to file, location: factorio/script_out
|
||||
data-failed=Your player data has failed to load. Any changes to your data will not be saved.
|
||||
data-restore=Your player data has been restored and changes will now save when you leave.
|
||||
preference=Saving Preference
|
||||
preference-tooltip=Which areas will be saved when you leave the game
|
||||
preference-value-tooltip=Change by using /set-preference
|
||||
preference-tooltip=Which categories will be saved when you leave the game
|
||||
preference-value-tooltip=Change by using /set-preference
|
||||
preference-All=All data will be saved
|
||||
preference-Statistics=Only statistics, settings, and required data will be saved
|
||||
preference-Settings=Only settings and required data will be saved
|
||||
preference-Required=Only required data will be saved
|
||||
@@ -158,8 +158,9 @@ backers-backers=Sponsors and Supporters
|
||||
backers-active=Active Players
|
||||
data-tab=Data
|
||||
data-tooltip=All of your stored player data
|
||||
data-general=Our servers will save your player data externaly so that we can sync it between servers. All of your data can be found below, if you wish to save a copy localy then use /save-data. If you want to change what data is saved then use /set-preference.
|
||||
data-general=Our servers will save your player data so that we can sync it between servers. All of your data can be found below, if you wish to save a copy locally then use /save-data. If you want to change what data is saved then use /set-preference.
|
||||
data-settings=Settings
|
||||
data-statistics=Statistics
|
||||
data-required=Required
|
||||
data-misc=Miscellaneous
|
||||
data-misc=Miscellaneous
|
||||
data-format=__1____2__
|
||||
@@ -33,10 +33,10 @@ local PlayerData = require 'expcore.player_data' --- @dep expcore.player_data
|
||||
local PlayerWarnings = PlayerData.Required:combine('Warnings')
|
||||
PlayerWarnings:set_metadata{
|
||||
stringify = function(value)
|
||||
if not value then return 'You have no warnings against you' end
|
||||
if not value then return 'You have no warnings' end
|
||||
local count = 0
|
||||
for _ in pairs(value) do count = count + 1 end
|
||||
return 'You have '..count..' warnings against you'
|
||||
return 'You have '..count..' warnings'
|
||||
end
|
||||
}
|
||||
|
||||
@@ -262,7 +262,7 @@ end
|
||||
|
||||
--- Script warning removed event trigger due to it being looped in clear script warnings
|
||||
-- @tparam LuaPlayer player the player who is having a script warning removed
|
||||
-- @tparam number warning_count the number of warning that the player has
|
||||
-- @tparam number warning_count the number of warnings that the player has
|
||||
local function script_warning_removed_event(player, warning_count)
|
||||
script.raise_event(Warnings.events.on_script_warning_removed, {
|
||||
name = Warnings.events.on_script_warning_removed,
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
|
||||
local Event = require 'utils.event' ---@dep utils.event
|
||||
local config = require 'config.statistics' ---@dep config.statistics
|
||||
local format_time = _C.format_time
|
||||
local floor = math.floor
|
||||
local afk_required = 5*3600 -- 5 minutes
|
||||
|
||||
@@ -29,11 +30,20 @@ Statistics:on_load(function(player_name, player_statistics)
|
||||
return player_statistics
|
||||
end)
|
||||
|
||||
--- Used to format time in minute format
|
||||
local function format_minutes(value)
|
||||
return format_time(value*3600, {
|
||||
long = true,
|
||||
hours = true,
|
||||
minutes = true
|
||||
})
|
||||
end
|
||||
|
||||
--- Add Playtime and AfkTime if it is enabled
|
||||
if config.Playtime or config.AfkTime then
|
||||
local playtime, afk_time
|
||||
if config.Playtime then playtime = Statistics:combine('Playtime') end
|
||||
if config.AfkTime then afk_time = Statistics:combine('AfkTime') end
|
||||
if config.Playtime then playtime = Statistics:combine('Playtime') playtime:set_metadata{stringify=format_minutes} end
|
||||
if config.AfkTime then afk_time = Statistics:combine('AfkTime') afk_time:set_metadata{stringify=format_minutes} end
|
||||
Event.on_nth_tick(3600, function()
|
||||
if game.tick == 0 then return end
|
||||
for _, player in pairs(game.connected_players) do
|
||||
@@ -43,9 +53,10 @@ if config.Playtime or config.AfkTime then
|
||||
end)
|
||||
end
|
||||
|
||||
--- Add DistanceTraveled if it is enabled
|
||||
if config.DistanceTraveled then
|
||||
local stat = Statistics:combine('DistanceTraveled')
|
||||
--- Add DistanceTravelled if it is enabled
|
||||
if config.DistanceTravelled then
|
||||
local stat = Statistics:combine('DistanceTravelled')
|
||||
stat:set_metadata{unit=' tiles'}
|
||||
Event.add(defines.events.on_player_changed_position, function(event)
|
||||
local player = game.players[event.player_index]
|
||||
if not player.valid or not player.connected or player.afk_time > afk_required then return end
|
||||
|
||||
@@ -284,7 +284,7 @@ Gui.element(function(_, parent)
|
||||
-- Add the required area
|
||||
local required = title_table(scroll_pane, 250, {'readme.data-required'}, 2)
|
||||
Gui.centered_label(required, 150, preference_meta.name, preference_meta.tooltip)
|
||||
Gui.centered_label(required, 420, enum[preference], preference_meta.value_tooltip)
|
||||
Gui.centered_label(required, 420, {'expcore-data.preference-'..enum[preference]}, preference_meta.value_tooltip)
|
||||
|
||||
for name, child in pairs(PlayerData.Required.children) do
|
||||
local metadata = child.metadata
|
||||
@@ -319,8 +319,10 @@ Gui.element(function(_, parent)
|
||||
local value = child:get(player_name)
|
||||
if value ~= nil or metadata.show_always then
|
||||
count = count - 2
|
||||
if metadata.stringify then value = metadata.stringify(value)
|
||||
else value = format_number(value or 0) end
|
||||
Gui.centered_label(statistics, 150, metadata.name or {'exp-statistics.'..name}, metadata.tooltip or {'exp-statistics.'..name..'-tooltip'})
|
||||
Gui.centered_label(statistics, 130, format_number(value or 0), metadata.value_tooltip or {'exp-statistics.'..name..'-tooltip'})
|
||||
Gui.centered_label(statistics, 130, {'readme.data-format', value, metadata.unit or ''}, metadata.value_tooltip or {'exp-statistics.'..name..'-tooltip'})
|
||||
end
|
||||
end
|
||||
if count > 0 then for i = 1, count do Gui.centered_label(statistics, 140) end end
|
||||
|
||||
@@ -37,7 +37,7 @@ end)
|
||||
|
||||
--- Toggles if the server ups is visbile
|
||||
-- @command server-ups
|
||||
Commands.new_command('server-ups', 'Toggle the server ups display')
|
||||
Commands.new_command('server-ups', 'Toggle the server UPS display')
|
||||
:add_alias('sups', 'ups')
|
||||
:register(function(player)
|
||||
local label = player.gui.screen[server_ups.name]
|
||||
|
||||
Reference in New Issue
Block a user