Skip to content

Commit

Permalink
Some new devices and recipes (#395)
Browse files Browse the repository at this point in the history
- Add quartz and quartz mines
- Add `clock`, `silicon`, and `circuit`
- Add `comparator` device
- Metal drills can now drill through boulders too
- Add pixels to the world, and recipes for `camera` and `scanner`

See discussion at #26 (comment) and #361 .
  • Loading branch information
byorgey authored Jun 15, 2022
1 parent 7a88bc1 commit 221e7ec
Show file tree
Hide file tree
Showing 4 changed files with 243 additions and 4 deletions.
110 changes: 109 additions & 1 deletion data/entities.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -161,6 +161,33 @@
- An iron vein that can be actively mined to produce iron ore.
properties: []

- name: quartz
display:
attr: quartz
char: 'Q'
description:
- Raw quartz crystals. Useful for creating devices like clocks, and
can be processed to extract silicon.
- It can only be mined by drilling in the mountains.
properties: [portable]

- name: quartz mine
display:
attr: quartz
char: 'Å'
description:
- An quartz vein that can be actively mined to produce quartz.
properties: []

- name: silicon
display:
attr: quartz
char: 'S'
description:
- Extracted by processing quartz at high temperatures, silicon can
be used to construct integrated circuits.
properties: [portable]

- name: furnace
display:
attr: fire
Expand All @@ -169,6 +196,15 @@
- A furnace can be used to turn metal ore into various useful products.
properties: [portable]

- name: big furnace
display:
attr: fire
char: '#'
description:
- A big furnace can get even hotter than a normal furnace, and can be used
to process quartz into silicon.
properties: [portable]

- name: small motor
display:
attr: entity
Expand Down Expand Up @@ -287,6 +323,50 @@
properties: [portable, growable]
growth: [1000, 1500]

- name: pixel (R)
display:
attr: red
char: '.'
description:
- A pixel.
properties: [portable, growable]
growth: [1000, 1500]

- name: pixel (G)
display:
attr: green
char: '.'
description:
- A pixel.
properties: [portable, growable]
growth: [1000, 1500]

- name: pixel (B)
display:
attr: blue
char: '.'
description:
- A pixel.
properties: [portable, growable]
growth: [1000, 1500]

- name: camera
display:
attr: device
char: '@'
description:
- A camera.
properties: [portable]

- name: circuit
display:
attr: plant
char: '#'
description:
- |
A circuit is needed for constructing "smart" devices.
properties: [portable]

- name: drill bit
display:
attr: entity
Expand All @@ -311,6 +391,15 @@
- A wooden gear.
properties: [portable]

- name: teeter-totter
display:
attr: wood
char: '/'
description:
- A rotating board apparently popular with young aliens. Perhaps it
could also be used as a primitive balance scale.
properties: [portable]

- name: iron gear
display:
attr: iron
Expand Down Expand Up @@ -638,4 +727,23 @@
- "Example:"
- "turn west; move; turn north"
properties: [portable]
capabilities: [orient]
capabilities: [orient]

- name: clock
display:
attr: device
char: '0'
description:
- A clock is a device for keeping track of time.
properties: [portable]

- name: comparator
display:
attr: device
char: '>'
description:
- "A comparator allows comparing two values to see whether the first
is less, equal, or greater than the second."
- "Valid comparison operators are <, <=, >, >=, ==, and !=."
properties: [portable]
capabilities: [compare]
124 changes: 121 additions & 3 deletions data/recipes.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,18 @@
out:
- [1, wooden gear]

- in:
- [1, board]
- [2, wooden gear]
out:
- [1, teeter-totter]

- in:
- [1, teeter-totter]
- [2, copper wire]
out:
- [1, comparator]

#########################################
## BITS ##
#########################################
Expand Down Expand Up @@ -82,6 +94,23 @@
time: 9
weight: 1

- in:
- [1, boulder]
out:
- [3, rock]
required:
- [1, metal drill]
time: 3
weight: 3

- in:
- [1, boulder]
out:
- [4, rock]
required:
- [1, metal drill]
time: 3
weight: 3

- in:
- [1, mountain]
Expand All @@ -91,7 +120,7 @@
required:
- [1, drill]
time: 90
weight: 8
weight: 16

- in:
- [1, mountain]
Expand All @@ -101,13 +130,19 @@
required:
- [1, metal drill]
time: 9
weight: 8
weight: 16

- in:
- [5, rock]
out:
- [1, furnace]

- in:
- [10, rock]
- [10, solar panel]
out:
- [1, big furnace]

#########################################
## METAL ##
#########################################
Expand All @@ -122,7 +157,7 @@
required:
- [1, drill]
time: 42
weight: 1
weight: 2

- in:
- [1, mountain]
Expand All @@ -132,6 +167,16 @@
required:
- [1, drill]
time: 64
weight: 2

- in:
- [1, mountain]
out:
- [1, quartz mine]
- [1, quartz]
required:
- [1, drill]
time: 64
weight: 1

- in:
Expand All @@ -154,6 +199,16 @@
time: 7
weight: 1

- in:
- [1, mountain]
out:
- [1, quartz mine]
- [1, quartz]
required:
- [1, metal drill]
time: 7
weight: 1

## MINES

- in:
Expand All @@ -174,6 +229,15 @@
- [1, drill]
time: 64

- in:
- [1, quartz mine]
out:
- [1, quartz]
- [1, quartz mine]
required:
- [1, drill]
time: 64

- in:
- [1, copper mine]
out:
Expand All @@ -192,6 +256,15 @@
- [1, metal drill]
time: 7

- in:
- [1, quartz mine]
out:
- [1, quartz]
- [1, quartz mine]
required:
- [1, metal drill]
time: 7

## SMELTING

- in:
Expand Down Expand Up @@ -265,6 +338,51 @@
out:
- [1, strange loop]

#########################################
## QUARTZ + SILICON ##
#########################################

- in:
- [4, quartz]
out:
- [1, silicon]
required:
- [1, big furnace]

- in:
- [1, quartz]
- [32, iron gear]
- [1, glass]
out:
- [1, clock]

- in:
- [4, silicon]
- [1, strange loop]
- [16, copper wire]
- [8, bit (0)]
- [8, bit (1)]
out:
- [1, circuit]

#########################################
## PIXELS ##
#########################################

- in:
- [1, glass]
- [10, pixel (R)]
- [10, pixel (G)]
- [10, pixel (B)]
out:
- [1, camera]

- in:
- [1, camera]
- [1, circuit]
out:
- [1, scanner]

#########################################
## SAND ##
#########################################
Expand Down
1 change: 1 addition & 0 deletions src/Swarm/Game/WorldGen.hs
Original file line number Diff line number Diff line change
Expand Up @@ -79,6 +79,7 @@ testWorld2 baseSeed (Coords ix@(r, c)) =
| otherwise = (DirtT, Nothing)
genBiome Small Hard Artificial
| h `mod` 120 == 1 = (StoneT, Just "lambda")
| h `mod` 50 == 0 = (StoneT, Just (T.concat ["pixel (", from ["RGB" !! fromIntegral ((r + c) `mod` 3)], ")"]))
| otherwise = (StoneT, Nothing)
genBiome Big Hard Artificial
| sample ix cl0 > 0.85 = (StoneT, Just "copper ore")
Expand Down
12 changes: 12 additions & 0 deletions src/Swarm/TUI/Attr.hs
Original file line number Diff line number Diff line change
Expand Up @@ -40,9 +40,13 @@ swarmAttrMap =
, (copperAttr', fg (V.rgbColor @Int 78 117 102))
, (ironAttr, fg (V.rgbColor @Int 97 102 106))
, (ironAttr', fg (V.rgbColor @Int 183 65 14))
, (quartzAttr, fg V.white)
, (snowAttr, fg V.white)
, (sandAttr, fg (V.rgbColor @Int 194 178 128))
, (fireAttr, fg V.red `V.withStyle` V.bold)
, (redAttr, fg V.red)
, (greenAttr, fg V.green)
, (blueAttr, fg V.blue)
, (deviceAttr, fg V.yellow `V.withStyle` V.bold)
, -- Terrain attributes
(dirtAttr, fg (V.rgbColor @Int 165 42 42))
Expand Down Expand Up @@ -70,11 +74,15 @@ robotAttr
, copperAttr'
, ironAttr
, ironAttr'
, quartzAttr
, snowAttr
, sandAttr
, rockAttr
, baseAttr
, fireAttr
, redAttr
, greenAttr
, blueAttr
, woodAttr
, deviceAttr
, dirtAttr
Expand All @@ -100,9 +108,13 @@ copperAttr = "copper"
copperAttr' = "copper'"
ironAttr = "iron"
ironAttr' = "iron'"
quartzAttr = "quartz"
snowAttr = "snow"
sandAttr = "sand"
fireAttr = "fire"
redAttr = "red"
greenAttr = "green"
blueAttr = "blue"
rockAttr = "rock"
woodAttr = "wood"
baseAttr = "base"
Expand Down

0 comments on commit 221e7ec

Please sign in to comment.