public virtual void UseItem(IResourceTypeItem rs) { }
public static void ResourceUseItem(IResourceTypeItem rs, ResourceTypeItemDataBlock RTIDB) { RaycastHit hit; bool flag; Facepunch.MeshBatch.MeshBatchInstance instance; if (MeshBatchPhysics.SphereCast(rs.character.eyesRay, 0.5f, out hit, 4f, out flag, out instance)) { IDMain idMain; if (flag) { idMain = instance.idMain; } else { idMain = IDBase.GetMain(hit.collider.gameObject); } if (idMain != null) { RepairReceiver local = idMain.GetLocal<RepairReceiver>(); TakeDamage damage = idMain.GetLocal<TakeDamage>(); if ((((local != null) && (damage != null)) && (local.GetRepairAmmo() == RTIDB)) && (damage.health != damage.maxHealth)) { if (enableRepair) { if (damage.TimeSinceHurt() < 5f) { int timeToWait = 5 - (int)Math.Round(damage.TimeSinceHurt()); Rust.Notice.Popup(rs.character.netUser.networkPlayer, "⌛", "You must wait " + timeToWait + " seconds.", 4f); } else { float amount = damage.maxHealth / ((float)local.ResForMaxHealth); if (amount > (damage.maxHealth - damage.health)) { amount = damage.maxHealth - damage.health; } damage.Heal(rs.character.idMain, amount); rs.lastUseTime = UnityEngine.Time.time; int count = 1; if (rs.Consume(ref count)) { rs.inventory.RemoveItem(rs.slot); } string strText = string.Format("Healed {0} ({1}/{2})", (int)amount, (int)damage.health, (int)damage.maxHealth); Broadcast.sideNoticeTo(rs.inventory.networkViewOwner, strText); } } else Broadcast.broadcastTo(rs.inventory.networkViewOwner, "Repairing is disabled on this server."); } } } }