refactor(world): read-only entity views world.Mobiles / world.Items (drop scalar count props) #158
Labels
No labels
alpha:wave-0
alpha:wave-1
alpha:wave-2
alpha:wave-3
area:assets
area:combat
area:ecology
area:infra
area:render
area:scripting
area:ui
area:world
enhancement
epic
migration
post-alpha
roadmap
tech-debt
type:bug
type:chore
type:design
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set
Reference
marco/IsoMmo#158
Loading…
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Unify how
Worldexposes its entity collections behind cohesive read-only query views, replacing the growing set of scalar count props (CreatureCount,PlayerCount,ItemCount,PlacedItemCount, …).Motivation
Today
Worldgrows a new scalar prop for each count we need (CreatureCount,PlacedItemCount, nowItemCount), and there is no ergonomic instance access for items (onlyFindMobilefor mobiles). Owner's proposal: exposeMore readable, fewer props to carry around, and it mirrors ModernUO (which exposes
World.Mobiles/World.Itemsas global collections). ModernUO reference: we follow the collection-on-World shape; we diverge by exposing a read-only view (ModernUO's are fairly open) so mutation stays behind the World facade.Design constraints (to settle in the review)
Find(predicate),Count, enumerate), NOT the mutating registry — callers must not be able toSpawn/Give/PickUparound the World facade. Mutation stays as World methods.Itemto a public entity (with intrinsic self-validating mutators, likeMobile) soworld.Items.Find(id)returns something useful — this is the piece that unlocksFindItem. Decide whether to do it here or split.world.Items.Find(id)returning the item instance aligns with the existingworld.FindMobile(id)+mobile.SetHits(...)pattern.Scope
world.Mobilesandworld.Items(query + count + enumerate).CreatureCount/PlacedItemCount/ItemCount/FindMobileto the views (keepFindMobileor re-express asworld.Mobiles.Find(id)).Itemto a public entity ifworld.Items.Find(id)is in scope.UpdateWorldCounts) to the new views.Notes
world.ItemCountas the minimal interim.critical-design-reviewpass (World-facade change) before implementation.Definition of Done
world.Mobilesandworld.Itemsare read-only query views (no mutator reachable through them); mutation remains only viaWorldmethods (verifiable: no publicSpawn/Give/etc. on the exposed type).CreatureCount/PlacedItemCount/ItemCount) with no remaining references.world.Mobiles.Find(...)-style queries.