SparkSecondaryDetector
A class in Root.Township, Alta.Impact.
Makes sparks when certain colliders are struck on spark channels, which can light nearby flammables. The wielding client reports its hit and the server runs the sparks.
- Listed in Items, inventory and logic
- Inherits or implements
NetworkEntityBehaviour - Nested types
SparkArgument
Constructors
| Member | What it is |
|---|---|
SparkSecondaryDetector() | Unity makes components itself; use AddComponent or spawn a prefab instead of new. |
Fields
8 private and internal fields
| Member | What it is |
|---|---|
private ImpactDetector baseDetector | The impact detector whose hits are checked. |
private Collider[] colliders | Colliders that make sparks when struck. |
private ImpactDetectorSettings hitSettings | Settings used to play the hit effects. |
private float maximumFireChance | Chance to light at full effectiveness. |
private float minimumFireChance | Chance to light at zero effectiveness. |
private float radius | Radius of the spark check. |
private ImpactChannel[] sparkChannels | Impact channels that can make sparks. |
private MethodSyncStruct<SparkSecondaryDetector.SparkArgument> syncSpark | Synced method that sends sparks from client to server. |
Methods
| Member | What it is |
|---|---|
override void Initialize() | Hooks the base detector's hits on the server or client side and sets up the spark message. |
5 private and internal methods
| Member | What it is |
|---|---|
private void ClientSpark(ImpactHit hit) | Client: on a valid hit by the local player's tool, sends the spark to the server and plays effects. |
private void OnDrawGizmosSelected() | Draws the spark radius in the editor. |
private void ServerSpark(ImpactHit hit) | Server: on a valid hit, runs Fire.SimulateSparks at the hit point. |
private void SyncSpark(IPlayer player, Stream stream, SparkSecondaryDetector.SparkArgument arguments) | Sends the hit point (relative, within 10 m) and effectiveness; the server runs Fire.SimulateSparks on receipt. |
private bool ValidateHit(ImpactHit hit) | True if the hit is on a spark channel and struck one of colliders. |