Skip to main content

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.

Constructors​

MemberWhat it is
NailSettings()Creates a NailSettings with default values.

Fields​

MemberWhat it is
float damageOverflowMultiplierHow much of a hit's overflow becomes failure damage.
AnimationCurve damageSplitPerDotCurve from hit alignment (dot product) to the share of damage that becomes progress.
float devianceMultiplierBase strength of the bend from off-angle hits.
AnimationCurve devianceToDamageCurve from how bent a nail is to how much of each hit becomes failure damage.
float maxDamagePerHitMost progress one hit can give before the rest overflows.
float maxDevianceLargest bend angle a nail can take, in degrees.
PooledObjectDefinition nailDefinitionPooled nail prefab. Falls back to the generic default.
SerializedTransform[] nailsLocal positions and rotations of the nails on the piece.
float nailTimeTime allowed for nailing, 20 by default.
float progressHealthHow much progress a nail needs. Progress from each hit is divided by it.
AnimationCurve progressToDevianceMultiplierCurve from nail progress to how easily it bends.

Methods​

MemberWhat 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: