REFERENCECOMPONENTS
UCFBreakableUnitsComponent
The replicated core of a set of breakable units, each taken through levels 0 (intact) to MaxLevel (broken for good). The owner lays the units out and calls InitUnits on every machine with identical data; a unit's index is its identity everywhere. The authority confirms levels (RaiseUnitLevelOnAuthority) and replicates them with a ring of recent events, a client predicts a level ahead of it (PredictUnitLevel) and the tracker keeps what each machine shows. A subclass says what a unit looks like and where it stands; it never touches the replicated state itself.
Functions
The units component Primitive stands for a unit of, and that unit's index: through ICFBreakableUnitPart on the primitive, else the first attach parent that knows the primitive. nullptr when none does.
- Category
- Crushform|Breakable
Authority: applies an outside hit on a primitive to the unit it belongs to. The impact point is the hit's location, its direction the trace's (the inverse surface normal for a zero-length trace).
- Category
- Crushform|Breakable
Any machine: the prediction twin of ApplyHitResultOnAuthority.
- Category
- Crushform|Breakable
Authority: raises the unit to the level its definition gives this hit (HitResponses), replicates it and plays it. False if nothing changed. Virtual: a subclass whose hits need their own verdict (a glass pane's crack) overrides it.
- Category
- Crushform|Breakable
Any machine: shows the hit's level now and waits for the authority; undone after PredictionConfirmTimeoutSeconds. The caller brings its own way to the server.
- Category
- Crushform|Breakable
How many units the owner laid out.
- Category
- Crushform|Breakable
The highest level a unit can reach, as given to InitUnits; a unit is intact at 0.
- Category
- Crushform|Breakable
The level this machine shows: the authority's, or a prediction ahead of it.
- Category
- Crushform|Breakable
The level the authority confirmed in the current generation.
- Category
- Crushform|Breakable
True for a valid index whose shown level is 0; false for an invalid index.
- Category
- Crushform|Breakable
Shows StoredImpact's level now, ahead of the authority, with the units GatherUnitsRaisedWith adds. False for an invalid index or level, or when the unit already shows that level or more.
Authority: confirms Level for the unit and the units GatherUnitsRaisedWith adds, replicates it, plays it here and tells OnUnitsRaisedOnAuthority. False for a non-authority, an invalid index or level, or a unit already at that level or more.
Rolls the unit's prediction back to the confirmed level, and with it the predictions of the units GatherUnitsRaisedWith adds. False for an invalid index or a unit with no prediction.
Any machine: the first generation this component learns (from here or from its replicated levels) is taken whatever it is; after that a newer one puts every unit back to intact here at once, and an equal or older one is ignored. The authority also empties the replicated levels and the event ring.
The unit the primitive (and the instance of it, ItemIndex) stands for, or INDEX_NONE. Called for primitives attached below this component.
Events
Both fire on every machine whenever a unit's shown level changes. A late joiner's catch-up (init at 0, then the replicated levels) fires them for every unit already raised, so no one-shot effect belongs here. Handlers may raise, predict or cancel other units and apply a generation.
- Category
- Crushform|Breakable