39 lines
2 KiB
Python
39 lines
2 KiB
Python
"""Ingots and raw ore in the soft Dune style: pressed brass-age bars and rough nuggets with a small stamp."""
|
|
from dunelib import Cv, mix
|
|
from dunesoft import *
|
|
|
|
NAMES = {'iron_ingot', 'gold_ingot', 'copper_ingot', 'netherite_ingot', 'raw_iron', 'raw_gold', 'raw_copper'}
|
|
MATERIALS = { # hi, lo, stamp
|
|
'iron': ('#d9d6c4', '#7d7c70', '#41699f'),
|
|
'gold': ('#f0d58c', '#a47f38', '#8c4f2d'),
|
|
'copper': ('#e2a37c', '#8d5636', '#5c8c76'),
|
|
'netherite': ('#8b8087', '#3a3238', '#c9803a'),
|
|
}
|
|
|
|
|
|
def draw(name):
|
|
material = name.removeprefix('raw_').removesuffix('_ingot')
|
|
hi, lo, stamp = MATERIALS[material]
|
|
cv = Cv(64)
|
|
if name.startswith('raw_'):
|
|
for pts in ([(10, 27), (16, 14), (29, 11), (35, 23), (28, 40), (15, 43)],
|
|
[(27, 15), (39, 7), (53, 14), (57, 31), (47, 43), (32, 37)],
|
|
[(18, 39), (32, 30), (48, 37), (50, 50), (36, 58), (20, 53)]):
|
|
m = cv.poly(pts)
|
|
soft_body(cv, m, mix(hi, SP["sand"], .15), mix(lo, SP["dune2"], .25), ew=.9, light=.45, dark=.28)
|
|
for path in ([(17, 18), (24, 24), (20, 35)], [(39, 12), (42, 23), (52, 29)], [(25, 44), (35, 40), (43, 48)]):
|
|
cv.solid(cv.line(path, 1.0), SP["umber"], .38)
|
|
dust(cv, [(22, 20), (44, 18), (38, 48)], "#fff3d2", 1.0, .75)
|
|
else:
|
|
side = cv.poly([(6, 28), (41, 15), (58, 27), (58, 43), (23, 56), (6, 45)])
|
|
cv.fill(side, mix(lo, SP["umber"], .1), mix(lo, SP["umber"], .45))
|
|
cv.bevel(side, .25, .3, 1); cv.edge(side, SP["umber"], .9, .85)
|
|
top = cv.poly([(6, 27), (41, 13), (58, 25), (23, 40)])
|
|
cv.fill(top, mix(hi, "#ffffff", .2), hi)
|
|
cv.bevel(top, .5, .25, 1); cv.edge(top, SP["umber"], .8, .8)
|
|
for pts in ([(13, 29), (24, 25)], [(30, 38), (47, 28)]): # soft pressed grooves
|
|
cv.solid(cv.line(pts, .8), SP["umber"], .22)
|
|
st = gear(cv, 33, 28, 4.6, 8, .15, .32) # maker's stamp
|
|
cv.solid(st, stamp, .72)
|
|
cv.solid(cv.line([(12, 38), (30, 47)], 1.0), "#fff1cf", .22)
|
|
return finish(cv, seed=len(name))
|

Staff