amethyst icon indicating copy to clipboard operation
amethyst copied to clipboard

Actions aren't really attributes in Caves of Zircon, they're a code smell which means something may be missing

Open BobG1983 opened this issue 5 years ago • 3 comments

Caves of Zircon has an attribute called Actions which is a command container, which is basically a special case of

if(hasAttribute) dispatchCommandOnOtherEntity

Its a useful construct, but it feels like its a code smell and something is missing.

Actions could be hoisted up to be equivalent to facets, behaviors etc. but then you could only trigger them all. So having different triggers (bump vs shoot vs eat for example) wouldn’t work. Is there some missing concept?

Or is this the least worst idea?

BobG1983 avatar May 01 '19 22:05 BobG1983

My gut is that this may change once we have single command facets and global systems solved

BobG1983 avatar May 02 '19 19:05 BobG1983

I agree. I think I'll draw a diagram with all these things, and write some examples just to give ourselves some ammunition for thinking about this.

adam-arold avatar May 03 '19 09:05 adam-arold

You were right, the Facet composition is a good solution to create a command dispatcher and we can just send specific Commands to an Entity when we want to try its actions so this:

result = entity.tryActionsOn(context, block.occupier.get())

we can do

result = entity.executeCommand(TryAction(context, block.occupier.get())

adam-arold avatar Nov 22 '20 11:11 adam-arold