Content Patcher

Content Patcher

463k Downloads

[Content Patcher] add negative conditions

Pathoschild opened this issue ยท 4 comments

commented

Content Patcher 1.3 added conditions with the When field. Extend that to support negative conditions with WhenNot:

// any day in summer except the 11th
"When": {
   "Season": "Summer"
},
"WhenNot": {
   "Day": 11
}
commented

Your idea could cause problems if someone tried to set both a positive and negative condition for the same condition type. For example:

"When": {
   "Season": "Summer"
},
"WhenNot": {
   "Season": "Summer"
}

Another idea is to mark a condition as negative if it starts with !. For example:

"When": {
   "Season": "!Summer, Winter",
   "Day": "!11, 24"
}

Which means when it isn't the 11th or 24th of summer or winter.

commented

Contradictory conditions would work fine (insofar as they'll correctly never apply). Supporting negation within the condition could work too (though of course they could do "Season": "Summer, !Summer" too).

(I think a ! flipping all values would be confusing though. If it's inside the condition list, it would only be for the condition it's in front of.)

commented

Per discussion on Discord, the preferred format is:

"When": {
   "Season": "Summer",
   "Not:Day": "11"
}
commented

That's now handled by the subkey format added in Content Patcher 1.5:

"When": {
   "Day:11": false // not day 11
}