At stonehearth/services/server/game_master/controllers/node.lua
There is the function Node:check_requirement_met(ctx, name, rule)
Inside it there is this code snippet:
elseif item == 'or' then
local and_rules = rule.value
local passes = true
for _, rule in pairs(and_rules) do
passes = false
if self:_all_rules_pass(ctx, rule) then
passes = true
break
end
end
lhs = true
rhs = passes
If you check that code logic, you will see that it is the same from the “and” rule. Both are calling the function Node:_all_rules_pass(ctx, can_start_rules)
In that function, only when all requirements are met it returns true. This makes it impossible for this piece of code to work (my .json encounter)
{
"type": "encounter",
"encounter_type": "wait_for_requirements_met",
"in_edge" : "wait_first_soldier",
"out_edge" : "miranda_before_selling_clay",
"wait_for_requirements_met_info": {
"requirements": {
"or": {
"item": "or",
"type":"deny_if_not",
"value": {
"value": {
"has_soldier": {
"item": "script",
"type": "deny_if_less_than",
"value": 1,
"script": "file(has_soldier.lua)"
},
"is_peaceful": {
"item": "game_mode",
"type": "deny_if_not",
"value": "stonehearth:game_mode:peaceful"
}
}
}
}
}
}
}
The logic of my encounter is:
Go to the next encounter only if you have a soldier. If you are in peaceful (which does not require that job) progress anyway even without the soldier.