static void refresh(Exosuit exosuit) { if (exosuit == null) { return; } DealDamageOnImpact damage = exosuit.GetComponent <DealDamageOnImpact>(); damage.mirroredSelfDamage = Main.config.collisionSelfDamage.enabled; damage.speedMinimumForSelfDamage = Main.config.collisionSelfDamage.speedMinimumForDamage; int armorCount = exosuit.modules.GetCount(TechType.VehicleArmorPlating); damage.mirroredSelfDamageFraction = Main.config.collisionSelfDamage.mirroredSelfDamageFraction * Mathf.Pow(0.5f, armorCount); $"CollisionSelfDamage: {damage.mirroredSelfDamage} {damage.speedMinimumForSelfDamage} {damage.mirroredSelfDamageFraction}".logDbg(); }
void OnTriggerEnter(Collider collider) { DealDamageOnImpact damage = collider.gameObject.GetComponent <DealDamageOnImpact>(); if (damage != null && !damage.consumed) { GetComponent <Life>().hitpoints -= damage.amount; if (damage.destroyOnImpact) { GameObject.Destroy(damage.gameObject); } damage.consumed = true; if (damage.impactSpecialEffect != null) { GameObject.Instantiate(damage.impactSpecialEffect, new Vector3(transform.position.x, 0.1f, -0.5f), Quaternion.identity); } } }