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

Implement exposed actions #1102

Merged
merged 1 commit into from
Nov 25, 2022
Merged

Implement exposed actions #1102

merged 1 commit into from
Nov 25, 2022

Conversation

Pablete1234
Copy link
Member

@Pablete1234 Pablete1234 commented Nov 21, 2022

Adds a way for PGM <action>s to be exposed to trigger/untrigger via commands. This is somewhat equivalent to how staff can manage monument modes via /mode start or /mode push, but for actions.

The commands to manage actions are /action or /actions, and the 3 sub-commands are list, trigger and untrigger.
/action list -> lists all exposed actions in the current match
/action trigger [action] -> triggers the action
/action untrigger [action] -> untriggers the action, keep in mind very few actions actually do anything when untriggering at all. However, it may be useful in combination with removable kits.

In order to be available to trigger by commands, actions must:

  • have an id
  • have the expose="true" attribute,
  • support the match scope (eg: messages work too, as they work with any audience, and match is an audience) and have an id.

If you try to use expose="true" without meeting the other requirements, you'll get an XML exception with a descriptive message.

Dummy example, send a message (to everyone in the match):

<actions>
  <message id="send-message" expose="true">Chat message!</message>
</actions>

Full example, has 2 actions to start/end blitz mode. It utilizes a variable filter in blitz module, and changes the variable value in the actions, as well as broadcasting a message (could enhance it by sending a title in ).

<actions> 
  <action id="start-blitz" expose="true" scope="match">
    <message text="Blitz mode has been enabled!"/>
    <set var="blitz_enabled" value="1"/>
  </action>  

  <action id="end-blitz" expose="true" scope="match">
    <message text="Blitz mode has been disabled!"/>
    <set var="blitz_enabled" value="0"/>
  </action>
</actions>
<variables>
  <variable id="blitz_enabled" scope="match"/>
</variables>
<blitz>
  <filter>
    <variable var="blitz_enabled">1</variable>
  </filter>
</blitz>  

Signed-off-by: Pablete1234 <pabloherrerapalacio@gmail.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging this pull request may close these issues.

2 participants