Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add admin panel #1432

Merged
merged 14 commits into from
Sep 2, 2024
Merged

Add admin panel #1432

merged 14 commits into from
Sep 2, 2024

Conversation

RedRafe
Copy link
Contributor

@RedRafe RedRafe commented Aug 28, 2024

Changes

  • added config & top button for admin panel (Mk2 armor icon)
  • admin commands file now also exports its command functions to be used elsewhere, by providing additional param { actor = LuaPlayer } if needed
  • updated missing handlers/rules in utils.gui and luackeckr

Main features

Added 3 pages in admin panel: Player manager, Map manager, Lua console. Scenarios can also add more pages through the AdminPanel API, planning on adding the history of player actions to help admins moderate maps.

Player manager

  • General actions: cheat mode, create pools, delete stuff... basically shortcuts from already existing console commands for admins
  • Player management: promote/demote/jail/invoke/goto players. requires to select another player from the dropdown selector (can filter for online/all/offline players)
  • Players ban: helps building the ban message by providing few common reasons, the the admin can further customize the text by editi it themselves before banning.

screenshot of the player manager panel
Screenshot from 2024-08-28 11-02-43

Map manager

  • Just a bunch of button-slider pairs to tweak map settings/enemies/pollution/evo. Label on the right shows the current map setting, while sliders have a tooltip that shows the "selected" value on the slider. Wont be applied until the user presses the button.

screenshot of the map manager
Screenshot from 2024-08-28 11-02-49

Lua console

  • I dont expect many admins to use this, but writing commands in the console is shit because it's just 1 line high, so this is more a QoL gift for us devs :) (will probably remain at bottom of all future pages added)

screenshot of the lua console panel
Screenshot from 2024-08-28 11-02-56

Future development:

  • maybe add some tooltips here & there for buttons based on feedbacks. Could also have each button tooltips that is a "shortcut" for a command, be the description of the command itself and all the parameters that go into it (if an admin needs to manually run the command with specific parameters, idk...)
  • add the history of player actions panel. Still need to think on how to actually make it. Tracking players actions is straightforward, displaying the information in a useful/organized way instead of a giant wall of text/giant table of data is not

features/gui/admin_panel/player_manager.lua Outdated Show resolved Hide resolved
features/gui/admin_panel/map_manager.lua Outdated Show resolved Hide resolved
Copy link
Collaborator

@grilledham grilledham left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Had a play around, looks good. Just some comments to address.

@RedRafe
Copy link
Contributor Author

RedRafe commented Sep 1, 2024

The map manager is already quite useful to tweak game speed/map reveals/enemy settings while debugging. So we can also think to implement more debugging features, or even adding a separate page (only visible to admin panel in debug mode) with shortcuts of debug tools/scripts that we usually run.

@RedRafe
Copy link
Contributor Author

RedRafe commented Sep 1, 2024

Made it a separate slider with its command tooltip as well to make it clear
Screenshot from 2024-09-01 12-03-16

@grilledham
Copy link
Collaborator

Testing again, I notice that when you ban a player, it says that the player was banned by script.
image
This concerns me as we keep track of which admin did the ban at https://refactorio.de/admin/bans and I wouldn't like to lose that. I'm not sure what the solution to this is.

@grilledham
Copy link
Collaborator

Actually this might jus be coming from text[#text + 1] = ' was banned by <script>**\\n' in Report.ban_player. I'll investigate further.

@RedRafe
Copy link
Contributor Author

RedRafe commented Sep 1, 2024

Yeah I thought it was strange too when testing. I looked at

function Module.ban_player(player, reason)
and there was no "admin" player in the code so I just assumed bans always had <server> as actor. I actually never banned myself a player in game, only through our interface, so I dont know if there's another route that shows the actor of the ban? Actor of the ban should be displayed if done by command/buttons (probably need to add it as 3rd param in the Report module and if not available, default to <script> just like other commands)

@grilledham
Copy link
Collaborator

In game we normally ban using the /ban command that picks up the admin automatically. The problem is that https://lua-api.factorio.com/latest/classes/LuaGameScript.html#ban_player doesn't let you pass in the admin. I'm not sure how we can work around this. I tried the rawset(game, 'player', admin) trick, but it didn't work in this case 🙁.

image

Copy link
Collaborator

@grilledham grilledham left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think these are the last few comments.

features/report.lua Outdated Show resolved Hide resolved
features/report.lua Outdated Show resolved Hide resolved
features/report.lua Outdated Show resolved Hide resolved
@grilledham grilledham merged commit 4b040d1 into Refactorio:develop Sep 2, 2024
1 check passed
@RedRafe RedRafe deleted the admin-interface branch September 2, 2024 20:32
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants