Lock Player Interaction with Gamestages
MasterEnderman opened this issue ยท 2 comments
Would be great to disable player interaction with the machines (saw, chopping block...) and blocks (crate, shelf) with gamestages.
I've been giving some thought to this and this is what I've come up with so far.
This is using the Worktable as an example, but it'd be the same across most of the interactable stuff.
You'd be able to use ZS to define some set logic to determine if a player can use the device, and this is what it might look like:
import mods.pyrotech.Stages;
import mods.pyrotech.Worktable;
Worktable.setGameStages(
Stages.and(["stageA", "stageB", Stages.or([
Stages.and(["stageC", "stageD"]).not(Stages.or(["stageE", "stageG"])),
Stages.or(["stageE", "stageF"]).not(Stages.and(["stageC", "stageE"]))
])])
);
This would only allow a player to use the worktable if:
- the player has (
stageA
ANDstageB
) - AND the player has either:
- (
stageC
ANDstageD
), but NOT (stageE
ORstageG
) - OR (
stageE
ORstageF
), but NOT (stageC
ANDstageE
)
- (
Some other examples:
// allow if player has stageA
Worktable.setGameStages(Stages.and(["stageA"]));
// allow if player does not have both stageA and stageB
Worktable.setGameStages(Stages.not(Stages.and(["stageA", "stageB"])));
// allow if player has both stageA and stageB and not stageC
Worktable.setGameStages(Stages.and(["stageA", "stageB"]).not("stageC"));
// allow if player has both stageA and stageB and not stageC
Worktable.setGameStages(Stages.and(["stageA", "stageB", Stages.not("stageC")]));
// allow if player has either stageA or stageB and not stageC
Worktable.setGameStages(Stages.or(["stageA", "stageB"]).not("stageC"));
// allow if player has either stageA or stageB or not (stageC and stageD)
Worktable.setGameStages(Stages.and(["stageA", "stageB", Stages.not(Stages.and(["stageC", "stageD"]))]));
The methods would then be:
import mods.pyrotech.Worktable;
static void setGameStages(Stages stages);
---
import mods.pyrotech.Stages;
static Stages and(Object[] stages);
static Stages or(Object[] stages);
static Stages not(string stage);
static Stages not(Stages stages);
Stages not(string stage)
Stages not(Stages stages);