From 7b4ffccb9d39a6acb09a3cc950ec664740302414 Mon Sep 17 00:00:00 2001 From: Brent Yorgey Date: Mon, 6 Jun 2022 07:17:46 -0500 Subject: [PATCH] add sand, glass, and calculator (#362) - Sand is now found near water. Sand regenerates immediately (like water). - Sand can be used in a furnace to make glass. - Glass + copper wires + 3D printer can be used to make solar panels. - Note that with #361 I intend to start the base with a small number of 3D printers, so other robots could carry this out. But also, the base will start with a bunch of solar panels too. - Solar panel + counter can be used to make a calculator. --- data/entities.yaml | 31 ++++++++++++++++++++++++++++++- data/recipes.yaml | 21 +++++++++++++++++++++ src/Swarm/Game/WorldGen.hs | 1 + src/Swarm/Language/Capability.hs | 12 ++++++------ 4 files changed, 58 insertions(+), 7 deletions(-) diff --git a/data/entities.yaml b/data/entities.yaml index 278ebc32e..091857b4f 100644 --- a/data/entities.yaml +++ b/data/entities.yaml @@ -216,6 +216,24 @@ properties: [portable] capabilities: [float] +- name: sand + display: + attr: sand + char: '█' + description: + - A substance composed mostly of tiny rocks and mineral particles. It + tends to be found near water, and can be used in a furnace to make glass. + properties: [portable, growable] + growth: [0,0] + +- name: glass + display: + attr: entity + char: '□' + description: + - A pane of a brittle, clear substance, made from melting sand in a furnace. + properties: [portable] + - name: bit (0) display: attr: entity @@ -378,7 +396,7 @@ - name: plasma cutter display: attr: device - char: '+' + char: 'P' description: - "A plasma cutter uses a jet of hot plasma to cut through metal like butter. Used via the 'salvage' command to cut apart old robots." @@ -546,3 +564,14 @@ uses the 'log' command)." properties: [portable] capabilities: [log] + +- name: calculator + display: + attr: device + char: '+' + description: + - "A calculator allows a robot to do basic arithmetic calculations: + addition, subtraction, multiplication, division, and + exponentiation." + properties: [portable] + capabilities: [arith] diff --git a/data/recipes.yaml b/data/recipes.yaml index 09a52c813..38a419520 100644 --- a/data/recipes.yaml +++ b/data/recipes.yaml @@ -108,6 +108,27 @@ required: - [1, furnace] +- in: + - [1, sand] + out: + - [1, glass] + required: + - [1, furnace] + +- in: + - [1, glass] + - [8, copper wire] + out: + - [1, solar panel] + required: + - [1, 3D printer] + +- in: + - [1, counter] + - [1, solar panel] + out: + - [1, calculator] + - in: - [32, gear] - [6, copper wire] diff --git a/src/Swarm/Game/WorldGen.hs b/src/Swarm/Game/WorldGen.hs index 114ffdbc4..6dd5e4088 100644 --- a/src/Swarm/Game/WorldGen.hs +++ b/src/Swarm/Game/WorldGen.hs @@ -66,6 +66,7 @@ testWorld2 baseSeed (Coords ix@(r, c)) = | h `mod` 10 == 0 = (StoneT, Just "rock") | otherwise = (StoneT, Nothing) genBiome Big Soft Natural + | abs (sample ix pn1) < 0.1 = (DirtT, Just "sand") | even (r + c) = (DirtT, Just "wavy water") | otherwise = (DirtT, Just "water") genBiome Small Soft Natural diff --git a/src/Swarm/Language/Capability.hs b/src/Swarm/Language/Capability.hs index 3851b915f..2333a58a9 100644 --- a/src/Swarm/Language/Capability.hs +++ b/src/Swarm/Language/Capability.hs @@ -266,6 +266,12 @@ constCaps = Salvage -> [CSalvage] Reprogram -> [CReprogram] Drill -> [CDrill] + Neg -> [CArith] + Add -> [CArith] + Sub -> [CArith] + Mul -> [CArith] + Div -> [CArith] + Exp -> [CArith] -- Some God-like sensing abilities. As -> [CGod] RobotNamed -> [CGod] @@ -278,7 +284,6 @@ constCaps = Appear -> [CAppear] -- paint? Whereami -> [CSenseloc] -- GPS? Random -> [CRandom] -- randomness device (with bitcoins)? - Neg -> [CArith] -- ALU? pocket calculator? Whoami -> [CWhoami] -- mirror, needs a recipe -- comparator? @@ -290,11 +295,6 @@ constCaps = Geq -> [CCompare] And -> [] Or -> [] - Add -> [CArith] - Sub -> [CArith] - Mul -> [CArith] - Div -> [CArith] - Exp -> [CArith] -- Some more constants which *ought* to have their own capability but -- currently don't. Say -> []