Keep information of a disconnected player for a tic or so

Moderator: GZDoom Developers

Post Reply
User avatar
Fused
Posts: 80
Joined: Wed Jul 02, 2014 2:44 pm
Contact:

Keep information of a disconnected player for a tic or so

Post by Fused »

Currently it seems the information of a player will be removed completely the instant he disconnects from a server. The only thing you could basically catch is his ID using the DISCONNECT script type. This is annoying as you would have to create arrays to store information of every player because of this, in case you need to know certain info after he disconnected.

My suggestion is to allow player information to stay around for another tic or so so it can be found after he disconnected. This will save effort on having to create multiple arrays and also allow for more accurate info (since before disconnecting, things can be changed. Think about their nick and such).
User avatar
phantombeta
Posts: 2159
Joined: Thu May 02, 2013 1:27 am
Operating System Version (Optional): Windows 10
Graphics Processor: nVidia with Vulkan support
Location: Brazil

Re: Keep information of a disconnected player for a tic or s

Post by phantombeta »

Currently it seems the information of a player will be removed completely the instant he disconnects from a server.
I'm assuming you're testing this in Zandronum, as there are no servers in ZDoom. Are you sure ZDoom removes the player's info, not just Zandronum?
User avatar
edward850
Posts: 5886
Joined: Tue Jul 19, 2005 9:06 pm
Location: New Zealand
Contact:

Re: Keep information of a disconnected player for a tic or s

Post by edward850 »

Yes it does, or rather the info becomes useless because the player is marked as gone. Which also in lies the problem: The player is marked as gone (an absolutely necessary part of removing the player), so the playsim isn't allowed to address what might well be invalid data as the same indicator is equally used to check to make sure it doesn't address a dead slot.
This likely can't change, both because of that and any future functionality that could very well require that slot to be free instantly.
User avatar
randi
Site Admin
Posts: 7749
Joined: Wed Jul 09, 2003 10:30 pm
Contact:

Re: Keep information of a disconnected player for a tic or s

Post by randi »

It seems safe enough to run the script immediately before destroying the player, so I changed it. I could be misremembering the order of features, but I'm pretty sure disconnect scripts were added before SetReturnValue, which is when it became possible to immediately run scripts without waiting for the ACS thinker to run them, or they would have been implemented like this in the first place.

I could be wrong and this actually breaks something. Somebody might want to test this out.
User avatar
edward850
Posts: 5886
Joined: Tue Jul 19, 2005 9:06 pm
Location: New Zealand
Contact:

Re: Keep information of a disconnected player for a tic or s

Post by edward850 »

I think it might be safe from rarity alone. I can't find anything off hand that properly uses it.
User avatar
jpalomo
Posts: 772
Joined: Mon May 17, 2010 9:45 am

Re: Keep information of a disconnected player for a tic or s

Post by jpalomo »

Wouldn't this affect functions like [wiki]ClearInventory[/wiki]?
User avatar
edward850
Posts: 5886
Joined: Tue Jul 19, 2005 9:06 pm
Location: New Zealand
Contact:

Re: Keep information of a disconnected player for a tic or s

Post by edward850 »

How, exactly?
User avatar
jpalomo
Posts: 772
Joined: Mon May 17, 2010 9:45 am

Re: Keep information of a disconnected player for a tic or s

Post by jpalomo »

If the function is run with no activator (for example an OPEN script or removing an existing activator with SetActivator), it will run for and affect all active players in the game.
A script type of disconnect would normally count as no activator (the world, until this change at least). Instead of the function being run for all players, it now will only run for the disconnecting player. I'll check to see what other functions this could potentially affect.
Edit:
[wiki]GiveInventory[/wiki], [wiki]TakeInventory[/wiki], [wiki]UseInventory[/wiki], [wiki]FadeTo[/wiki], and [wiki]FadeRange[/wiki] all seem to be in the same boat as ClearInventory.
Last edited by jpalomo on Sat Jan 09, 2016 4:21 am, edited 2 times in total.
User avatar
edward850
Posts: 5886
Joined: Tue Jul 19, 2005 9:06 pm
Location: New Zealand
Contact:

Re: Keep information of a disconnected player for a tic or s

Post by edward850 »

Well the job then is to find a released example of this. :|
Post Reply

Return to “Closed Feature Suggestions [GZDoom]”