Please disclose if any significant portion of your mod was created using AI tools by adding the 'AI Generated' category. Failing to do so may result in the mod being removed from Thunderstore.
Scripting - Objects - Conditions
Updated 2 weeks agoConditions drive complex logic in the scripting, there are many different types of conditions.
Common Properties
All types of conditions have the listed variable:
conditionType
The type of Condition, all conditions have this variable, it defines what type of conditions it is.
Values: Any of the types listed under the heading "Condition Types", as a string (e.g. "And")
Condition Types
And
Passes only if all of the provided conditions pass
conditions
The Conditions to check, all must pass the check for the And Condition to pass.
Value: An array of Conditions.
Or
Passes if any of the provided conditions pass.
conditions
The Conditions to check, one or more must pass the check for the Or Condition to pass.
Value: An array of Conditions.
Not
Inverts the provided condition.
condition
The Condition to check, it must fail for the Not Condition to pass the check.
Value: A Condition.
Weather
Passes if the provided weather type matches the current moon's weather.
weather
The weather type.
Values: "DustClouds", "Eclipsed", "Flooded", "Foggy", "None", "Rainy", "Stormy"
PlayerLocation
Passes if the player you're controlling is in/at this location.
location
The location.
Values: "Ship", "Facility"
PlayerAlive
Passes if the player you're controlling is alive.
PlayerHealth
Passes if the health of the player you're controlling passes a given comparison.
comparisonType
The type of comparison.
Values: "Equals", "NotEquals", "GreaterThan", "LessThan", "GreaterThanOrEquals", "LessThanOrEquals"
value
The value to compare the health to.
Value: A valid integer. (Note: the player has 100 max health)
PlayerCrouching
Passes if the player you're controlling is crouching.
PlayerSprinting
Passes if the player you're controlling is sprinting.
PlayerStamina
Passes if the player you're controlling has an amount of stamina that passes a given comparison.
comparisonType
The type of comparison.
Values: "Equals", "NotEquals", "GreaterThan", "LessThan", "GreaterThanOrEquals", "LessThanOrEquals"
value
The stamina amount.
Value: a valid float. (0.0 to 1.0, 0 being minimum stamina, 1 being maximum stamina)
PlayerInsanity
Passes if the player you're controlling has an insanity that passes a given comparison.
comparisonType
The type of comparison.
Values: "Equals", "NotEquals", "GreaterThan", "LessThan", "GreaterThanOrEquals", "LessThanOrEquals"
level
The insanity level.
Value: a valid float. (0.0 to 1.0, 0 being minimum insanity, 1 being maximum insanity)
PlayerHasItem
Passes if the player you're controlling has an item with the given name.
itemName
The name of the item.
Value: a valid string. (e.g. "Flashlight")
checkNormalSlots
Which normal slots to check for the item.
Value: an array of integers.
Default: [0, 1, 2, 3]
checkBagsInNormalSlots
Which normal slots will have their belt bags checked for the item.
Value: an array of integers.
Default: [0, 1, 2, 3]
checkBeltSlot
Check the belt/utility slot for the item?
Value: true, false
Default: true.
checkBagInBeltSlot
Check for the item inside belt bags in the belt/utility slot?
Value: true, false
Default: true.
checkBagsInBagSlots
Check for the item inside belt bags that are in other belt bags? (I'm not even sure if this is possible in vanilla).
Value: true, false
Default: true.
PlayerHoldingItem
Passes if the player you're controlling is holding an item with the given name.
itemName
The name of the item.
Value: a valid string. (e.g. "Flashlight")
checkBags
Check for the item inside held belt bags?
Value: true, false
Default: false.
ShipLanded
Passes if the ship is currently landed.
ShipLeavingAlertCalled
Passes if the ship leaving alert has been called.
MusicWithTagPlaying
Passes if music with a specified tag is playing.
tag
The tag to look for.
Value: A valid string.
CurrentMoon
Passes if the current moon has the same name as the one specified (you can find the name of a moon by routing to it and seeing what it says on the monitor under "Orbiting").
moonName
The name of the moon in question.
Values: A valid string. (e.g. "41 Experimentation")
Timer
Passes if a set timer has passed a given threshold
timerName
The name of the timer.
Value: a valid string.
timeGoal
The threshold for the time to reach.
Value: a valid float.
resetsTimer
Should this condition reset the specified timer if it has reached the goal?
Value: true, false
Default: true
Random
Passes if a random number falls between 0 and the chosen number.
chance
The chance of this condition passing.
Value: a valid float. (0 to 1, 0 being a 0% chance, 1 being a 100% chance)
ApparatusDocked
Passes if the Apparatus exists and is docked.
TimeOfDay
Passes if the time of day passes a given comparison.
comparisonType
The type of comparison.
Values: "Equals", "NotEquals", "GreaterThan", "LessThan", "GreaterThanOrEquals", "LessThanOrEquals"
time
The normalised time.
Value: a valid float. (0 to 1, 0 being the start of the day, 1 being the end of the day)
FacilityInterior
Passes if the current interior has the same name as the one specified. All valid interior names are printed to the console if the given interior is not found.
interiorName
The name of the interior in question.
Value: A valid string. (e.g. "Mansion").
Accepts shorthand names for vanilla interiors:
| Shorthand | Condition passes when interior is... |
|---|---|
"Factory any" |
"Level1Flow", "Level1FlowExtraLarge", or "Level1Flow3Exits" |
"Factory normal" |
"Level1Flow" |
"Factory large" |
"Level1FlowExtraLarge" |
"Factory 3 exits" |
"Level1Flow3Exits" |
"Mansion" |
"Level2Flow" |
"Mineshaft" |
"Level3Flow" |
PlayerCount
Passes if the amount of [query] players passes a given comparison.
comparisonType
The type of comparison.
Values: "Equals", "NotEquals", "GreaterThan", "LessThan", "GreaterThanOrEquals", "LessThanOrEquals"
queryType
The type of query.
Values: "Total", "Alive", "Dead"
count
The amount of players.
Value: a valid integer.
PlayersAlivePercent
Passes if the percent of living players passes a given comparison.
comparisonType
The type of comparison.
Values: "Equals", "NotEquals", "GreaterThan", "LessThan", "GreaterThanOrEquals", "LessThanOrEquals"
percent
The percent of living players.
Value: a valid float. (0.0 to 1.0)