MantisBT - Zandronum
View Issue Details
0000904Zandronum[All Projects] Suggestionpublic2012-07-01 16:212018-09-30 19:52
Watermelon 
Torr Samaho 
normalfeatureN/A
closedfixed 
 
1.0 
0000904: DISCONNECT scripts return negative player number on specating (new CompatFlag?), or new DISCONNECT parameter
When a player spectates, he/she triggers the DISCONNECT (int playerNumberHere) script. There is a usefulness for being able to tell if "the player just spectated" or "player has outright left the game".

There are some minor advantages to this with respect to checking if something in the level should continue if the player is just spectating or not, or if "data on the player" should be left on the server for a specific player... example: Lets say the server stores the location of the player -- he needs to spectate for an unknown reason -- upon rejoining (if he didnt leave) it could restore them to the same spot with ACS.
This could also help with storing server data in ACS and not just dumping it asap upon disconnection. If they fully log out/time out/whatever, the server will be able to tell if its a positive or negative number and adjust accordingly.

There is the ability to use the second argument of the three available to return a true/false (1 = exit outright, 0 = just spectated, or kicked from the game to spectator or whatever).

I don't know if the second one (new parameter) is easier to code in or not, but to prevent backwards compatibility, maybe
Compat_SpectateDisconnectNegative true/false could be added, if enabled (disabled by default).

Or possibly a new flag?
Script 123 (int num) DISCONNECT SPECTATE

I'm not sure if there's an easy way to do this or not.




IN ADDITION:
So far there is a cheap way around it by just having a DISCONNECT CLIENTSIDE script puke a command to the server saying "I'm still here!", but lag could interfere with this (ex: how long should the server wait before dumping stored information on a player from ACS? etc); by implementing what kind of exit is performed by the player, the server would have more control over what happens in the game.
No tags attached.
Issue History
2012-07-01 16:21WatermelonNew Issue
2012-07-01 16:24WatermelonNote Added: 0003879
2012-07-08 09:58Torr SamahoNote Added: 0003914
2012-07-08 09:58Torr SamahoAssigned To => Torr Samaho
2012-07-08 09:58Torr SamahoStatusnew => feedback
2012-07-08 09:59Torr SamahoNote Edited: 0003914bug_revision_view_page.php?bugnote_id=3914#r2146
2012-07-08 10:00Torr SamahoNote Revision Dropped: 3914: 0002145
2012-07-15 09:25Torr SamahoNote Added: 0003980
2012-07-15 09:29Torr SamahoStatusfeedback => needs testing
2012-07-15 13:55ZzZomboNote Added: 0003992
2012-08-02 13:36WatermelonNote Added: 0004193
2012-08-02 19:07Torr SamahoStatusneeds testing => resolved
2012-08-02 19:07Torr SamahoFixed in Version => 1.0
2012-08-02 19:07Torr SamahoResolutionopen => fixed
2018-09-30 19:52Blzut3Statusresolved => closed

Notes
(0003879)
Watermelon   
2012-07-01 16:24   
Also:
'http://zandronum.com/tracker/view.php?id=700 [^]'

Torr Samaho said in this area that it would be possible for ACS to determine if a client is spectating or not easily. Do not know if this applies here or not.
(0003914)
Torr Samaho   
2012-07-08 09:58   
(edited on: 2012-07-08 09:59)
I don't think that we should touch the return value of DISCONNECT scripts, but you want intend should be achievable with a new function: To test this I added the new ACS function PlayerIsSpectator, please test if this binary works as intended. To use the new function you need to add
-101:PlayerIsSpectator(1),
to your zspecial.acs.

You will not see though when the spectator disconnects, but an altered DISCONNECT return value wouldn't allow this either.

(0003980)
Torr Samaho   
2012-07-15 09:25   
Since I didn't get any feedback on the new function so far, I added it to our repository in the hope that it will be tested when the next official beta build is released.
(0003992)
ZzZombo   
2012-07-15 13:55   
Actually I tested it once but forgot to mention it. Sorry, it worked fine for me.
(0004193)
Watermelon   
2012-08-02 13:36   
Tested in the latest build, worked successfully