PhysicalMaterial
A class in Root.Township, the global namespace.
A material asset (iron, oak, copper and so on) that holds the heat, crafting, impact and bow numbers for items made of it, plus the render materials per channel. A hashed ScriptableObject; look one up through HashedGeneralValue.
- Listed in Global namespace: P
- Inherits or implements
HashedGeneralValue<PhysicalMaterial> - Derived types
PhysicalMaterial,PhysicalMaterial.Create - Nested types
Create,MaterialChannel - Documented in Items and materials
Constructors
| Member | What it is |
|---|---|
PhysicalMaterial() | Use ScriptableObject.CreateInstance instead of new; Unity loads the saved ones from assets. |
Fields
30 private and internal fields
| Member | What it is |
|---|---|
private float damageMultiplier | Backing field for DamageMultiplier: damage multiplier for weapons and tools made of this material. |
private float density | Backing field for Density. The tooltip says it scales damage when chiselling wood on the chisel deck. |
private float durabilityMultiplier | Backing field for DurabilityMultiplier, used by durability modules. |
private PooledObjectDefinition effectOnFullyHeated | Backing field for EffectOnFullyHeated. |
private PooledObjectDefinition firstIsDoneImpactEffect | Backing field for FirstIsDoneImpactEffect. |
private PooledObjectDefinition firstIsDoneMeshEffect | Backing field for FirstIsDoneMeshEffect. |
private PooledObjectDefinition followingDoneImpactsEffect | Backing field for FollowingDoneImpactsEffect. |
private PooledObjectDefinition followingDoneMeshEffect | Backing field for FollowingDoneMeshEffect. |
private float forgeMultiplier | Backing field for ForgeMultiplier: damage resistance when forging on an anvil. |
private float glowingEnd | Backing field for GlowingEnd: temperature where the forged model's glow particles cap out. Default 1000. |
private float glowingStart | Backing field for GlowingStart: temperature where the forged model starts to glow. Default 100. |
private uint hardnessLevel | Backing field for HardnessLevel: the tier needed to damage other materials of equal or lower level. |
private float internalThermalConductivity | Backing field for InternalThermalConductivity, in W/m.k. |
private bool isShowingInList | Backing field for IsShowingInList. Default true. |
private Material material | Hidden inspector material that this class never reads; the per channel materials are used instead. |
private PhysicalMaterial.MaterialChannel[] materialChannels | Per PhysicalMaterialChannel materials, so items of the same material can use different textures. |
private float maxCraftingDamageMultiplier | Backing field for MaxCraftingDamageMultiplier: raises the break threshold of generic crafting nails. |
private float maxInvalidProjectileVelocityMultiplier | Backing field for MaxInvalidProjectileVelocityMultiplier: velocity multiplier for projectiles under the minimum weight. |
private float maxTemperatureForParticles | Backing field for MaxTemperatureForParticles. Default 1250. |
private float meltingPoint | Backing field for MeltingPoint: the temperature at which the recycler consumes the item. |
private float minimumProjectileWeight | Backing field for MinimumProjectileWeight. Lighter projectiles can only fire up to max bow speed. Default -1. |
private float nailHealthMultiplier | Backing field for NailHealthMultiplier: impact resistance when nailing a part made of this material. |
private float noiseMultiplier | Backing field for NoiseMultiplier: scales stat impact values on a pickup, like shield bashing. |
private Material nonDeformingMaterial | Hidden inspector material that this class never reads; the per channel materials are used instead. |
private float receiveThermalConductivity | Backing field for ReceiveThermalConductivity, in W/m.k. |
private uint sourceMaterialHash | Backing field for SourceMaterialHash: a network prefab hash, probably the raw material this one comes from. |
private float sourceThermalConductivity | Backing field for SourceThermalConductivity, in W/m.k. |
private float tightnessBowImpact | Backing field for TightnessBowImpact: how much tightness affects bow pull back speed. |
private float tightnessMultiplier | Backing field for TightnessMultiplier: changes a shooter's firing distance with arrows. |
private float weightMultiplier | Backing field for WeightMultiplier: multiplies a pickup's raw weight into its physical weight. |
Properties
| Member | What it is |
|---|---|
float DamageMultiplier { get; } | Multiplies the damage of tools and weapons made of this material (also used for chiselling and digging). |
float Density { get; } | Divides chisel damage on timber made of this material, so denser wood takes longer to carve. |
float DurabilityMultiplier { get; } | Multiplies the base durability of a DurabilityModule on items of this material. |
PooledObjectDefinition EffectOnFullyHeated { get; } | Pooled effect a metal or melting heat point spawns once its temperature passes MaxTemperatureForParticles. |
PooledObjectDefinition FirstIsDoneImpactEffect { get; } | Pooled effect spawned at the hit point the first time a forged model is finished by a hammer blow. |
PooledObjectDefinition FirstIsDoneMeshEffect { get; } | Pooled mesh effect for the first time a forged model is finished. |
PooledObjectDefinition FollowingDoneImpactsEffect { get; } | Pooled effect spawned on hits to a forged model that is already finished. |
PooledObjectDefinition FollowingDoneMeshEffect { get; } | Pooled mesh effect for hits after a forged model is finished. |
float ForgeMultiplier { get; } | Multiplies how much shaping progress each anvil hit gives a forged model of this material. |
float GlowingEnd { get; } | Temperature where glow caps out. Also the temperature every melting heat point must reach before the recycler melts the item. |
float GlowingStart { get; } | Temperature where a heated metal item starts to glow. |
uint HardnessLevel { get; } | Hardness tier copied to impact generators and detectors. A tool cannot damage a detector with a higher hardness level. |
float InternalThermalConductivity { get; } | Conductivity (W/m.k) between heat points inside the same item; used by metal and melting heat points. |
bool IsShowingInList { get; } | Whether the spawn command lists this material as an option. |
float MaxCraftingDamageMultiplier { get; } | Raises the damage threshold at which a crafting nail breaks, so strong nails stay valid. |
float MaxInvalidProjectileVelocityMultiplier { get; } | Velocity multiplier a bow uses for a projectile lighter than MinimumProjectileWeight. |
float MaxTemperatureForParticles { get; } | Above this temperature metal and melting heat points spawn EffectOnFullyHeated. |
float MeltingPoint { get; } | Serialized as the temperature at which the recycler consumes the item, but nothing in this build reads it; melting checks GlowingEnd instead. |
float MinimumProjectileWeight { get; } | Projectiles lighter than this fire at reduced speed from a bow of this material. -1 turns the check off. |
float NailHealthMultiplier { get; } | Damage resistance when nailing a crafting part made of this material. |
float NoiseMultiplier { get; } | Multiplies the stat impact value of hits from a pickup of this material (for example shield bashing). |
float ReceiveThermalConductivity { get; } | Conductivity (W/m.k) used when this material takes heat from another object. |
uint SourceMaterialHash { get; } | Prefab hash of the raw material (ingot or similar) the recycler spawns when melting items of this material. |
float SourceThermalConductivity { get; } | Conductivity (W/m.k) used when this material gives heat to another object. |
float TightnessBowImpact { get; } | How much TightnessMultiplier affects a bow string's pull speed. |
float TightnessMultiplier { get; } | Multiplies bow string tightness, which changes how far a bow of this wood fires. |
float WeightMultiplier { get; } | Multiplies a pickup's raw weight to give its physical weight. |
Methods
| Member | What it is |
|---|---|
Material GetMaterial(PhysicalMaterialChannel channel) | Returns the Unity render material for a PhysicalMaterialChannel. Falls back to channel 0 if the channel is out of range. |
Material GetNonAtlasedNonDeformingMaterial(PhysicalMaterialChannel channel) | Returns the plain non-deforming render material for a channel, without the atlas offset. |
MaterialRect GetNonDeformingMaterial(PhysicalMaterialChannel channel) | Returns the atlased non-deforming material for a channel as a MaterialRect (atlas material plus offset and scale). |
bool Setup(AtlasDefinition definition) | Editor/build: fills in atlas offsets for each channel from an AtlasDefinition. Returns true if any channel matched. |
1 private and internal method
| Member | What it is |
|---|---|
private PhysicalMaterial.MaterialChannel GetChannel(int index) | Returns the material channel at an index, falling back to the first channel when the index is out of range. |
Used in
Members of other types that take, return or hold a PhysicalMaterial:
BasicMeltingModel.InternalSetup, BasicMeltingModel.physicalMaterial, BasicMeltingModel.PhysicalMaterial, ForgedModel<TB, TA>.PhysicalMaterial, ForgedModel<TB, TA>.UpdateMaterial, MeltingModel.InternalSetup, MeltingModel.PhysicalMaterial, MeltingModel.Setup, MeltingModelPart.InternalSetup, MeltingModelPart.PhysicalMaterial, MetalHeatPoint.physicalMaterial, MetalHeatPoint.UpdateMaterial, Recycler.GetSlot, RecyclerOutputSlot.CurrentMaterial, RecyclerOutputSlot.Reappropriate, RecyclerOutputSlot.SaveData.material, Smelter.CheckMould, Smelter.mouldMaterial, SmelterSaveData.currentMaterial, SmelterUnlockManager.PhysicalMaterials, SmelterUnlockManager.physMats, SmelterUpgrades.physicalMaterials, SmelterUpgrades.PhysicalMaterials, BuilderDock.CurrentPhysicalMaterial, BuilderDock.SetupPhysicalMaterial, ChiselingTool.NewMaterial, ChisellingDeckSaveData.physicalMaterial, TimberBlock.physicalMaterial, TimberBlock.PhysicalMaterial, TimberBlock.SetupPhysicalMaterial, GenericCraftingComponent.material, GenericCraftingComponent.Material, GenericCraftingComponent.SetupAsRefuse, GenericCraftingPiece.LoadCompletePiece, GenericCraftingPiece.Material, GenericCraftingPiece.SetMaterial, GenericCraftingPiece.SpawnChunkedRefuseWithMaterial, PieceSaveData.material, ImpactDetector.SetPhysicalMaterial, Ingot.physicalMaterial, Ingot.PhysicalMaterial, Item.GetComponent, StorageData.material, TreeSpecies.physicalMaterial, TreeSpecies.PhysicalMaterial, DurabilityModule.UpdateMaterial, IListenToPhysicalMaterial.SetPhysicalMaterial, ItemComponent.CheckMatch, ItemComponent.physicalMaterials, PhysicalMaterialPart.physicalMaterial, PhysicalMaterialPart.PhysicalMaterial, PhysicalMaterialPart.SetMaterial, PhysicalMaterialPart.ChangedMaterial.BeginInvoke, PhysicalMaterialPart.ChangedMaterial.Invoke, PhysicalMaterialPartSaveData.material, RepairBox.item1Material, RepairBox.item2Material, RepairBox.item3Material, RepairBox.Prepare, RepairBoxSaveData.Item.physMat and 2 more.