# devatiywork/mass-and-momentum architecture

> Architecture diagram of the GitHub repository devatiywork/mass-and-momentum, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-10-04). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/devatiywork/mass-and-momentum
- Repository: https://github.com/devatiywork/mass-and-momentum

## Overview

Mass & Momentum is a Project Zomboid Build 42 Java mod suite: Vehicle Physics adjusts vehicle mass and interactions, while the optional Multiplayer Ragdolls mod enables ragdolls in multiplayer. The main workflow is to load the mods through ZombieBuddy, apply gated game-method patches, and use settings and vehicle rules to affect driving, impacts, vegetation, fuel, and multiplayer corpse placement. The graph retains the documented feature areas and substantial indexed modules. Source excerpts are partial, so some feature relationships are documented at the README level rather than traced through every hook.

Main entry points: [`mods/LabVehiclePhysics/src/pz/labvehicle/Patch_vehicleFloor.java`](https://github.com/devatiywork/mass-and-momentum/blob/main/mods/LabVehiclePhysics/src/pz/labvehicle/Patch_vehicleFloor.java) (Vehicle physics patch), [`mods/LabVehiclePhysics/src/pz/labvehicle/Main.java`](https://github.com/devatiywork/mass-and-momentum/blob/main/mods/LabVehiclePhysics/src/pz/labvehicle/Main.java) (Vehicle Physics mod), [`mods/LabVehiclePhysics/src/pz/labvehicle/VehicleCfg.java`](https://github.com/devatiywork/mass-and-momentum/blob/main/mods/LabVehiclePhysics/src/pz/labvehicle/VehicleCfg.java) (Vehicle rules), [`mods/LabVehiclePhysics/src/pz/labvehicle/LabSettings.java`](https://github.com/devatiywork/mass-and-momentum/blob/main/mods/LabVehiclePhysics/src/pz/labvehicle/LabSettings.java) (Sandbox settings)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_runtime["Runtime and safety"]
  node_vehicle_mod["Vehicle Physics mod<br/>[Main.java]"]
  node_safety["Safety gate<br/>[LabGate.java]"]
  node_native["Suspension limit patch<br/>[NativePatch.java]"]
end

subgraph group_config["Settings and vehicle rules"]
  node_settings["Sandbox settings<br/>[LabSettings.java]"]
  node_vehicle_cfg["Vehicle rules<br/>[VehicleCfg.java]"]
  node_vehicle_table["Vehicle settings table<br/>[VehicleTable.java]"]
  node_lua_registry["Lua vehicle registry<br/>[LuaRegistry.java]"]
  node_server_table["Server rule table<br/>[ServerTable.java]"]
end

subgraph group_physics["Vehicle interactions"]
  node_engine_power["Engine power patch"]
  node_vehicle_floor["Vehicle physics patch"]
  node_animal_impact["Animal impacts<br/>[AnimalImpact.java]"]
  node_animal_throw["Animal throws<br/>[AnimalThrow.java]"]
  node_veg["Vegetation drag"]
  node_trees["Tree breaking<br/>[TreeBreak.java]"]
  node_footprint["Track footprint"]
  node_horde["Horde impact report<br/>[HordeReport.java]"]
  node_service["Vehicle service"]
end

subgraph group_multiplayer["Multiplayer"]
  node_corpse_sync["Corpse landing sync<br/>[CorpseSync.java]"]
  node_remote_ragdoll["Remote ragdoll update<br/>[RemoteRagdoll.java]"]
  node_nan_guard["Invalid-value guards<br/>[NanGuard.java]"]
end

subgraph group_ragdoll["Optional ragdolls"]
  node_ragdoll_mod["Multiplayer Ragdolls mod<br/>[Main.java]"]
  node_ragdoll_gate["Ragdoll safety gate<br/>[LabGate.java]"]
  node_ragdoll_hooks["Ragdoll game hooks"]
end

node_zb(("ZombieBuddy"))
node_game["Project Zomboid"]

node_zb -->|"loads"| node_vehicle_mod
node_zb -->|"loads"| node_ragdoll_mod
node_vehicle_mod -->|"hooks methods"| node_game
node_ragdoll_mod -->|"lifts ragdoll ban"| node_game
node_vehicle_mod -->|"gates patches"| node_safety
node_vehicle_mod -->|"raises suspension limit"| node_native
node_engine_power -->|"reads rules"| node_vehicle_cfg
node_engine_power -->|"reads switches"| node_settings
node_vehicle_floor -->|"reads switches"| node_settings
node_vehicle_floor -->|"reads rules"| node_vehicle_cfg
node_vehicle_floor -->|"uses drag"| node_veg
node_vehicle_floor -->|"uses tree logic"| node_trees
node_vehicle_floor -->|"checks tracks"| node_footprint
node_vehicle_floor -->|"reports impacts"| node_horde
node_vehicle_floor -->|"calls service"| node_service
node_animal_impact -->|"shares impact logic"| node_animal_throw
node_corpse_sync -->|"reads settings"| node_settings
node_corpse_sync -->|"uses server table"| node_server_table
node_corpse_sync -->|"warns through"| node_trees
node_remote_ragdoll -->|"reads settings"| node_settings
node_remote_ragdoll -->|"warns through"| node_trees
node_ragdoll_mod -.->|"gates hooks"| node_ragdoll_gate
node_ragdoll_gate -.->|"controls"| node_ragdoll_hooks
node_game -->|"sends rules to clients"| node_server_table
node_lua_registry -->|"registers vehicle data"| node_vehicle_cfg
node_vehicle_table -->|"uses vehicle rules"| node_vehicle_cfg
node_vehicle_cfg -->|"provides rules"| node_server_table
node_footprint -->|"reports releases"| node_horde
node_animal_impact -.->|"uses feature switches"| node_settings
node_game -->|"syncs landing state"| node_corpse_sync
node_game -->|"provides sandbox settings"| node_vehicle_mod
node_game -->|"provides vehicle physics"| node_vehicle_mod

click node_vehicle_mod "https://github.com/devatiywork/mass-and-momentum/blob/main/mods/LabVehiclePhysics/src/pz/labvehicle/Main.java"
click node_safety "https://github.com/devatiywork/mass-and-momentum/blob/main/mods/LabVehiclePhysics/src/pz/labvehicle/LabGate.java"
click node_native "https://github.com/devatiywork/mass-and-momentum/blob/main/mods/LabVehiclePhysics/src/pz/labvehicle/NativePatch.java"
click node_settings "https://github.com/devatiywork/mass-and-momentum/blob/main/mods/LabVehiclePhysics/src/pz/labvehicle/LabSettings.java"
click node_vehicle_cfg "https://github.com/devatiywork/mass-and-momentum/blob/main/mods/LabVehiclePhysics/src/pz/labvehicle/VehicleCfg.java"
click node_vehicle_table "https://github.com/devatiywork/mass-and-momentum/blob/main/mods/LabVehiclePhysics/src/pz/labvehicle/VehicleTable.java"
click node_lua_registry "https://github.com/devatiywork/mass-and-momentum/blob/main/mods/LabVehiclePhysics/src/pz/labvehicle/LuaRegistry.java"
click node_server_table "https://github.com/devatiywork/mass-and-momentum/blob/main/mods/LabVehiclePhysics/src/pz/labvehicle/ServerTable.java"
click node_engine_power "https://github.com/devatiywork/mass-and-momentum/blob/main/mods/LabVehiclePhysics/src/pz/labvehicle/Patch_enginePower.java"
click node_vehicle_floor "https://github.com/devatiywork/mass-and-momentum/blob/main/mods/LabVehiclePhysics/src/pz/labvehicle/Patch_vehicleFloor.java"
click node_animal_impact "https://github.com/devatiywork/mass-and-momentum/blob/main/mods/LabVehiclePhysics/src/pz/labvehicle/AnimalImpact.java"
click node_animal_throw "https://github.com/devatiywork/mass-and-momentum/blob/main/mods/LabVehiclePhysics/src/pz/labvehicle/AnimalThrow.java"
click node_veg "https://github.com/devatiywork/mass-and-momentum/blob/main/mods/LabVehiclePhysics/src/pz/labvehicle/VegetationDrag.java"
click node_trees "https://github.com/devatiywork/mass-and-momentum/blob/main/mods/LabVehiclePhysics/src/pz/labvehicle/TreeBreak.java"
click node_footprint "https://github.com/devatiywork/mass-and-momentum/blob/main/mods/LabVehiclePhysics/src/pz/labvehicle/TrackFootprint.java"
click node_horde "https://github.com/devatiywork/mass-and-momentum/blob/main/mods/LabVehiclePhysics/src/pz/labvehicle/HordeReport.java"
click node_service "https://github.com/devatiywork/mass-and-momentum/blob/main/mods/LabVehiclePhysics/src/pz/labvehicle/VehicleService.java"
click node_corpse_sync "https://github.com/devatiywork/mass-and-momentum/blob/main/mods/LabVehiclePhysics/src/pz/labvehicle/CorpseSync.java"
click node_remote_ragdoll "https://github.com/devatiywork/mass-and-momentum/blob/main/mods/LabVehiclePhysics/src/pz/labvehicle/RemoteRagdoll.java"
click node_nan_guard "https://github.com/devatiywork/mass-and-momentum/blob/main/mods/LabVehiclePhysics/src/pz/labvehicle/NanGuard.java"
click node_ragdoll_mod "https://github.com/devatiywork/mass-and-momentum/blob/main/mods/LabRagdollMP/src/pz/labragdoll/Main.java"
click node_ragdoll_gate "https://github.com/devatiywork/mass-and-momentum/blob/main/mods/LabRagdollMP/src/pz/labragdoll/LabGate.java"
click node_ragdoll_hooks "https://github.com/devatiywork/mass-and-momentum/blob/main/mods/LabRagdollMP/src/pz/labragdoll/Patch_IsoGameCharacter_canRagdoll.java"

classDef toneNeutral fill:#f8fafc,stroke:#334155,stroke-width:1.5px,color:#0f172a
classDef toneBlue fill:#dbeafe,stroke:#2563eb,stroke-width:1.5px,color:#172554
classDef toneAmber fill:#fef3c7,stroke:#d97706,stroke-width:1.5px,color:#78350f
classDef toneMint fill:#dcfce7,stroke:#16a34a,stroke-width:1.5px,color:#14532d
classDef toneRose fill:#ffe4e6,stroke:#e11d48,stroke-width:1.5px,color:#881337
classDef toneIndigo fill:#e0e7ff,stroke:#4f46e5,stroke-width:1.5px,color:#312e81
classDef toneTeal fill:#ccfbf1,stroke:#0f766e,stroke-width:1.5px,color:#134e4a
class node_vehicle_mod,node_safety,node_native toneBlue
class node_settings,node_vehicle_cfg,node_vehicle_table,node_lua_registry,node_server_table toneAmber
class node_engine_power,node_vehicle_floor,node_animal_impact,node_animal_throw,node_veg,node_trees,node_footprint,node_horde,node_service toneMint
class node_corpse_sync,node_remote_ragdoll,node_nan_guard toneRose
class node_ragdoll_mod,node_ragdoll_gate,node_ragdoll_hooks,node_zb,node_game toneIndigo
```

## Components

### Runtime and safety

- [Vehicle Physics mod](https://github.com/devatiywork/mass-and-momentum/blob/main/mods/LabVehiclePhysics/src/pz/labvehicle/Main.java): `mods/LabVehiclePhysics/src/pz/labvehicle/Main.java`
- [Safety gate](https://github.com/devatiywork/mass-and-momentum/blob/main/mods/LabVehiclePhysics/src/pz/labvehicle/LabGate.java): `mods/LabVehiclePhysics/src/pz/labvehicle/LabGate.java`
- [Suspension limit patch](https://github.com/devatiywork/mass-and-momentum/blob/main/mods/LabVehiclePhysics/src/pz/labvehicle/NativePatch.java): `mods/LabVehiclePhysics/src/pz/labvehicle/NativePatch.java`

### Settings and vehicle rules

- [Sandbox settings](https://github.com/devatiywork/mass-and-momentum/blob/main/mods/LabVehiclePhysics/src/pz/labvehicle/LabSettings.java): `mods/LabVehiclePhysics/src/pz/labvehicle/LabSettings.java`
- [Vehicle rules](https://github.com/devatiywork/mass-and-momentum/blob/main/mods/LabVehiclePhysics/src/pz/labvehicle/VehicleCfg.java): `mods/LabVehiclePhysics/src/pz/labvehicle/VehicleCfg.java`
- [Vehicle settings table](https://github.com/devatiywork/mass-and-momentum/blob/main/mods/LabVehiclePhysics/src/pz/labvehicle/VehicleTable.java): `mods/LabVehiclePhysics/src/pz/labvehicle/VehicleTable.java`
- [Lua vehicle registry](https://github.com/devatiywork/mass-and-momentum/blob/main/mods/LabVehiclePhysics/src/pz/labvehicle/LuaRegistry.java): `mods/LabVehiclePhysics/src/pz/labvehicle/LuaRegistry.java`
- [Server rule table](https://github.com/devatiywork/mass-and-momentum/blob/main/mods/LabVehiclePhysics/src/pz/labvehicle/ServerTable.java): `mods/LabVehiclePhysics/src/pz/labvehicle/ServerTable.java`

### Vehicle interactions

- [Engine power patch](https://github.com/devatiywork/mass-and-momentum/blob/main/mods/LabVehiclePhysics/src/pz/labvehicle/Patch_enginePower.java): `mods/LabVehiclePhysics/src/pz/labvehicle/Patch_enginePower.java`
- [Vehicle physics patch](https://github.com/devatiywork/mass-and-momentum/blob/main/mods/LabVehiclePhysics/src/pz/labvehicle/Patch_vehicleFloor.java): `mods/LabVehiclePhysics/src/pz/labvehicle/Patch_vehicleFloor.java`
- [Animal impacts](https://github.com/devatiywork/mass-and-momentum/blob/main/mods/LabVehiclePhysics/src/pz/labvehicle/AnimalImpact.java): `mods/LabVehiclePhysics/src/pz/labvehicle/AnimalImpact.java`
- [Animal throws](https://github.com/devatiywork/mass-and-momentum/blob/main/mods/LabVehiclePhysics/src/pz/labvehicle/AnimalThrow.java): `mods/LabVehiclePhysics/src/pz/labvehicle/AnimalThrow.java`
- [Vegetation drag](https://github.com/devatiywork/mass-and-momentum/blob/main/mods/LabVehiclePhysics/src/pz/labvehicle/VegetationDrag.java): `mods/LabVehiclePhysics/src/pz/labvehicle/VegetationDrag.java`
- [Tree breaking](https://github.com/devatiywork/mass-and-momentum/blob/main/mods/LabVehiclePhysics/src/pz/labvehicle/TreeBreak.java): `mods/LabVehiclePhysics/src/pz/labvehicle/TreeBreak.java`
- [Track footprint](https://github.com/devatiywork/mass-and-momentum/blob/main/mods/LabVehiclePhysics/src/pz/labvehicle/TrackFootprint.java): `mods/LabVehiclePhysics/src/pz/labvehicle/TrackFootprint.java`
- [Horde impact report](https://github.com/devatiywork/mass-and-momentum/blob/main/mods/LabVehiclePhysics/src/pz/labvehicle/HordeReport.java): `mods/LabVehiclePhysics/src/pz/labvehicle/HordeReport.java`
- [Vehicle service](https://github.com/devatiywork/mass-and-momentum/blob/main/mods/LabVehiclePhysics/src/pz/labvehicle/VehicleService.java): `mods/LabVehiclePhysics/src/pz/labvehicle/VehicleService.java`

### Multiplayer

- [Corpse landing sync](https://github.com/devatiywork/mass-and-momentum/blob/main/mods/LabVehiclePhysics/src/pz/labvehicle/CorpseSync.java): `mods/LabVehiclePhysics/src/pz/labvehicle/CorpseSync.java`
- [Remote ragdoll update](https://github.com/devatiywork/mass-and-momentum/blob/main/mods/LabVehiclePhysics/src/pz/labvehicle/RemoteRagdoll.java): `mods/LabVehiclePhysics/src/pz/labvehicle/RemoteRagdoll.java`
- [Invalid-value guards](https://github.com/devatiywork/mass-and-momentum/blob/main/mods/LabVehiclePhysics/src/pz/labvehicle/NanGuard.java): `mods/LabVehiclePhysics/src/pz/labvehicle/NanGuard.java`

### Optional ragdolls

- [Multiplayer Ragdolls mod](https://github.com/devatiywork/mass-and-momentum/blob/main/mods/LabRagdollMP/src/pz/labragdoll/Main.java): `mods/LabRagdollMP/src/pz/labragdoll/Main.java`
- [Ragdoll safety gate](https://github.com/devatiywork/mass-and-momentum/blob/main/mods/LabRagdollMP/src/pz/labragdoll/LabGate.java): `mods/LabRagdollMP/src/pz/labragdoll/LabGate.java`
- [Ragdoll game hooks](https://github.com/devatiywork/mass-and-momentum/blob/main/mods/LabRagdollMP/src/pz/labragdoll/Patch_IsoGameCharacter_canRagdoll.java): `mods/LabRagdollMP/src/pz/labragdoll/Patch_IsoGameCharacter_canRagdoll.java`

### Other components

- **ZombieBuddy**
- **Project Zomboid**

## Connections

- ZombieBuddy → Vehicle Physics mod: loads
- ZombieBuddy → Multiplayer Ragdolls mod: loads
- Vehicle Physics mod → Project Zomboid: hooks methods
- Multiplayer Ragdolls mod → Project Zomboid: lifts ragdoll ban
- Vehicle Physics mod → Safety gate: gates patches
- Vehicle Physics mod → Suspension limit patch: raises suspension limit
- Engine power patch → Vehicle rules: reads rules (evidence: `mods/LabVehiclePhysics/src/pz/labvehicle/Patch_enginePower.java`)
- Engine power patch → Sandbox settings: reads switches (evidence: `mods/LabVehiclePhysics/src/pz/labvehicle/Patch_enginePower.java`)
- Vehicle physics patch → Sandbox settings: reads switches (evidence: `mods/LabVehiclePhysics/src/pz/labvehicle/Patch_vehicleFloor.java`)
- Vehicle physics patch → Vehicle rules: reads rules (evidence: `mods/LabVehiclePhysics/src/pz/labvehicle/Patch_vehicleFloor.java`)
- Vehicle physics patch → Vegetation drag: uses drag (evidence: `mods/LabVehiclePhysics/src/pz/labvehicle/Patch_vehicleFloor.java`)
- Vehicle physics patch → Tree breaking: uses tree logic (evidence: `mods/LabVehiclePhysics/src/pz/labvehicle/Patch_vehicleFloor.java`)
- Vehicle physics patch → Track footprint: checks tracks (evidence: `mods/LabVehiclePhysics/src/pz/labvehicle/Patch_vehicleFloor.java`)
- Vehicle physics patch → Horde impact report: reports impacts (evidence: `mods/LabVehiclePhysics/src/pz/labvehicle/Patch_vehicleFloor.java`)
- Vehicle physics patch → Vehicle service: calls service (evidence: `mods/LabVehiclePhysics/src/pz/labvehicle/Patch_vehicleFloor.java`)
- Animal impacts → Animal throws: shares impact logic (evidence: `mods/LabVehiclePhysics/src/pz/labvehicle/AnimalImpact.java`)
- Corpse landing sync → Sandbox settings: reads settings (evidence: `mods/LabVehiclePhysics/src/pz/labvehicle/CorpseSync.java`)
- Corpse landing sync → Server rule table: uses server table (evidence: `mods/LabVehiclePhysics/src/pz/labvehicle/CorpseSync.java`)
- Corpse landing sync → Tree breaking: warns through (evidence: `mods/LabVehiclePhysics/src/pz/labvehicle/CorpseSync.java`)
- Remote ragdoll update → Sandbox settings: reads settings (evidence: `mods/LabVehiclePhysics/src/pz/labvehicle/RemoteRagdoll.java`)
- Remote ragdoll update → Tree breaking: warns through (evidence: `mods/LabVehiclePhysics/src/pz/labvehicle/RemoteRagdoll.java`)
- Multiplayer Ragdolls mod → Ragdoll safety gate: gates hooks
- Ragdoll safety gate → Ragdoll game hooks: controls
- Project Zomboid → Server rule table: sends rules to clients (evidence: `mods/LabVehiclePhysics/src/pz/labvehicle/ServerTable.java`)
- Lua vehicle registry → Vehicle rules: registers vehicle data (evidence: `mods/LabVehiclePhysics/src/pz/labvehicle/LuaRegistry.java`)
- Vehicle settings table → Vehicle rules: uses vehicle rules (evidence: `mods/LabVehiclePhysics/src/pz/labvehicle/VehicleTable.java`)
- Vehicle rules → Server rule table: provides rules (evidence: `mods/LabVehiclePhysics/src/pz/labvehicle/VehicleCfg.java`)
- Track footprint → Horde impact report: reports releases (evidence: `mods/LabVehiclePhysics/src/pz/labvehicle/TrackFootprint.java`)
- Animal impacts → Sandbox settings: uses feature switches
- Project Zomboid → Corpse landing sync: syncs landing state
- Project Zomboid → Vehicle Physics mod: provides sandbox settings
- Project Zomboid → Vehicle Physics mod: provides vehicle physics
