Skip to content

Commit

Permalink
Fix teamster directions
Browse files Browse the repository at this point in the history
The `time_since` math function (?) returns -1 for undefined variables,
as described in docs[1]. This creates a scenario which the second clause
of '< 2 d' to always match, and directions are never actually rolled.

This patch fixes that by merging both rolling direction cases in a
single conditional cause, and the fallback is the do-nothing case.
  • Loading branch information
andrewhr committed Mar 16, 2024
1 parent 0bb4077 commit 1f3f237
Showing 1 changed file with 6 additions and 11 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,12 @@
{
"text": "So, have your caravans seen anything interesting out there in the wasteland?",
"topic": "TALK_FREE_MERCHANT_TEAMSTER_DIRECTIONS",
"condition": { "math": [ "time_since(n_timer_teamster_directions_recycler)", ">=", "time('2 d')" ] },
"condition": {
"or": [
{ "math": [ "time_since(n_timer_teamster_directions_recycler)", "==", "-1" ] },
{ "math": [ "time_since(n_timer_teamster_directions_recycler)", ">=", "time('2 d')" ] }
]
},
"effect": [
{ "math": [ "npc_randomize_dialogue_direction", "=", "rand(4)" ] },
{ "math": [ "n_timer_teamster_directions_recycler", "=", "time('now')" ] }
Expand All @@ -63,17 +68,7 @@
{
"text": "So, have your caravans seen anything interesting out there in the wasteland?",
"topic": "TALK_FREE_MERCHANT_TEAMSTER_DIRECTIONS",
"condition": { "math": [ "time_since(n_timer_teamster_directions_recycler)", "<", "time('2 d')" ] },
"switch": true
},
{
"text": "So, have your caravans seen anything interesting out there in the wasteland?",
"topic": "TALK_FREE_MERCHANT_TEAMSTER_DIRECTIONS",
"effect": [
{ "math": [ "npc_randomize_dialogue_direction", "=", "rand(4)" ] },
{ "math": [ "n_timer_teamster_directions_recycler", "=", "time('now')" ] }
],
"switch": true,
"default": true
},
{
Expand Down

0 comments on commit 1f3f237

Please sign in to comment.