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

Many Event Logic and Visual improvements #1060

Conversation

Jowan-Spooner
Copy link
Collaborator

@Jowan-Spooner Jowan-Spooner commented Jul 31, 2022

Multiline event saving

Allows to load events from multiple lines. To do so, the loader asks the event if it thinks it is full and if not it adds the next line and asks again.

The text event will say it's not full if it ends with \
The shortcode events will say they are not full if they don't end with ]
The method in is is_string_full_event(string) -> bool
This means oc that you can also store events in multiple lines.

Making things more modular

I have once again made a lot of the logic behind the events more modular.
This time it was about making the scripts not depend on specific events.

One exception is the DialogicEndBranchEvent!
This event is super special and I cannot see a way to make it deletable.
The Choice and Condition events however are now not needed anymore.

Instead events have a couple of more flags and methods they can fill in:

  • can_contain_events :bool
    -> marks events that open a new block and need an end event
  • needs_parent_event : bool
    -> marks events that want to be the child of a specific event (like choice wants to be child of text)

These are mainly used for indentation logic (both in editor and when saving).
If one or both of these are turned on a couple of overridable methods can be used:

  • is_expected_parent_event(event) -> bool
    -> to indicate what event a "needs_parent_event"-event needs
  • get_end_branch_control() -> Control
    -> a control that will be added to the end branch

New event lines

The editor has new lines connecting the events!
They also use the logic from above.

  • added indicator for collapsed events

Logic updates

The logic (especially for the End Branch and Condition event) has been updated to be less dependent on specific events as well.

  • adds new method to event resource that can be overridden:
    should_execute_this_branch()
    -> it should mostly be false except (right now) for a condition event of type IF
    -> usually the End Branch event will NOT consider going to another event that opens a branch and is on the same level (like a following choice event or ELIF event) but if this returns true then it will

# Multiline event saving
Allows to load events from multiple lines. To do so, the loader asks the event if it thinks it is full and if not it adds the next line and asks again.

The text event will say it's not full if it ends with `\`
The shortcode events will say they are  not full if they don't end with `]`
The method in is `is_string_full_event(string) -> bool`
This means oc that you can also store events in multiple lines.

# Making things more modular
I have once again made a lot of the logic behind the events more modular.
This time it was about making the scripts not depend on specific events.

One exception is the DialogicEndBranchEvent!
This event is super special and I cannot see a way to make it deletable.
The Choice and Condition events however are now not needed anymore.

Instead events have a couple of more flags and methods they can fill in:

- can_contain_events :bool 
    -> marks events that open a new block and need an end event
- needs_parent_event : bool
     -> marks events that want to be the child of a specific event (like choice wants to be child of text)

These are mainly used for indentation logic (both in editor and when saving).
If one or both of these are turned on a couple of overridable methods can be used:
- is_expected_parent_event(event) -> bool
     -> to indicate what event a "needs_parent_event"-event needs
- get_end_branch_control() -> Control
     -> a control that will be added to the end branch

# New event lines
The editor has new lines connecting the events!
They also use the logic from above.

# Todo:
While the editor itself has been cleaned from these references, the event logic itself will need to be tackled next. This is a bit more complicated, but I will give it a shot. Main things I will be working on:
- Subsystem_Choices
- EndBranchEvent
- ConditionEvent
- ChoiceEvent
- rewrite of EndBranch logic
- adds new method to event resource that can be overridden:
   `should_execute_this_branch()`
      -> it should mostly be false except (right now) for a condition event of type IF
      -> usually the End Branch event will NOT consider going to another event that opens a branch and is on the same level (like a following choice event or ELIF event) but if this returns true then it will

- added indicator for collapsed events
@Jowan-Spooner Jowan-Spooner marked this pull request as ready for review July 31, 2022 14:07
@coppolaemilio coppolaemilio merged commit 15dd296 into dialogic-godot:Godot-4-update Jul 31, 2022
@Jowan-Spooner Jowan-Spooner deleted the event_resource_update branch December 26, 2023 17:50
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants