Add SDL Logic Nodes#458
Open
Hoikas wants to merge 10 commits into
Open
Conversation
This adds a new node for changing an SDL variable by drawing connections from conditions to SDL variable nodes. I initially wanted to use a logic thunk here just link in the link event node, but I found that plAACO doesn't forward the "whodoneit" information that some scripts use. So, this just forwards the attached condition.
This adds q node for responding to SDL boolean events. The SDL Bool Trigger node is designed to fire off a Responder when an SDL variable is in the expected boolean state (true or false). Optionally, the Responder can be gated on another SDL variable. The node swaps between xAgeSDLBoolRespond and xAgeSDLBoolAndRespond as needed.
This adds an SDL Boolean Condition node that triggers an attached Responder if a condition becomes true while an SDL boolean variable is true. The underlying script is xAgeSDLBoolCondResp, which was added in MOUL. The script also exists in the Offline KI, so it's a pretty safe one to bet on.
The "trigger multistage" node was a generic this-player-triggered-it message anyway. We now have some pretty generic SDL setting stuff, and it would be nice to fire those from responders. This is the tool we'll use for that.
This implements a real SDL boolean logic gate node. Some good future work here would be to force a minimum of two input node sockets to be visible at all times.
Member
Author
|
Rebased due to conflict from merging #449. |
Draft
This allows a socket definition to spawn a minimum number of sockets on a node. This is most useful for the SDL Boolean Gate node where there should always be a minimum of two input variables. Showing a minimum of two sockets is a good way to convey that requirement.
Blender does have a "COMPACT" drawing mode for list templates, but I find that those are somewhat odd - they display an item picker as an int property that barely makes sense to me. It's better, IMO, to just draw something resembling a standard list by hand that emulates the long form list. Just more compact.
This is basically a fancy lookup table, except for SDL.
This node is a wrapper for xAgeSDLIntStartStopResp, which has been in the game since TPotS. A notable use of this in MOUL was for the Kahlo Pub collapse effect.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Intro
This PR adds a set of logic nodes that can be used to more easily track the flow of execution and information. Almost all of these nodes export PythonFileMods under the hood. The Python File Nodes are great in that we have them, but it gets challenging when they are used with Responders because the flow control is inverted in that case - the responder node is an input to the PFM node and script, but the script can trigger the responder, meaning it should logically be an output. These nodes make it so that responders are outputs. See an example tree:
This tree combines two different situations and should probably be separated in a real Age. The upper tree is the more complicated one. It shows a clickable that will only be possible to click when the
Rm02BtnEnabledSDL variable is set to true. When the clickable is pressed, theRm02SpinTorusSDL boolean is toggled. WhenRm02SpinTorusis true, the animation attached to theRm02Torusobject plays. When the variable is false, the same animation stops. This is the proper way to design logic interactions in the game to synchronize among multiple clients correctly, and the flow is quite clear IMO.The bottom tree is an exercise for you, the viewer, to figure out. Be advised, although the "SDL Clickable" node is shown in the image above and described in the text above has actually been removed from this PR due to some design concerns. I will open a separate PR with that node and describe the design concerns there soon.
I do not have a demo blend to share at this time, so here is a list of the nodes added and the Python files they use in commit order. I may make a few more minor adjustments to this to ensure that some in-node lists start populated, but the code is otherwise complete, IMO. This is the follow-up promised in #449, and I expect I will want to merge this one shortly after it. Feedback needs to be prompt.
Nodes
Logic > SDL Variable
This just holds an SDL variable's name and shows logic flow. It doesn't actually export anything.

Logic > Change SDL
Changes an SDL value when notified.

Files: xAgeSDLBoolToggle, xAgeSDLBoolSet, xAgeSDLIntChange
Logic > SDL Boolean Trigger
Trigger a responder when an SDL bool changes

Files: xAgeSDLBoolRespond, xAgeSDLBoolAndRespond
Conditions > SDL Boolean Condition
Gates the firing of some other condition behind an SDL variable. Doesn't enable/disable the attached condition.

File: xAgeSDLBoolCondResp
Logic > SDL Boolean Gate
Takes >=2 SDL variables as inputs and performs either a logical AND, OR, XOR, or NAND on them, storing the result in an output variable.

Filenames: xAgeSDLBoolAndSet, xAgeSDLBoolGateSet
Logic > SDL Value Map
Uses an in-node lookup table to set the output variable value from the input variable value.

File: xAgeSDLVarSet
Logic > SDL Integer Trigger
Fires specific responder states based on an SDL int value.

File: xAgeSDLIntStateListResp
Logic > SDL Value Trigger
This is like SDL Boolean Trigger, except for a set of specific integer values.

File: xAgeSDLIntStartStopResp
Bonus Chatter
Also, in order to "convert" from being inside of a Responder to triggering the Change SDL node, the "Trigger MultiStage" message node has been renamed to just "Trigger". The "Trigger" node can trigger a MultStage or any condition... such as Change SDL. This will be a powerful way to set SDL variables at specific points during responders, eg on a oneshot marker ("DoorButtonTouch" anyone?).