this post was submitted on 17 Nov 2024
24 points (100.0% liked)

Factorio

1023 readers
38 users here now

A Lemmy community for the game Factorio made by Wube Software.

Rules

founded 1 year ago
MODERATORS
 

I've often seen Factorio compared to software development. I'm not a software dev, only a casual programming hobbyist at best. In that context, Gleba spoilage feels like error handling: if things go wrong, do this. If the line spoils, grab it and burn/convert-to-nutrients.

top 2 comments
sorted by: hot top controversial new old
[โ€“] [email protected] 4 points 3 days ago (1 children)

You can think of it that way - sure. If you want a deeper insight into development I'd just consider it a form of conditional switching. I think back to washing ores in SeaBlock (you're running recipes that could output one of like six things and sushi-ing is the only real recourse). Some filters might be dealing with success cases, some might be error cases - they aren't really treated any different at a basic level. The data needs to go where it's supposed to and exceptions (excepting unhandled ones) aren't really any different than any other status response.

Many operations can return multiple states, a "correct" usage of that operation is being able to handle all of those states in a reasonable and planned manner.

[โ€“] RustyNova 1 points 3 days ago* (last edited 3 days ago)

I feel like it's more analogous to enum pattern. Your belt is just a array, and your items are enums that may be part of that enum

So to go back to gleba, nutrient belts are just Vec<Result<Nutriment, Spoilage>>