mirror of
https://github.com/R2Northstar/NorthstarMods
synced 2026-08-25 12:29:17 -04:00
Add default keys for polls (#1001)
add hardcoded default keys for polls
This commit is contained in:
parent
4fb9574dd3
commit
f2a6cdd14a
1 changed files with 22 additions and 0 deletions
|
|
@ -56,6 +56,8 @@
|
|||
float duration
|
||||
bool pollActive
|
||||
array<var> ruis
|
||||
bool keysInit = false
|
||||
array<int> keys = [ KEY_1, KEY_2, KEY_3, KEY_4, KEY_5, KEY_6, KEY_7, KEY_8, KEY_9 ]
|
||||
} poll
|
||||
|
||||
string id
|
||||
|
|
@ -297,6 +299,7 @@ enum eDataType
|
|||
{
|
||||
case eMessageType.POLL:
|
||||
thread ShowPollMessage_Threaded()
|
||||
InitDefaultKeyBinds()
|
||||
break
|
||||
|
||||
case eMessageType.LARGE:
|
||||
|
|
@ -443,6 +446,25 @@ enum eDataType
|
|||
client.poll.pollActive = false
|
||||
}
|
||||
|
||||
void function InitDefaultKeyBinds()
|
||||
{
|
||||
if ( client.poll.keysInit )
|
||||
return
|
||||
|
||||
foreach ( int index, int key in client.poll.keys )
|
||||
{
|
||||
RegisterButtonPressedCallback(
|
||||
key,
|
||||
void function( var button ) : ( index )
|
||||
{
|
||||
if ( client.poll.pollActive )
|
||||
GetLocalClientPlayer().ClientCommand( "vote " + ( index + 1 ) )
|
||||
}
|
||||
)
|
||||
}
|
||||
client.poll.keysInit = true
|
||||
}
|
||||
|
||||
void function InfoMessageHandler_Threaded()
|
||||
{
|
||||
while ( true )
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue