Fix travelnet removal issue and cleanup removal code #58
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.
Fixes #57
The issue here was that after this MR #56 I accidentally changed one instance of
"owner"
to"owner_name"
that was referring to metadata, not formspec fields. The error was made because the metadata is serialised, so is a table with thefields
property, I interpreted this as formspec fields instead of metadata so didn't correct it when reviewing the code.Incorrect. We want it to remove the station if the data is broken.
I've cleaned up the code a little as I noticed we don't technically detect all failures and may actually give a player an item when the removal actually fails.I split up the
travelnet.remove_box
method intotravelnet.remove_box_action
andtravelnet.remove_box_message
, separating out the action lets us tell if it's succeeded or not before continuing. It also brings it closer in line with the high-level actions, which respond in the same way on failuretravelnet.remove_box
is kept, and simply calls into those new methods to replicate the old behaviour