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

feat: Server-side choice RUI #831

Draft
wants to merge 22 commits into
base: main
Choose a base branch
from

Conversation

Alystrasz
Copy link
Contributor

@Alystrasz Alystrasz commented Aug 6, 2024

Allows server to use conversation RUI on clients.

serverside_choice_v2.webm
TODOs
  • Take an array of choices as input parameter
  • Support one choice only
  • Throw with more than 2 choices
  • NSGetPlayerChoiceResponse should return an enum
  • Use Northstar voting bindings
  • Client commands checks

Basic API

string function NSCreateChoiceOnAllPlayers( array<string> options, float duration );

Detailed API

string function NSCreateChoiceOnPlayer( entity player, array<string> options, float duration, string key = "" );

This function will return a key, that you must use with NSGetPlayerChoiceResponse to get players' answers to your choice.
The key parameter can be used to ask several times the same choice to a given player (as long as they don't answer it, for instance).

int function NSGetPlayerChoiceResponse( entity player, string key );

Return values:

global enum ePlayerChoiceStatus
{
	UNKNOWN,
	NOT_FOUND,                         // no choice matching the key was found
	NOT_FOUND_FOR_PLAYER,   // choice exists, but the player was not proposed with it

	ONGOING,                             // choice is currently proposed to the player, whom hasn't answered it yet
	NOT_ANSWERED,                  // player did not answer the choice (RUI timed out)
	CHOICE_1,                             // player selected first option
	CHOICE_2                              // player selected second option
}

Testing

  1. Install this PR;
  2. Start a match on a private server;
  3. From the console, run sv_cheats 1;
  4. Run script print(NSCreateChoiceOnAllPlayers( ["Yes, I would love to go on your quest!", "This sounds dangerous, I'll pass."], 10 ));
  5. Note the NSCreateChoiceOnAllPlayers returned key;
  6. Get the result of the choice by running script print(NSGetPlayerChoiceResponse( GetPlayerArray()[0], "YOUR_KEY_HERE")).

@Alystrasz Alystrasz changed the title feat: Server-side choice feat: Server-side choice RUI Aug 6, 2024
Copy link
Member

@GeckoEidechse GeckoEidechse left a comment

Choose a reason for hiding this comment

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

This review is basically writing down what we discussed in VC yesterday. Very much looking forward to getting this merged :D

Comment on lines +289 to +290
RegisterConCommandTriggeredCallback( "+scriptCommand1", Pressed_Choice1 )
RegisterConCommandTriggeredCallback( "+scriptCommand2", Pressed_Choice2 )
Copy link
Member

Choose a reason for hiding this comment

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

scriptCommand1/scriptCommand2 feel like placeholder names :P

@GeckoEidechse GeckoEidechse added the waiting on changes by author Waiting on PR author to implement the suggested changes label Aug 8, 2024
@GeckoEidechse
Copy link
Member

Putting this back into draft until the requested changes are addressed so that I can have a better overview of which PRs need reviewing rn ^^

@GeckoEidechse GeckoEidechse marked this pull request as draft August 14, 2024 20:49
Copy link
Member

@GeckoEidechse GeckoEidechse left a comment

Choose a reason for hiding this comment

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

Confirmed working in testing

image

@Alystrasz
Copy link
Contributor Author

Alystrasz commented Oct 1, 2024

So afaik NS voting bindings can be used for this feature, the issue being the RUI element having the key values (X and V) hardcoded.

[EDIT]: This can't be implemented as long as we don't have custom RUIs.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
waiting on changes by author Waiting on PR author to implement the suggested changes
Projects
Status: No status
Status: Alystrasz' TODOs
Development

Successfully merging this pull request may close these issues.

3 participants