atomic-junky / Monologue

Design complex dialogues for games!
https://atomic-junky.itch.io/monologue
MIT License
12 stars 2 forks source link

Add float variable type #11

Open RailKill opened 2 months ago

RailKill commented 2 months ago

Use Case

A story may have a simple money or math conversation that it would be good to store values with decimal points, so users can have some haggling where the price changes in their dialogue for example. Monologue's strength is with its cross-compatibility via JSON, the data may be read by other engines or applications, so it would be great to have float values be managed by Monologue too, at least it's quite a common primitive type.

Current Implementation

No float variable type.

Proposed Implementation

When adding this variable type, consider refactoring the way Variable is handled in Monologue. Notice how there are many match and checking of 0, 1, 2 indices that are common across multiple nodes such as RootNode, ActionNode and ConditionNode. Each of these node panel controls are slightly different from one another, but we can create a VariableHandler node with @export variables that can take in user-defined UI controls from the Inspector, so that this VariableHandler can update the GUI controls as needed while still retaining the core logic of dealing with variables in its own script. With this refactoring, adding new variable types across all related nodes will be trivial.