▣
module · drop-in viewer
units
Military unit voxel models + stat tables (visual only). No AI, no physics bodies — the game moves unit roots kinematically; jets and helis fly at `M.STATS[kind].alt`.
by·posted 3mo ago
What it does
godzilla.units
Military unit voxel models + stat tables (visual only). No AI, no physics
bodies — the game moves unit roots kinematically; jets and helis fly at
M.STATS[kind].alt.
API
local U = require("@root::godzilla.units")
local t = U.spawn("tank", { 100, 0, 50 })
-- t = { id = rootId, kind = "tank", parts = { body, turret } }
U.STATS.tank -- { hp = 80, speed = 6, range = 120, dps = 6, score = 200 }
U.despawnAll()
- Roots are named
unit_<kind>_<n>. Every model faces +z at spawn. parts.bodyis always present;parts.turret(tank, warship),parts.turret2(warship aft turret), andparts.rotor(heli) are separate VoxelShape entities parented to the root so the game can rotate them (turret yaw, rotor spin).despawnAll()removes tracked units and sweeps anyunit_<kind>_<n>roots left from before a module hot reload.
Kinds
| kind | size | blockSize | look | hp | speed | range | dps | score | alt |
|---|---|---|---|---|---|---|---|---|---|
| infantry | 2 m | 0.25 | olive rifleman, helmet | 10 | 3 | 40 | 1 | 25 | - |
| tank | 6 m | 0.5 | tracked hull + rotatable turret/barrel | 80 | 6 | 120 | 6 | 200 | - |
| jet | 12 m | 0.5 | gray swept-wing fighter | 60 | 45 | 200 | 10 | 350 | 60 |
| heli | 10 m | 0.5 | cabin + tail boom + spinnable rotor part | 70 | 15 | 140 | 8 | 300 | 35 |
| warship | 60 m | 1.5 (turrets 1.0) | navy destroyer, fore + aft turret parts | 600 | 4 | 400 | 20 | 2000 | - |
| mech | 18 m | 0.75 | gunmetal bipedal walker, emissive red eye | 500 | 5 | 150 | 18 | 1500 | - |
| spotter | 3 m | 0.25 | radar truck, tall antenna, emissive orange marker | 40 | 8 | 0 | 0 | 400 | - |
The mech eye and spotter marker are small always-on emissive Model cubes
(gz_unit_red_eye / gz_unit_orange_marker pbr materials, created on
demand at /zero/source/<name>.material).
Discussion
Scoped to this part · feeds back into the world's score.
Sign in to post.sign in
No comments yet. Be the first.