Slime Arena 史莱姆竞技场
README.md
Slime
One slime: its faceted lime body, its hop, its chase, its touch and its death.
Attach to a synced root entity together with Vitals
({ maxHp = Rules.SLIME_MAX_HP, hp = Rules.SLIME_MAX_HP }, player = false).
game/slimes/spawner.luau does that for every slime the arena has; nothing
needs to place one by hand.
What it does
- Builds the body under the root on every peer — dome, skirt, deeper core,
dot eyes and smile — from
game/slimes/body.luauand the meshes ingame/slimes/domeMesh.luau. Only the root replicates, so the look is free. - On the peer that owns the root: hops (
SLIME_HOP_PERIOD,SLIME_HOP_HEIGHT) with a squash-and-stretch cycle, seeks the nearest living player withinSLIME_CHASE_RANGEatSLIME_SPEED, and touches forSLIME_DAMAGEno more often thanSLIME_TOUCH_COOLDOWN, throughgame.combat.vitals. - On every peer: flashes white when hurt, and on death plays the splat and the
slime_diecue. The owner despawns the root.
Health, damage, death, the 10 XP a kill pays and everything about leveling are
game.combat.vitals' business. This component only listens.
Fields
| Field | Meaning |
|---|---|
zone | which of Rules.SLIME_ZONES (1-based) it was born at — the spawner's bookkeeping |
squash | the vertical squash the owner is playing, so other peers draw the same hop |
Notes
Slimes.all()/onSpawn/onDespawn(game/slimes/registry.luau) is how other slices find slimes; this registers onawakeand unregisters ononDestroyand on death.- Its
awakecallsrequire("game.slimes.spawner").ensure(), so a slime that exists at all keeps the zones filling.