Descriptive Problem Summary:
When using world.SetConfig to set a ckey's role as admin, in order to, they will need to reconnect in order to have the profiling options appear on their client, even tho GetConfig reports them as having role=admin regardless
in addition, if role=admin is removed, they will also need to reconnect for the "Profile Code" tab to be removed, altho they won't be able to actually USE it before they reconnect, it'll just error about them not being able to debug.
I tested and the issue occurs in 514.1589, 515.1647, and 516.1652
Numbered Steps to Reproduce Problem:
1. use world.SetConfig to give someone the admin role
2. "Profile Code" does not appear in that client's Server -> Profile interface
3. reconnect
4. "Profile Code" now appears in that client's Server -> Profile interface
Code Snippet (if applicable) to Reproduce Problem:
(note: /world/Tick() needs to be replaced with a set background=1 based ticker if testing in 514 or earlier, although the only purpose of the ticker is to have something that shows up in the profiler to confirm it's working)
var/list/connected_ckeys = list()
/client/New()
. = ..()
if(!(ckey in global.connected_ckeys))
global.connected_ckeys += ckey
if(has_profiling())
world.SetConfig("APP/admin", ckey, null)
src << "you already had role=admin set from a previous test. disconnecting you, fully reopen dreamseeker in order to properly reset it"
del(src)
return
src << "you currently [has_profiling() ? "DO" : "DON'T"] have role=admin"
/client/proc/has_profiling()
return findtext(world.GetConfig("admin", ckey), "role=admin")
/client/verb/give_profiling()
if(has_profiling())
src << "you already have role=admin set"
return
world.SetConfig("APP/admin", ckey, "role=admin")
src << "APP/admin granted to [ckey] (checking: has_profiling() returned [has_profiling()])"
src << "the issue: you now need to reconnect in order to see the server profiler interface on your client"
/client/verb/take_profiling()
if(!has_profiling())
src << "you don't have role=admin set"
return
world.SetConfig("APP/admin", ckey, null)
src << "APP/admin removed from [ckey] (checking: has_profiling() returned [has_profiling()])"
src << "another issue: the server profiling menu will still appear for you until you reconnect, but trying to interface with it will just spit out an error"
// simple helper verb to reconnect
/client/verb/reconnect()
src << "reconnecting"
winset(src, null, list("command" = ".reconnect"))
// automatically remove admin role from everyone who connected during world shutdown, just to reset variables while testing
/world/Del()
for(var/ckey in global.connected_ckeys)
world.SetConfig("APP/admin", ckey, null)
world.log << "removing admin role from [ckey] during shutdown"
return ..()
// just run a basic time-waster proc every tick so it'll show up in the profiler, allowing us to confirm the profiler is working and updating
/world/Tick()
random_ticker_proc_just_so_the_profiler_isnt_blank()
/proc/random_ticker_proc_just_so_the_profiler_isnt_blank()
. = 1
for(var/i = 1 to 42)
. *= 1 + rand()
Expected Results:
able to interface with the server profiler from the client after clicking "give profiling"
Actual Results:
need to reconnect in order to interface with the server profiler from the client
Does the problem occur:
Every time? Or how often? Yes.
In other games? Yes.
In other user accounts? N/A
On other computers? Yes.
When does the problem NOT occur?
If the user had role=admin already set before they connected
Did the problem NOT occur in any earlier versions? If so, what was the last version that worked? (Visit http://www.byond.com/download/build to download old versions for testing.)
N/A
Workarounds:
Reconnect after setting role=admin