bool?OnEntityTakeDamage(BaseCombatEntity entity, HitInfo hitInfo) { if (entity != null && hitInfo != null) { JDeployable.Child c = entity?.GetComponent <JDeployable.Child>(); if (c != null && c.parent != null) { if (true) // if nodecay { hitInfo.damageTypes.Scale(Rust.DamageType.Decay, 0f); // no decay damage } float damage = hitInfo.damageTypes.Total(); if (damage > 0) { float newhealth = entity.health - damage; if (newhealth > 0f) { c.parent.SetHealth(newhealth); } else { KillDeployable(c.parent); } } return(true); } } return(null); }
void OnStructureRepair(BaseCombatEntity entity, BasePlayer player) { JDeployable.Child c = entity?.GetComponent <JDeployable.Child>(); if (c != null && c.parent != null && player != null) { NextTick(() => c.parent.OnStructureRepair(entity, player)); } }
void OnKilledChild(BaseEntity entity) { JDeployable.Child c = entity?.GetComponent <JDeployable.Child>(); if (c != null && c.parent != null) { KillDeployable(c.parent); } }
bool?OnStructureUpgrade(BaseCombatEntity entity, BasePlayer player, BuildingGrade.Enum grade) { JDeployable.Child c = entity?.GetComponent <JDeployable.Child>(); if (c != null && c.parent != null && player != null) { return(c.parent.OnStructureUpgrade(c, player, grade)); } return(null); }
bool?CanPickupEntity(BaseCombatEntity entity, BasePlayer player) { JDeployable.Child c = entity?.GetComponent <JDeployable.Child>(); if (c != null && c.parent != null && player != null) { return(c.parent.CanPickupEntity(c, player)); } return(null); }