object OnEntityTakeDamage(BaseCombatEntity entity, HitInfo hitInfo) { if (hitInfo.damageTypes.GetMajorityDamageType().ToString().Contains("Decay")) { var ownerid = entity.OwnerID; if (HasPermission(ownerid, "vipnodecay.vip")) { DecayEntity decayEntity = entity.GetComponent <DecayEntity>(); //First resets the decay timer for entity who's owner is a vip decayEntity.DecayTouch(); //Then blocks this currrent damage to entity return(false); } } return(null); }
public static void BuildingDecayTouch(BuildingBlock buildingBlock) { if (ConVar.Decay.upkeep) { return; } List <DecayEntity> obj = Facepunch.Pool.GetList <DecayEntity>(); Vis.Entities(buildingBlock.transform.position, 40f, obj, 2097408); for (int i = 0; i < obj.Count; i++) { DecayEntity decayEntity = obj[i]; BuildingBlock buildingBlock2 = decayEntity as BuildingBlock; if (!buildingBlock2 || buildingBlock2.buildingID == buildingBlock.buildingID) { decayEntity.DecayTouch(); } } Facepunch.Pool.FreeList(ref obj); }
public static void BuildingDecayTouch(BuildingBlock buildingBlock) { if (ConVar.Decay.upkeep) { return; } List <DecayEntity> list = Facepunch.Pool.GetList <DecayEntity>(); Vis.Entities <DecayEntity>(buildingBlock.transform.position, 40f, list, 2097408, QueryTriggerInteraction.Collide); for (int i = 0; i < list.Count; i++) { DecayEntity item = list[i]; BuildingBlock buildingBlock1 = item as BuildingBlock; if (!buildingBlock1 || buildingBlock1.buildingID == buildingBlock.buildingID) { item.DecayTouch(); } } Facepunch.Pool.FreeList <DecayEntity>(ref list); }
public static void BuildingDecayTouch(BuildingBlock buildingBlock) { if (ConVar.Decay.upkeep) { return; } List <DecayEntity> list = (List <DecayEntity>)Pool.GetList <DecayEntity>(); Vis.Entities <DecayEntity>(((Component)buildingBlock).get_transform().get_position(), 40f, list, 2097408, (QueryTriggerInteraction)2); for (int index = 0; index < list.Count; ++index) { DecayEntity decayEntity = list[index]; BuildingBlock buildingBlock1 = decayEntity as BuildingBlock; if (!Object.op_Implicit((Object)buildingBlock1) || (int)buildingBlock1.buildingID == (int)buildingBlock.buildingID) { decayEntity.DecayTouch(); } } // ISSUE: cast to a reference type Pool.FreeList <DecayEntity>((List <M0>&) ref list); }