ImpactModifier
A class in Root.Township, Alta.Impact.
Server: changes hits made by a crafted tool (damage multipliers, stat changes) by running a list of ImpactModifierComponents on them. Covers either the whole tool or the parts attached to its slots.
- Listed in Items, inventory and logic
- Inherits or implements
NetworkEntityBehaviour
Constructors
| Member | What it is |
|---|---|
ImpactModifier() | Unity makes components itself; use AddComponent or spawn a prefab instead of new. |
Fields
7 private and internal fields
| Member | What it is |
|---|---|
private CraftingPart basePart | The crafting part whose root or slots are watched. |
private bool isForWholeTool | When on, modifies every hit of the whole tool instead of only attached parts. |
private bool isOnlyWhenWielded | When on, only modifies hits while the tool's pickup is held. |
private static Logger logger | NLog logger; logs when a slot is registered twice. |
private Dictionary<JointPoint, ImpactorMap> maps | The ImpactorMap registered for each slot. |
private ImpactModifierComponent[] modifiers | The modifier assets run on each hit. |
private ImpactTool trackedTool | The root impact tool hooked when isForWholeTool is on. |
Events
| Member | What it is |
|---|---|
event Action<ImpactHitWithTool> OnModifiedHit | Raised after the modifiers have changed a hit. |
Methods
| Member | What it is |
|---|---|
override void InitializeAsServer(SpawnData spawnData) | Server: hooks the root tool, or each slot's attached part, plus any ImpactorMap on this object. |
5 private and internal methods
| Member | What it is |
|---|---|
private void DeregisterSlot(JointPoint point) | Unhooks the impact generators of the part that left a slot. |
private void ModifyHit(ImpactHitWithTool hitWithTool) | Runs every modifier on the hit and raises OnModifiedHit, if wielding isn't required or the tool is held. |
private void OnRootChanged(CraftingPart craftingPart) | Moves the hit hook to the new root's ImpactTool. |
private void RegisterImpactorMap(ImpactorMap map) | Hooks every impact generator in an ImpactorMap so its hits get modified. |
private void RegisterSlot(JointPoint point) | Hooks the ImpactorMap of the part just attached to a slot. |