Sign in
creature

Villagers

by Potluck · version 1 · Checked for all ages

Rowan the carpenter and Ivy the mason live on the Green, and villages grow up far from it as you explore, built to suit the land: a street, a well and a house for each villager. Thirteen jobs trade with you: sell them what you've gathered for beads and spend beads on what they make, and the better they know you the more they show you. A peddler and his pack yak come by now and then.

1--!strict
2-- How each job looks: one body for each kind of villager, the peddler and
3-- his pack yak. Parts' names pick their skins (a "face" is bare skin, a
4-- "coat" or "hat" is cloth, a "fleece" is shaggy), and `leg = true` parts
5-- swing as they walk.
6
7-- A villager's look: their colors, and what's on their head and back.
8export type Look = {
9 skin: string,
10 hair: string,
11 shirt: string,
12 trousers: string,
13 boots: string,
14 apron: string?,
15 hat: string?, -- "cap", "tall", "wide", "hood", "scarf", "feather" or nil
16 hat_color: string?,
17 beard: string?,
18 bag: string?, -- a pack on the back, in this color
19 quiver: boolean?,
20 candle: boolean?,
21 satchel: string?,
22}
23
24local function part(name: string, size: { number }, at: { number }, color: string, flags: { [string]: boolean }?): { [any]: any }
25 local p: { [any]: any } = { name, size = size, at = at, color = color }
26 for k, v in flags or {} do
27 p[k] = v
28 end
29 return p
30end
31
32local LEG = { leg = true }
33local HEAD = { head = true }
34
35local function person(o: Look): { any }
36 local b: { any } = {
37 part("leg_left_cloth", { 0.2, 0.56, 0.22 }, { -0.12, 0.38, 0 }, o.trousers, LEG),
38 part("leg_right_cloth", { 0.2, 0.56, 0.22 }, { 0.12, 0.38, 0 }, o.trousers, LEG),
39 part("boot_left", { 0.22, 0.12, 0.27 }, { -0.12, 0.06, -0.02 }, o.boots, LEG),
40 part("boot_right", { 0.22, 0.12, 0.27 }, { 0.12, 0.06, -0.02 }, o.boots, LEG),
41 part("coat", { 0.5, 0.66, 0.3 }, { 0, 0.95, 0 }, o.shirt),
42 part("arm_left_coat", { 0.14, 0.5, 0.16 }, { -0.33, 1.02, 0 }, o.shirt, LEG),
43 part("arm_right_coat", { 0.14, 0.5, 0.16 }, { 0.33, 1.02, 0 }, o.shirt, LEG),
44 part("hand_left", { 0.13, 0.1, 0.14 }, { -0.33, 0.72, 0 }, o.skin, LEG),
45 part("hand_right", { 0.13, 0.1, 0.14 }, { 0.33, 0.72, 0 }, o.skin, LEG),
46 part("face", { 0.42, 0.42, 0.4 }, { 0, 1.5, 0 }, o.skin, HEAD),
47 part("eye_left", { 0.06, 0.06, 0.02 }, { -0.09, 1.53, -0.21 }, "#2b2b33", HEAD),
48 part("eye_right", { 0.06, 0.06, 0.02 }, { 0.09, 1.53, -0.21 }, "#2b2b33", HEAD),
49 }
50 local function add(p: { [any]: any })
51 table.insert(b, p)
52 end
53 if o.apron then
54 add(part("apron_cloth", { 0.42, 0.56, 0.04 }, { 0, 0.9, -0.17 }, o.apron))
55 end
56 local hat, hc = o.hat, o.hat_color or o.hair
57 if hat ~= "hood" and hat ~= "scarf" then
58 add(part("hair", { 0.46, 0.14, 0.44 }, { 0, 1.75, 0.02 }, o.hair, HEAD))
59 add(part("hair_back", { 0.46, 0.3, 0.06 }, { 0, 1.6, 0.21 }, o.hair, HEAD))
60 if hat == nil then
61 add(part("hair_fringe", { 0.46, 0.08, 0.06 }, { 0, 1.66, -0.2 }, o.hair, HEAD))
62 end
63 end
64 if hat == "cap" or hat == "feather" then
65 add(part("hat", { 0.48, 0.1, 0.46 }, { 0, 1.78, 0 }, hc, HEAD))
66 add(part("hat_brim", { 0.46, 0.04, 0.14 }, { 0, 1.74, -0.27 }, hc, HEAD))
67 if hat == "feather" then
68 add(part("feather_hat", { 0.03, 0.24, 0.1 }, { 0.2, 1.92, 0.06 }, "#c0392b", HEAD))
69 end
70 elseif hat == "tall" then
71 add(part("hat_band", { 0.46, 0.08, 0.44 }, { 0, 1.76, 0 }, hc, HEAD))
72 add(part("hat", { 0.4, 0.3, 0.38 }, { 0, 1.94, 0 }, hc, HEAD))
73 elseif hat == "wide" then
74 add(part("hat_brim", { 0.8, 0.04, 0.8 }, { 0, 1.75, 0 }, hc, HEAD))
75 add(part("hat", { 0.44, 0.16, 0.42 }, { 0, 1.85, 0 }, hc, HEAD))
76 elseif hat == "hood" then
77 add(part("hood_cloth", { 0.5, 0.5, 0.42 }, { 0, 1.56, 0.05 }, hc, HEAD))
78 add(part("hood_top_cloth", { 0.46, 0.08, 0.36 }, { 0, 1.83, 0.04 }, hc, HEAD))
79 elseif hat == "scarf" then
80 add(part("scarf_head", { 0.46, 0.16, 0.44 }, { 0, 1.76, 0.02 }, hc, HEAD))
81 add(part("scarf_back", { 0.46, 0.3, 0.06 }, { 0, 1.6, 0.21 }, hc, HEAD))
82 add(part("scarf_neck", { 0.46, 0.08, 0.34 }, { 0, 1.27, 0 }, hc))
83 end
84 if o.beard then
85 add(part("beard", { 0.36, 0.2, 0.08 }, { 0, 1.36, -0.21 }, o.beard, HEAD))
86 end
87 if o.bag then
88 add(part("bag_pack", { 0.36, 0.44, 0.18 }, { 0, 1.0, 0.24 }, o.bag))
89 add(part("strap_left", { 0.05, 0.5, 0.32 }, { -0.16, 1.02, 0.02 }, "#3b2a1c"))
90 add(part("strap_right", { 0.05, 0.5, 0.32 }, { 0.16, 1.02, 0.02 }, "#3b2a1c"))
91 end
92 if o.quiver then
93 add(part("bag_quiver", { 0.12, 0.5, 0.12 }, { 0.14, 1.12, 0.22 }, "#6b4226"))
94 add(part("feather_tips", { 0.1, 0.1, 0.1 }, { 0.14, 1.42, 0.22 }, "#e9e2cf"))
95 end
96 if o.candle then
97 add(part("candle_glow", { 0.06, 0.12, 0.06 }, { 0.14, 1.92, 0 }, "#ffd27a", { head = true, glow = true }))
98 end
99 if o.satchel then
100 add(part("bag_satchel", { 0.16, 0.2, 0.08 }, { 0.3, 0.76, -0.12 }, o.satchel))
101 end
102 return b
103end
104
105-- Each job's look, by the name of its kind.
106local LOOKS: { [string]: Look } = {
107 Carpenter = { skin = "#e3b48f", hair = "#6b4226", shirt = "#e9e2cf", trousers = "#4a4a5a", boots = "#4a3424", apron = "#8a5a2b" },
108 Mason = { skin = "#c99673", hair = "#2f2f3a", shirt = "#d9d4c4", trousers = "#4a4a5a", boots = "#3b3340", apron = "#5b6f8a", hat = "cap", hat_color = "#7d8794" },
109 Baker = { skin = "#f0c9a6", hair = "#a0522d", shirt = "#f4efe2", trousers = "#5a4a3a", boots = "#4a3424", apron = "#fbf8f0", hat = "tall", hat_color = "#fbf8f0" },
110 Angler = { skin = "#b07a55", hair = "#3a2a20", shirt = "#e8c23a", trousers = "#2f4858", boots = "#2b2b33", hat = "wide", hat_color = "#e8c23a", beard = "#3a2a20" },
111 Weaver = { skin = "#8d5a3b", hair = "#1f1a1a", shirt = "#8e6aa8", trousers = "#4a3a5a", boots = "#3b2a2a", hat = "scarf", hat_color = "#c0517a" },
112 Smith = { skin = "#d9a77f", hair = "#2b2420", shirt = "#6b6560", trousers = "#3b3530", boots = "#2b2420", apron = "#3b2a1c", beard = "#4a3424" },
113 Grower = { skin = "#e0ac82", hair = "#c8a165", shirt = "#c8d9a0", trousers = "#4f6b3a", boots = "#4a3424", hat = "wide", hat_color = "#d9b65a" },
114 Chandler = { skin = "#f2d0b5", hair = "#e8e0d0", shirt = "#8a2f2f", trousers = "#3b2a2a", boots = "#2b2020", hat = "cap", hat_color = "#5a1f1f", candle = true },
115 Tanner = { skin = "#9c6a48", hair = "#4a3424", shirt = "#a0703c", trousers = "#5a4030", boots = "#3b2a1c", hat = "cap", hat_color = "#7a5a3a", apron = "#6b4a2c" },
116 Herbalist = { skin = "#c58c62", hair = "#5a3a20", shirt = "#5d7a4a", trousers = "#3b4a30", boots = "#3b3020", hat = "hood", hat_color = "#4a6b3a", satchel = "#8a6a3a" },
117 Wayfinder = { skin = "#e6b796", hair = "#8a6a4a", shirt = "#3d5a8a", trousers = "#5a5040", boots = "#4a3424", hat = "feather", hat_color = "#2f3f5a", bag = "#7a5a3a" },
118 Beekeeper = { skin = "#d9a07a", hair = "#d9c27a", shirt = "#f2ecd8", trousers = "#e0d8c0", boots = "#5a5040", hat = "wide", hat_color = "#f2ecd8" },
119 Bowyer = { skin = "#7a4e32", hair = "#1a1414", shirt = "#3f6b3f", trousers = "#4a3a2a", boots = "#3b2a1c", hat = "cap", hat_color = "#2f4f2f", quiver = true },
120}
121
122-- The peddler: a long patched coat, a tall hat and a great pack.
123local function peddler(): { any }
124 local b = person({ skin = "#d4a07a", hair = "#9a9088", shirt = "#7a4a6a", trousers = "#4a3a4a", boots = "#3b2a2a", hat = "tall", hat_color = "#3b2f4a", beard = "#b8b0a8" })
125 table.insert(b, part("coat_tail", { 0.52, 0.34, 0.32 }, { 0, 0.5, 0 }, "#7a4a6a"))
126 table.insert(b, part("coat_patch", { 0.14, 0.14, 0.02 }, { -0.12, 0.98, -0.16 }, "#c8a040"))
127 table.insert(b, part("scarf_neck", { 0.46, 0.08, 0.34 }, { 0, 1.27, 0 }, "#2f8a7a"))
128 table.insert(b, part("bag_pack", { 0.5, 0.6, 0.3 }, { 0, 1.1, 0.3 }, "#8a6a3a"))
129 table.insert(b, part("bag_roll", { 0.56, 0.14, 0.14 }, { 0, 1.46, 0.3 }, "#5a7a3a"))
130 table.insert(b, part("bag_pot", { 0.16, 0.14, 0.16 }, { 0.3, 0.92, 0.3 }, "#8a8a90"))
131 return b
132end
133
134-- The pack yak: shaggy, horned and laden with bags.
135local function yak(): { any }
136 local fur, dark = "#6b4a32", "#3b2a1c"
137 local b: { any } = {
138 part("leg_fl", { 0.2, 0.5, 0.2 }, { -0.3, 0.25, -0.5 }, dark, LEG),
139 part("leg_fr", { 0.2, 0.5, 0.2 }, { 0.3, 0.25, -0.5 }, dark, LEG),
140 part("leg_bl", { 0.2, 0.5, 0.2 }, { -0.3, 0.25, 0.5 }, dark, LEG),
141 part("leg_br", { 0.2, 0.5, 0.2 }, { 0.3, 0.25, 0.5 }, dark, LEG),
142 part("body_fleece", { 0.86, 0.72, 1.5 }, { 0, 0.92, 0 }, fur),
143 part("fringe_fleece", { 0.9, 0.24, 1.4 }, { 0, 0.5, 0 }, fur),
144 part("head_fleece", { 0.46, 0.46, 0.46 }, { 0, 1.12, -0.92 }, fur, HEAD),
145 part("snout", { 0.3, 0.2, 0.12 }, { 0, 1.02, -1.18 }, "#4a3a30", HEAD),
146 part("horn_left", { 0.28, 0.1, 0.1 }, { -0.34, 1.36, -0.9 }, "#e8dcc0", HEAD),
147 part("horn_right", { 0.28, 0.1, 0.1 }, { 0.34, 1.36, -0.9 }, "#e8dcc0", HEAD),
148 part("eye_left", { 0.06, 0.06, 0.02 }, { -0.13, 1.18, -1.16 }, "#1a1410", HEAD),
149 part("eye_right", { 0.06, 0.06, 0.02 }, { 0.13, 1.18, -1.16 }, "#1a1410", HEAD),
150 part("bag_left", { 0.16, 0.44, 0.6 }, { -0.52, 0.98, 0.05 }, "#a0703c"),
151 part("bag_right", { 0.16, 0.44, 0.6 }, { 0.52, 0.98, 0.05 }, "#5a7a3a"),
152 part("saddle", { 0.9, 0.08, 0.5 }, { 0, 1.3, 0.05 }, "#8a2f2f"),
153 part("tail_fleece", { 0.14, 0.4, 0.14 }, { 0, 0.85, 0.8 }, fur),
154 }
155 return b
156end
157
158return {
159 LOOKS = LOOKS,
160 person = person,
161 peddler = peddler,
162 yak = yak,
163}