[Klonan] [1.1.59] Ungraceful error associated with jump_to_cutscene_waypoint out-of-bounds

Post Reply
Honktown
Smart Inserter
Smart Inserter
Posts: 1025
Joined: Thu Oct 03, 2019 7:10 am
Contact:

[Klonan] [1.1.59] Ungraceful error associated with jump_to_cutscene_waypoint out-of-bounds

Post by Honktown »

Reasoning:
I wanted to pcall(player.jump_to_cutscene_waypoint, event.waypoint_index + 1) during on_cutscene_waypoint_reached, to test if the waypoint just reached was the final (within reason). Was in the middle of testing what was true (are we still in cutscene controller, what gets raised, etc) and ran into a side-effect.

Logically speaking, either the waypoint is set to it's current value (doing nothing, maybe raising reached event which would be avoided the second time) or an error is raised: index out of bounds, meaning the last waypoint just ended the cutscene.

Expectation: Error is raised without side-effects.
Reality: Error with side effect of raising on_cutscene_waypoint_reached only when omitting a final_transition_time

Reproduction:
0) listen to reached event and set an incremented index

1) Create a set_controller argument table with some waypoints.
2) omit a final_transition_time
3) set_controller(cutscene)

Game repeatedly raises waypoint reached with higher indices, never leaving the cutscene.
If final_transition_time is present* [edit], there is no side-effect.

Code is provided:
cutscenes.lua
(1.56 KiB) Downloaded 64 times
I understand the nature of this is "there's a side effect from *an error*, could you fix the side effect?", but it is a strange incident that I thought someone might want to know about.
waypoint_spam.jpg
waypoint_spam.jpg (505.28 KiB) Viewed 1030 times
I have mods! I guess!
Link

User avatar
Klonan
Factorio Staff
Factorio Staff
Posts: 5150
Joined: Sun Jan 11, 2015 2:09 pm
Contact:

Re: [Klonan] [1.1.59] Ungraceful error associated with jump_to_cutscene_waypoint out-of-bounds

Post by Klonan »

Its not really a side effect of an error, just a bug, that if you set the index to the last index when you have no final transtion time, it would fail its 'Am I finished check' and loop forever.

I fixed it for 1.2

Post Reply

Return to “Fixed for 2.0”