space-browser / commits / 171db70
feat: ship stats and ore economy
@@ -30,7 +30,6 @@ const ore = new Map<number, Ore>();
3030 const cam: Camera & { follow: boolean } = { x: 0, y: 0, zoom: 0.5, follow: true };
3131 const keys = new Set<string>();
3232 let pan0: { x: number; y: number } | null = null; // right/middle drag moves the camera
33-let down0: { x: number; y: number } | null = null; // where the right button went down
3433 let pulling = false; // left button down: keep reporting where the piece is
3534 let pullTo: { x: number; y: number } | null = null;
3635 let pullIn = 0;
@@ -52,7 +51,7 @@ const at = (e: MouseEvent) => {
5251
5352 addEventListener('pointerdown', (e) => {
5453 if (e.button !== 0) {
55- pan0 = down0 = { x: e.clientX, y: e.clientY };
54+ pan0 = { x: e.clientX, y: e.clientY };
5655 return;
5756 }
5857 const p = at(e);
@@ -71,17 +70,10 @@ addEventListener('pointermove', (e) => {
7170 });
7271
7372 addEventListener('pointerup', (e) => {
74- // A right click that did not pan is a tow order: the server hooks or releases
75- // the ore under the cursor.
76- if (e.button === 2) {
77- if (down0 && Math.hypot(e.clientX - down0.x, e.clientY - down0.y) < 4) {
78- const p = at(e);
79- net.send({ t: 'tow', x: p.x, y: p.y });
80- }
81- pan0 = down0 = null;
73+ if (e.button !== 0) {
74+ pan0 = null;
8275 return;
8376 }
84- pan0 = null;
8577 if (!pulling) return;
8678 pulling = false;
8779 pullTo = null;
@@ -1,10 +1,28 @@
11 // The server owns ships, hulls and loose pieces; this is the shape it reports,
22 // plus the local-to-world transform every client needs to draw a hull.
3-export type Kind = 'gun' | 'armor' | 'cargo' | 'engine';
3+export type Kind = 'triangle' | 'square' | 'circle' | 'star';
44
55 // Piece position is local to the ship: the graph is rigid, so only the hull moves.
6-export type Piece = { id: number; kind: Kind; lx: number; ly: number; parent: number };
7-export type Loose = { id: number; kind: Kind; x: number; y: number; h: number };
6+export type Piece = {
7+ id: number;
8+ kind: Kind;
9+ lx: number;
10+ ly: number;
11+ parent: number;
12+ hp: number;
13+ maxhp: number;
14+ tier: number;
15+};
16+export type Loose = {
17+ id: number;
18+ kind: Kind;
19+ x: number;
20+ y: number;
21+ h: number;
22+ hp: number;
23+ maxhp: number;
24+ tier: number;
25+};
826 export type Ore = { id: number; x: number; y: number; h: number; towed: number };
927 export type Body = { id: number; kind: 'star' | 'shipyard' | 'barren'; r: number; x: number; y: number };
1028
@@ -16,6 +34,7 @@ export type Ship = {
1634 h: number;
1735 tx: number; // where it is flying to, so the marker can show the order
1836 ty: number;
37+ fuel: number; // capacity, summed from the hull
1938 pieces: Piece[];
2039 };
2140
@@ -16,9 +16,10 @@ export type Camera = { x: number; y: number; zoom: number };
1616 const GLYPHS = ' .:-=+*#%@';
1717 // 0-7 is the amber ramp used for everything that flies. 8-12 are reserved for
1818 // celestial bodies, so a rust planet and a steel planet never read as each other.
19+// 13-14 are damage: a hurt piece can never be mistaken for a healthy one.
1920 const PALETTE = [
2021 0x0c0803, 0x241806, 0x3d2709, 0x57370c, 0x754c11, 0x98631a, 0xc78a20, 0xffe9a8,
21- 0x4a1d0f, 0x9c4f28, 0x1f4453, 0x7fc0d4, 0xfff6dd,
22+ 0x4a1d0f, 0x9c4f28, 0x1f4453, 0x7fc0d4, 0xfff6dd, 0x7a1512, 0xff4a3d,
2223 ];
2324 const ATLAS_CELL = 32;
2425
@@ -89,12 +90,12 @@ function poly(n: number, r: number, inner = 0, tilt = 0): THREE.Shape {
8990 return s;
9091 }
9192
92-// Triangle gun, square armor, circle cargo, star engine.
93+// The four piece kinds are named after their shape.
9394 function pieceGeometry(kind: Kind, scale: number): THREE.BufferGeometry {
9495 const r = SHIP_R * scale;
95- if (kind === 'armor') return new THREE.ShapeGeometry(poly(4, r * 0.8, 0, Math.PI / 4));
96- if (kind === 'cargo') return new THREE.CircleGeometry(r * 0.75, 18);
97- if (kind === 'engine') return new THREE.ShapeGeometry(poly(10, r, r * 0.45, -Math.PI / 2));
96+ if (kind === 'square') return new THREE.ShapeGeometry(poly(4, r * 0.8, 0, Math.PI / 4));
97+ if (kind === 'circle') return new THREE.CircleGeometry(r * 0.75, 18);
98+ if (kind === 'star') return new THREE.ShapeGeometry(poly(10, r, r * 0.45, -Math.PI / 2));
9899 return new THREE.ShapeGeometry(poly(3, r));
99100 }
100101
@@ -106,7 +107,7 @@ function plate(w: number, h: number, v: number): THREE.Mesh {
106107 // survives the downsample to cell resolution. Three roles must never read as
107108 // each other: your hull is the brightest cream, another player's hull is gold,
108109 // and loose wreckage is dim sepia. A piece flips shade the moment it is bolted
109-// on or torn off.
110+// on or torn off, and turns red for everyone once it starts taking hits.
110111 const SHADE = {
111112 own: [lum(1, 7), lum(0.5, 7)],
112113 other: [lum(0.8, 6), lum(0.4, 6)],
@@ -115,18 +116,39 @@ const SHADE = {
115116 towed: [lum(1, 7), lum(0.55, 6)], // ore on someone's line, bright as a hull
116117 };
117118 export type Role = keyof typeof SHADE;
119+const HURT = [
120+ [lum(0.85, 13), lum(0.4, 13)], // hit: rust red
121+ [lum(1, 14), lum(0.5, 14)], // nearly gone: hot red
122+];
123+// Upgrade tiers wear a border: gold at one, cream at two. Nothing at zero.
124+const TIER = [lum(0, 0), lum(1, 6), lum(1, 12)];
125+
126+type Part = THREE.Mesh<THREE.BufferGeometry, THREE.MeshBasicMaterial>;
127+
118128 const shade = (g: THREE.Group, role: Role) => {
119- if (g.userData.role === role) return;
120- g.userData.role = role;
121129 const c = SHADE[role];
122- g.children.forEach((m, i) => (m as THREE.Mesh<THREE.BufferGeometry, THREE.MeshBasicMaterial>).material.color.copy(c[i]));
130+ g.children.forEach((m, i) => (m as Part).material.color.copy(c[i]));
123131 };
124132
133+// What a piece looks like is entirely its health and its tier.
134+type Wear = { hp: number; maxhp: number; tier: number };
135+function paint(g: THREE.Group, role: Role, w: Wear): void {
136+ const ratio = w.maxhp > 0 ? w.hp / w.maxhp : 1;
137+ const [hi, lo] = ratio > 0.66 ? SHADE[role] : ratio > 0.33 ? HURT[0] : HURT[1];
138+ const [edge, a, b] = g.children as Part[]; // built in this order
139+ a.material.color.copy(hi);
140+ b.material.color.copy(lo);
141+ edge.visible = w.tier > 0;
142+ if (w.tier > 0) edge.material.color.copy(TIER[w.tier]);
143+}
144+
145+// The tier border is a larger copy of the same shape drawn first, so the
146+// silhouette covers its middle and only a rim of it shows.
125147 function piece(kind: Kind): THREE.Group {
126148 const g = new THREE.Group();
127- g.add(new THREE.Mesh(pieceGeometry(kind, 1), new THREE.MeshBasicMaterial({ color: SHADE.loose[0] })));
128- g.add(new THREE.Mesh(pieceGeometry(kind, 0.7), new THREE.MeshBasicMaterial({ color: SHADE.loose[1] })));
129- shade(g, 'loose');
149+ for (const [scale, v] of [[1.3, 0], [1, 1], [0.7, 0.5]]) {
150+ g.add(new THREE.Mesh(pieceGeometry(kind, scale), new THREE.MeshBasicMaterial({ color: lum(v) })));
151+ }
130152 return g;
131153 }
132154
@@ -310,7 +332,16 @@ export class View {
310332
311333 // One mesh per piece, whether it is bolted to a hull or drifting loose: ids are
312334 // unique across the world, so a torn-off piece stays the same mesh.
313- private place(id: number, kind: Kind, role: Role, x: number, y: number, h: number, seen: Set<number>): void {
335+ private place(
336+ id: number,
337+ kind: Kind,
338+ role: Role,
339+ x: number,
340+ y: number,
341+ h: number,
342+ w: Wear,
343+ seen: Set<number>,
344+ ): void {
314345 seen.add(id);
315346 let g = this.pieceMeshes.get(id);
316347 if (!g) {
@@ -318,7 +349,7 @@ export class View {
318349 this.pieceMeshes.set(id, g);
319350 this.scene.add(g);
320351 }
321- shade(g, role);
352+ paint(g, role, w);
322353 g.position.set(x, y, 0);
323354 g.rotation.z = h;
324355 }
@@ -350,10 +381,10 @@ export class View {
350381 const role: Role = s.id === ownId ? 'own' : 'other';
351382 for (const p of s.pieces) {
352383 const w = toWorld(s, p);
353- this.place(p.id, p.kind, role, w.x, w.y, s.h, seen);
384+ this.place(p.id, p.kind, role, w.x, w.y, s.h, p, seen);
354385 }
355386 }
356- for (const l of loose) this.place(l.id, l.kind, 'loose', l.x, l.y, l.h, seen);
387+ for (const l of loose) this.place(l.id, l.kind, 'loose', l.x, l.y, l.h, l, seen);
357388 for (const [id, g] of this.pieceMeshes) {
358389 if (seen.has(id)) continue;
359390 this.scene.remove(g);
@@ -42,12 +42,18 @@ const (
4242 oreRingMin = 12.0 // first ring's distance beyond the surface
4343 oreBrake = 10.0 // outward deceleration, so a launch coasts out then parks
4444 oreOrbitV = 12.0 // world units per second travelled along a ring
45- oreGrab = 10.0 // click radius to take an ore piece on a tow line
46- towReach = 40.0 // how close the ship must be to throw a line on an ore
45+ oreTouch = 14.0 // flying this close to ore hooks it onto the line
4746 towGap = 12.0 // distance between ore on a tow line
4847 oreWaitMin = 30.0 // a barren planet throws an ore every 30-60s
4948 oreWaitMax = 60.0
5049 oreHolds = 3 // a barren planet holds 3-6 ore, a fixed count per planet
50+
51+ dockR = 8.0 // the ship counts as docked inside this of its ring point
52+ towBase = 3 // ore a hull can haul with no circle at all
53+ towPer = 3 // extra ore each circle adds to the line
54+ maxTier = 2 // a piece can be upgraded twice
55+ yardOre = 3 // ore a shipyard takes for one service
56+ yardGap = 1.0 // seconds between services, so a full line drains visibly
5157 )
5258
5359 // A hull is a graph of pieces placed relative to the ship. Piece ids are unique
@@ -59,15 +65,21 @@ type piece struct {
5965 LX float64 `json:"lx"`
6066 LY float64 `json:"ly"`
6167 Parent int `json:"parent"`
68+ HP float64 `json:"hp"`
69+ MaxHP float64 `json:"maxhp"`
70+ Tier int `json:"tier"`
6271 }
6372
6473 type loose struct {
65- ID int `json:"id"`
66- Kind string `json:"kind"`
67- X float64 `json:"x"`
68- Y float64 `json:"y"`
69- H float64 `json:"h"`
70- held int // player dragging it, 0 = free
74+ ID int `json:"id"`
75+ Kind string `json:"kind"`
76+ X float64 `json:"x"`
77+ Y float64 `json:"y"`
78+ H float64 `json:"h"`
79+ HP float64 `json:"hp"`
80+ MaxHP float64 `json:"maxhp"`
81+ Tier int `json:"tier"`
82+ held int // player dragging it, 0 = free
7183 }
7284
7385 // An ore piece is thrown out of a barren planet and parks in one of its rings.
@@ -111,6 +123,7 @@ type player struct {
111123 TX float64 `json:"tx"`
112124 TY float64 `json:"ty"`
113125 Pieces []piece `json:"pieces"`
126+ Fuel float64 `json:"fuel"` // capacity, summed from the hull every tick
114127
115128 vx, vy float64
116129 orbit int // body the ship is anchored to, 0 = none
@@ -118,6 +131,7 @@ type player struct {
118131 anchored float64 // world time of anchoring
119132 held int // loose piece being dragged, 0 = none
120133 tow []int // ore on the tow line, in order behind the ship
134+ yard float64 // seconds until a shipyard will take another load
121135 }
122136
123137 type client struct {
@@ -168,13 +182,9 @@ func newHub() *hub {
168182 {ID: 3, Kind: "barren", R: 28, orbit: 215, a0: 0.6, speed: 0.035, wait: oreWait(), cap: oreHolds + rand.Intn(4)},
169183 }
170184 // Wreckage around the spawn, to build a first hull out of.
171- for i, k := range []string{"armor", "cargo", "engine", "gun"} {
172- h.loose = append(h.loose, &loose{
173- ID: h.pieceID(),
174- Kind: k,
175- X: spawnX + []float64{30, 37, -29, -35}[i],
176- Y: spawnY + []float64{-20, 18, 26, -22}[i],
177- })
185+ for i, k := range []string{"square", "circle", "star", "triangle"} {
186+ h.loose = append(h.loose, h.debris(k, 0,
187+ spawnX+[]float64{30, 37, -29, -35}[i], spawnY+[]float64{-20, 18, 26, -22}[i]))
178188 }
179189 return h
180190 }
@@ -184,6 +194,34 @@ func (h *hub) pieceID() int {
184194 return h.nextPiece
185195 }
186196
197+// ---- stats ----
198+
199+// Every piece carries two numbers: hit points and fuel. A square is twice as
200+// tough as anything else and a star carries five times the fuel; each tier adds
201+// half again on top, so a fully upgraded piece is worth two base pieces of it.
202+func stats(kind string, tier int) (hp, fuel float64) {
203+ hp, fuel = 10, 1
204+ switch kind {
205+ case "square":
206+ hp = 20
207+ case "star":
208+ fuel = 5
209+ }
210+ m := 1 + 0.5*float64(tier)
211+ return hp * m, fuel * m
212+}
213+
214+// A new piece arrives intact: full hit points for its kind and tier.
215+func (h *hub) fitted(kind string, tier int) piece {
216+ hp, _ := stats(kind, tier)
217+ return piece{ID: h.pieceID(), Kind: kind, HP: hp, MaxHP: hp, Tier: tier}
218+}
219+
220+func (h *hub) debris(kind string, tier int, x, y float64) *loose {
221+ hp, _ := stats(kind, tier)
222+ return &loose{ID: h.pieceID(), Kind: kind, X: x, Y: y, HP: hp, MaxHP: hp, Tier: tier}
223+}
224+
187225 func (h *hub) handle(w http.ResponseWriter, r *http.Request) {
188226 ws, err := upgrader.Upgrade(w, r, nil)
189227 if err != nil {
@@ -193,7 +231,7 @@ func (h *hub) handle(w http.ResponseWriter, r *http.Request) {
193231 h.nextID++
194232 c := &client{ws: ws, p: &player{ID: h.nextID, X: spawnX, Y: spawnY, TX: spawnX, TY: spawnY}}
195233 c.p.Name = "P" + strconv.Itoa(c.p.ID)
196- c.p.Pieces = []piece{{ID: h.pieceID(), Kind: "gun"}} // every run starts from one gun
234+ c.p.Pieces = []piece{h.fitted("triangle", 0)} // every run starts from one triangle
197235 h.clients[c] = true
198236 h.mu.Unlock()
199237
@@ -224,8 +262,6 @@ func (h *hub) handle(w http.ResponseWriter, r *http.Request) {
224262 h.drag(c.p, *in.X, *in.Y)
225263 case "drop":
226264 h.drop(c.p, *in.X, *in.Y)
227- case "tow":
228- h.towLine(c.p, *in.X, *in.Y)
229265 }
230266 h.mu.Unlock()
231267 }
@@ -288,23 +324,19 @@ func (h *hub) drop(p *player, x, y float64) {
288324 h.attach(p, l)
289325 }
290326
291-// A right click toggles a tow line on the ore under the cursor: hook a loose one,
292-// or let go of one already behind the ship. The line holds one ore plus one per
293-// cargo piece, so an empty hull can always haul a single ore.
294-func (h *hub) towLine(p *player, x, y float64) {
295- o := h.oreAt(p, x, y)
296- if o == nil {
297- return
298- }
299- if o.Towed == p.ID {
300- p.release(o)
301- return
302- }
303- if o.Towed != 0 || len(p.tow) >= p.towLimit() {
304- return
327+// Flying over ore hooks it onto the line: no clicks and nothing to decide. The
328+// line only takes what the hull can haul, so a full ship flies past the rest.
329+func (h *hub) haul(p *player) {
330+ for _, o := range h.ore {
331+ if len(p.tow) >= p.towLimit() {
332+ return
333+ }
334+ if o.Towed != 0 || math.Hypot(p.X-o.X, p.Y-o.Y) > oreTouch {
335+ continue
336+ }
337+ o.Towed, o.planet = p.ID, 0 // off the ring and onto the line
338+ p.tow = append(p.tow, o.ID)
305339 }
306- o.Towed, o.planet = p.ID, 0 // off the ring and onto the line
307- p.tow = append(p.tow, o.ID)
308340 }
309341
310342 func (p *player) release(o *ore) {
@@ -318,15 +350,84 @@ func (p *player) release(o *ore) {
318350 }
319351
320352 func (p *player) towLimit() int {
321- n := 1
353+ n := towBase
322354 for _, q := range p.Pieces {
323- if q.Kind == "cargo" {
324- n++
355+ if q.Kind == "circle" {
356+ n += towPer
325357 }
326358 }
327359 return n
328360 }
329361
362+// Docked means the ship has actually settled on its ring point, not that it is
363+// still crossing the system toward it: a yard only serves a ship that stopped.
364+func (p *player) docked() bool {
365+ return math.Hypot(p.X-p.TX, p.Y-p.TY) < dockR
366+}
367+
368+// Fuel capacity is summed from the hull: every piece carries a little and the
369+// star carries most of it, so range is a decision about what you bolt on.
370+func (p *player) fuel() float64 {
371+ f := 0.0
372+ for _, q := range p.Pieces {
373+ _, u := stats(q.Kind, q.Tier)
374+ f += u
375+ }
376+ return f
377+}
378+
379+// A shipyard services one load of ore at a time: three ore patch the whole hull
380+// up, and once nothing is damaged the load buys a tier on a random piece that can
381+// still take one. A whole, fully upgraded ship has nothing to buy, so it keeps
382+// its ore and the yard does not fire.
383+func (h *hub) service(p *player) bool {
384+ hurt := false
385+ for i, q := range p.Pieces {
386+ if q.HP < q.MaxHP {
387+ hurt = true
388+ p.Pieces[i].HP = q.MaxHP
389+ }
390+ }
391+ if hurt {
392+ return true // repair first: a wreck is worth nothing upgraded
393+ }
394+ var open []int
395+ for i, q := range p.Pieces {
396+ if q.Tier < maxTier {
397+ open = append(open, i)
398+ }
399+ }
400+ if len(open) == 0 {
401+ return false
402+ }
403+ q := &p.Pieces[open[rand.Intn(len(open))]]
404+ q.Tier++
405+ q.MaxHP, _ = stats(q.Kind, q.Tier)
406+ q.HP = q.MaxHP // a yard upgrade comes out whole
407+ return true
408+}
409+
410+// Ore handed over leaves the world with the line: the yard keeps it.
411+func (h *hub) spend(p *player) {
412+ for i := 0; i < yardOre && len(p.tow) > 0; i++ {
413+ if o := h.oreByID(p.tow[0]); o != nil {
414+ p.release(o)
415+ h.removeOre(o.ID)
416+ }
417+ }
418+}
419+
420+// A ship in orbit of a shipyard keeps handing over loads as long as it has
421+// enough ore on the line, one load a second so the yard can be watched working.
422+func (h *hub) yard(p *player, dt float64) {
423+ p.yard = math.Max(0, p.yard-dt)
424+ if p.yard > 0 || len(p.tow) < yardOre || !h.service(p) {
425+ return
426+ }
427+ h.spend(p)
428+ p.yard = yardGap
429+}
430+
330431 // ---- world ----
331432
332433 // Parking on a body bolts the target to that body's frame: the ring point turns
@@ -348,7 +449,12 @@ func (h *hub) detach(p *player, id int) []*loose {
348449 if len(p.Pieces) < 2 || p.Pieces[0].ID == id {
349450 return nil
350451 }
351- gone := map[int]bool{id: true}
452+ return h.sever(p, map[int]bool{id: true})
453+}
454+
455+// Anything no longer connected to the root piece drifts off, carrying the damage
456+// it had taken with it.
457+func (h *hub) sever(p *player, gone map[int]bool) []*loose {
352458 for grew := true; grew; {
353459 grew = false
354460 for _, q := range p.Pieces {
@@ -365,12 +471,25 @@ func (h *hub) detach(p *player, id int) []*loose {
365471 continue
366472 }
367473 x, y := hullToWorld(p, q.LX, q.LY)
368- off = append(off, &loose{ID: q.ID, Kind: q.Kind, X: x, Y: y, H: p.H})
474+ off = append(off, &loose{ID: q.ID, Kind: q.Kind, X: x, Y: y, H: p.H, HP: q.HP, MaxHP: q.MaxHP, Tier: q.Tier})
369475 }
370476 p.Pieces = keep
371477 return off
372478 }
373479
480+// A piece at zero hit points is destroyed for good: the hull loses it, and
481+// whatever it was the only link to breaks off as wreckage.
482+func (h *hub) destroy(p *player, id int) {
483+ if len(p.Pieces) < 2 || p.Pieces[0].ID == id {
484+ return // the root piece is the run itself
485+ }
486+ for _, l := range h.sever(p, map[int]bool{id: true}) {
487+ if l.ID != id {
488+ h.loose = append(h.loose, l) // the dead piece is gone, not salvage
489+ }
490+ }
491+}
492+
374493 // Snap a dropped piece onto the free slot closest to where it was let go.
375494 func (h *hub) attach(p *player, l *loose) bool {
376495 lx, ly := hullToLocal(p, l.X, l.Y)
@@ -407,6 +526,7 @@ func (h *hub) attach(p *player, l *loose) bool {
407526 ID: l.ID, Kind: l.Kind, Parent: q.ID,
408527 LX: q.LX + math.Cos(a)*spacing,
409528 LY: q.LY + math.Sin(a)*spacing,
529+ HP: l.HP, MaxHP: l.MaxHP, Tier: l.Tier,
410530 })
411531 h.removeLoose(l.ID)
412532 return true
@@ -462,6 +582,11 @@ func (h *hub) step(dt float64) {
462582 p.TY = p.ox*sn + p.oy*cs
463583 }
464584 p.steer(dt)
585+ h.haul(p)
586+ p.Fuel = p.fuel()
587+ if b := h.body(p.orbit); b != nil && b.Kind == "shipyard" && p.docked() {
588+ h.yard(p, dt)
589+ }
465590 for i, id := range p.tow {
466591 if o := h.oreByID(id); o != nil {
467592 h.onLine(o, p, float64(i+1))
@@ -640,26 +765,6 @@ func (h *hub) oreByID(id int) *ore {
640765 return nil
641766 }
642767
643-// Ore another player already has on their line is not a click target: it is
644-// theirs until they let go. A line is thrown from the ship, so ore far out of
645-// reach cannot be hooked either.
646-func (h *hub) oreAt(p *player, x, y float64) *ore {
647- var got *ore
648- best := oreGrab
649- for _, o := range h.ore {
650- if o.Towed != 0 && o.Towed != p.ID {
651- continue
652- }
653- if math.Hypot(p.X-o.X, p.Y-o.Y) > towReach {
654- continue
655- }
656- if d := math.Hypot(o.X-x, o.Y-y); d < best {
657- best, got = d, o
658- }
659- }
660- return got
661-}
662-
663768 func (h *hub) removeLoose(id int) {
664769 for i, l := range h.loose {
665770 if l.ID == id {
@@ -669,6 +774,15 @@ func (h *hub) removeLoose(id int) {
669774 }
670775 }
671776
777+func (h *hub) removeOre(id int) {
778+ for i, o := range h.ore {
779+ if o.ID == id {
780+ h.ore = append(h.ore[:i], h.ore[i+1:]...)
781+ return
782+ }
783+ }
784+}
785+
672786 func hullPieceAt(p *player, x, y float64) int {
673787 id, best := 0, grabR
674788 for _, q := range p.Pieces {