scrom / Experiments

a NodeJS text adventure - deliberately coded badly to re-experience the pain of legacy code
http://mvta.herokuapp.com/
2 stars 0 forks source link

Bottles as containers shouldn't be able to hold solids #416

Closed scrom closed 8 years ago

scrom commented 8 years ago

Some containers can hold liquids. Anything defined as a container can hold solids.

This isn't quite right. A bottle is unlikely to be able to hold cereal or salad.

Need to add another container attribute "holdsSolids". This should probably default to true (which is inconsistent with other booleans but the most common setting). For containers like bottles that can't hold solids (can still hold powders and liquids), the "canContain" function should check it's not trying to take a solid (not liquid or powder).

scrom commented 8 years ago

this looks surprisingly easy - adding a container subtype of "bottle"

scrom commented 8 years ago

There's a more subtle piece to this which is that failure handing of trying to put one item into another is pretty unintelligent. As part of fixing this up I've improved messaging a little around this.