public bool TryGetStructure(out StructureTag tag) { byte x; byte y; ushort index; StructureRegion region; if (StructureManager.tryGetInfo(Internal.transform, out x, out y, out index, out region)) { tag = new StructureTag(Internal.transform, region.structures[index]); return(true); } tag = null; return(false); }
public bool TryGetStructure(out StructureTag tag) { byte x; byte y; ushort index; StructureRegion region; if (StructureManager.tryGetInfo(Internal.transform, out x, out y, out index, out region)) { tag = new StructureTag(Internal.transform, region.structures[index]); return true; } tag = null; return false; }
public static bool StructureDamaged(Structure structure, ref ushort amount) { // TODO: causes? StructureTag structureTag = new StructureTag(structure); if (amount >= structure.health) { StructureDestroyedEventArgs deathevt = new StructureDestroyedEventArgs(); deathevt.Structure = structureTag; deathevt.Amount = new NumberTag(amount); UnturnedFreneticEvents.OnStructureDestroyed.Fire(deathevt); amount = (ushort)deathevt.Amount.Internal; return deathevt.Cancelled || EntityDestroyed(structureTag, ref amount); } StructureDamagedEventArgs evt = new StructureDamagedEventArgs(); evt.Structure = structureTag; evt.Amount = new NumberTag(amount); UnturnedFreneticEvents.OnStructureDamaged.Fire(evt); amount = (ushort)evt.Amount.Internal; return evt.Cancelled || EntityDamaged(structureTag, ref amount); }