Skip to content

Generics

Daedalus1400 edited this page May 19, 2017 · 5 revisions

Overview

In order to make the system more flexible, "condition" and "action" objects' arguments' values are implemented as generic types. When an argument requires a number/string it can be given a literal number/string, or an object that pretends to be a number/string. By wrapping primitives, an argument can have a value that changes as needed. This can be as simple as a random number generator instead of a fixed value, or something more complex, for example mapping the players position to a probability.

It's not turtles all the way down

In order to keep the mod somewhat sane and well behaved, generic values can only be given as values to "condition" or "action" arguments. Generics cannot be used as arguments in generics. Generics also cannot be used as the "type" of any object, since "type" is treated as a declaration, not an argument.

That said, generics can be used in any argument in any "condition" or "action" object, regardless of the effects this may produce in-game. It is left to the pack maker to decide whether feeding random number generators into random number generators is a good idea.

Clone this wiki locally