From c360930ef6d67a01300d44b04a56be8e7d8adb94 Mon Sep 17 00:00:00 2001 From: Brent Yorgey <byorgey@gmail.com> Date: Wed, 18 Dec 2024 22:01:03 -0600 Subject: [PATCH] add `parsley` entity that enables `read` command --- data/entities.yaml | 27 +++++++++++++++++++++++++++ data/worlds/classic.world | 1 + 2 files changed, 28 insertions(+) diff --git a/data/entities.yaml b/data/entities.yaml index 23615f0ef..a7dcb6ed5 100644 --- a/data/entities.yaml +++ b/data/entities.yaml @@ -330,6 +330,33 @@ ignition: 0.1 duration: [20, 40] product: ash +- name: parsley + display: + attr: plant + char: 'p' + description: + - A fast-growing plant with a pungent aroma, often found growing + near rocks. + - | + When equipped as a device, parsley enables the `read` + command, which can be used to turn text into values: + ``` + read : Text -> (Unit + a) + ``` + If the given `Text`{=type} represents a value of the expected + type, the value will be returned wrapped in `inr`; otherwise + `inl ()` is returned. For example: + - | + ``` + (read "3" : Unit + Int) == inr 3 + ``` + but + ``` + (read "hello" : Unit + Int) == inl () + ``` + properties: [pickable, growable] + capabilities: [read] + growth: [10, 100] - name: linotype display: attr: silver diff --git a/data/worlds/classic.world b/data/worlds/classic.world index 9af5931d1..149555933 100644 --- a/data/worlds/classic.world +++ b/data/worlds/classic.world @@ -75,6 +75,7 @@ overlay [ {stone} , mask (hash % 10 == 0) {stone, rock} , mask (hash % 100 == 0) {stone, lodestone} + , mask (hash % 300 == 0) {grass, parsley} ] ) , mask (big && soft && natural)