diff options
| author | historia <[not public]> | 2026-06-20 03:20:01 -0400 |
|---|---|---|
| committer | historia <[not public]> | 2026-06-20 03:20:01 -0400 |
| commit | e4400c5f1e84c18d2126f2cb502ae10685977cbb (patch) | |
| tree | 0523e9d68f1cfdc6f81b862e3068fe12c1a85054 /internal/world/ground.go | |
| parent | 5ea082ab4e82409aebc889b496f43e52b003d4f7 (diff) | |
| download | thehouseoficarus-e4400c5f1e84c18d2126f2cb502ae10685977cbb.tar.gz | |
refactor: combined all station crafting
Diffstat (limited to 'internal/world/ground.go')
| -rw-r--r-- | internal/world/ground.go | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/internal/world/ground.go b/internal/world/ground.go index 6c3ecf3..879cc71 100644 --- a/internal/world/ground.go +++ b/internal/world/ground.go @@ -63,7 +63,7 @@ func (w *World) GroundItems(roomID int) map[string]int { return out } -func (w *World) AddReservedGroundItem(roomID int, itemID string, qty int, owner string) { +func (w *World) AddReservedItem(roomID int, itemID string, qty int, owner string) { w.mu.Lock() defer w.mu.Unlock() e := &groundEntry{ @@ -87,7 +87,7 @@ func (w *World) AddGroundItem(roomID int, itemID string, qty int) { w.groundItems[roomID] = append(w.groundItems[roomID], e) } -func (w *World) RemoveReservedGroundItem(roomID int, itemID string, qty int, owner string) (int, bool) { +func (w *World) RemoveReservedItem(roomID int, itemID string, qty int, owner string) (int, bool) { w.mu.Lock() defer w.mu.Unlock() removed := 0 @@ -151,14 +151,14 @@ func (w *World) RemoveGroundItem(roomID int, itemID string, qty int) int { return removed } -func (w *World) tickGroundItemsLocked() { +func (w *World) tickGroundItems() { for _, entries := range w.groundItems { for _, e := range entries { if e.respawnTimer > 0 { e.respawnTimer-- if e.respawnTimer <= 0 { e.quantity = e.respawnQty - w.mergeNearbyItemsLocked(entries, e) + w.mergeNearbyItems(entries, e) } } if e.despawnTimer > 0 { @@ -177,7 +177,7 @@ func (w *World) tickGroundItemsLocked() { } } -func (w *World) mergeNearbyItemsLocked(entries []*groundEntry, target *groundEntry) { +func (w *World) mergeNearbyItems(entries []*groundEntry, target *groundEntry) { for _, other := range entries { if other != target && other.quantity > 0 && strings.EqualFold(other.itemID, target.itemID) && (other.reserveTimer <= 0 || other.reservedFor == "") && |
