Terra (Fabric/Forge/Paper)

Terra (Fabric/Forge/Paper)

74.2k Downloads

Custom parsii functions

dfsek opened this issue ยท 2 comments

commented

Add a way to register custom Parsii functions in the pack manifest, probably under a functions key analogous to variables.

Functions would have a customizable number of arguments, represented as alphabetic variables within a parsii equation, e.g. 3 arguments = a b and c as vars within the equation.

Mockup:

functions:
  fourMax:
    arguments: 4
    function: "max(max(max(a, b), c), d)"

These would be parsed per-biome, and registered separately to each biome's Expression instances, to allow them to

  • Use overridden variables in biomes
  • Be overridden in biomes.
commented

Maybe also optionally add a way to give argument variables custom names, e.g.

functions:
  fourMax:
    arguments: 4
    variable-names:
      - w
      - x
      - y
      - z
    function: "max(max(max(w, x), y), z)"

Any indices not present in the names list would just be assigned alphabetic names.

commented

Implemented in 1863ba2