NailSettings
A class in Root.Township, Alta.Crafting.
Per-piece settings for nailing in generic crafting: where the nails go and how hammer hits turn into progress, damage and bend.
- Listed in Crafting and making
- Documented in Crafting
Constructors
| Member | What it is |
|---|---|
NailSettings() | Creates a NailSettings with default values. |
Fields
| Member | What it is |
|---|---|
float damageOverflowMultiplier | How much of a hit's overflow becomes failure damage. |
AnimationCurve damageSplitPerDot | Curve from hit alignment (dot product) to the share of damage that becomes progress. |
float devianceMultiplier | Base strength of the bend from off-angle hits. |
AnimationCurve devianceToDamage | Curve from how bent a nail is to how much of each hit becomes failure damage. |
float maxDamagePerHit | Most progress one hit can give before the rest overflows. |
float maxDeviance | Largest bend angle a nail can take, in degrees. |
PooledObjectDefinition nailDefinition | Pooled nail prefab. Falls back to the generic default. |
SerializedTransform[] nails | Local positions and rotations of the nails on the piece. |
float nailTime | Time allowed for nailing, 20 by default. |
float progressHealth | How much progress a nail needs. Progress from each hit is divided by it. |
AnimationCurve progressToDevianceMultiplier | Curve from nail progress to how easily it bends. |
Methods
| Member | What it is |
|---|---|
bool CalculateNailDamage(GenericCraftingNail nail, Vector3 impactDirection, float impactDamage, out float progressDamage, out float failureDamage, out Quaternion additionaDeviance) | Works out a hammer hit's progress, failure damage and extra bend for a nail. Returns true if the hit was too hard. |
bool CalculateNailDamage(GenericCraftingNail nail, Vector3 impactDirection, float impactDamage, float maxDamageMultiplier, float nailHealthMultiplier, out float progressDamage, out float failureDamage, out Quaternion additionaDeviance) | Works out a hammer hit's progress, failure damage and extra bend for a nail. Returns true if the hit was too hard. |
void CalculateProgressAndOverflow(Vector3 nailDirection, Vector3 impactDirection, float impactDamage, float maxDamageMultiplier, out float progressDamage, out float overflow) | Splits a hit into progress by how well it lines up with the nail, and how much it went over the per-hit limit. |
float GetDevianceMultiplier(float progress) | How strongly an off-angle hit bends the nail at a given progress. |
GameObject GetNail(Transform parent) | Spawns a non-saved nail model under a parent, using the default nail if none is set. |
GenericCraftingNail[] SetupNails(INailable piece) | Spawns and sets up a pooled nail at each nail position on a piece. |
Used in
Members of other types that take, return or hold a NailSettings: