SteelSong
A class in Root.Township, the global namespace.
Smithing skill: hitting a glowing forged item in rhythm with a pulse effect builds a hit streak that multiplies later hit damage on that item. The local player times the hits and the server applies the multiplier.
- Listed in Global namespace: S
- Inherits or implements
PickupBasedSkill - Derived types
SteelSong.Create - Nested types
Create,IdentifiedModel,MessageType
Constructors
| Member | What it is |
|---|---|
SteelSong() | Use ScriptableObject.CreateInstance instead of new; Unity loads the saved ones from assets. |
Fields
16 private and internal fields
| Member | What it is |
|---|---|
private float[] activeDamageMultiplierPerHit | Damage multiplier for each streak level, from 1.05 up to 1.5 by default. |
private Dictionary<ImpactDetector, SteelSong.IdentifiedModel> activeDetectors | Client: the forged model being tracked for each impact detector. |
private Dictionary<ImpactDetector, SteelSongEffect> activeEffects | Client: the pulse effect playing on each impact detector. |
private float animationDuration | Length of one pulse in seconds. |
private PositionRotationEvent badHitEffect | Effect played on a mistimed hit. |
private Dictionary<ImpactDetector, int> detectorHitCount | Current streak per impact detector, used for the damage multiplier. |
private Dictionary<uint, ImpactDetector> detectorMap | Maps held item entity ids to their impact detectors. |
private TransformEvent dissipatedEffect | Effect played when the pulse ends. |
private PositionRotationEvent goodHitEffect | Effect played on a well timed hit. |
private int hitCount | Streak count sent in the next message. |
private bool isActive | Whether the skill is active, sent in the next message. |
private int levelsCount | Number of streak levels; matches the multiplier array. |
private SteelSong.MessageType messageType | Who the next message is for: the local player, other players or the server. |
private float minimumEffectiveness | Hits at or below this effectiveness are ignored. |
private float precisionLeeway | How close to the end of the pulse (seconds left) a hit must land to count. |
private PooledObjectDefinition pulseEffect | Pooled SteelSongEffect that shows the rhythm. |
Methods
| Member | What it is |
|---|---|
override void Deregister(ISkillInputMethod input) | Stops tracking the held item and tells the player the skill is off. |
override void Register(ISkillInputMethod input) | Starts tracking the held item's impact detector and tells the local player the skill is on. |
override void SendSerializedMessage(IPlayer player, Stream stream) | Serializes the item id, hit count and message kind. The server stores counts from clients and runs the skill at the top level. |
override bool ValidatePickup(HeldPickupHandler pickupHandler) | True if the item has a forged point under 95% progress. |
protected override void OnValidate() | Sets levelsCount to the length of activeDamageMultiplierPerHit. |
7 private and internal methods
| Member | What it is |
|---|---|
private void CheckHitCount(ImpactHit impact) | Client: on the local player's tool hit, a well timed hit raises the streak and a mistimed one resets it, then reports the count to the server. |
private void CheckHitDamage(ImpactHit impact) | Multiplies a hit's damage by the entry in activeDamageMultiplierPerHit for the item's current streak. |
private void MaxHitCountSoundEffect(ImpactHit impact) | Plays the good hit effect for other players watching an active streak. |
private void ReleaseImpactorEffect(PooledObject pooledObject) | Ends a pulse effect: plays the dissipate effect, releases it and, on the server, stores the hit count. |
private void ReleaseImpactorEffect(PooledObject pooledObject, ImpactDetector detector) | Ends a pulse effect: plays the dissipate effect, releases it and, on the server, stores the hit count. |
private void SendStatusToLocalPlayer(ISkillInputMethod input, bool isActive) | Server: tells the holding player (and others, when turning off) whether the skill is active. |
private void SetupForEntity(NetworkEntity entity, bool isActive, SteelSong.MessageType messageType) | Client: hooks the hit handlers on the item's forged model, timing for the holder and sound only for others. |