How to check is entity in Rad Town zone?
Code:private void GetObjects() { var allEntites = UnityEngine.Object.FindObjectsOfType<BaseCombatEntity>(); foreach (var entity in allEntites) { if (entity.isDestroyed) continue; // ? } }
Solved Checking if entity is in Rad Town zone?
Discussion in 'Rust Development' started by azalea`, Feb 24, 2016.
-
You could use the monuments location and do a distance check if you know what the entity is, or search for all entities within a radius and filter out what you need
Check out MonumentRadiation to see how I get monument locations
Off the top of my head this is how you check distance between 2 objects using their Vector3 position.
Code:var distance = Vector3.Distance(position1, position2) if (distance < something) //do stuff
Or to get a list of every entity with a radius of a position
Code:List<BaseEntity> entitiesWithinRadius = new List<BaseEntity>(); Vis.Entities(position, radius, out entitiesWithinRadius)
-
Thank you. I thought that is possible to check the RT no-build zone with some flags
[DOUBLEPOST=1456387063][/DOUBLEPOST]Also, yesterday accidentally I'm removed RT objects (research tables and etc) and some players entity's (their cant spawn or move), how I can restore it?Last edited by a moderator: Feb 25, 2016 -
You need a test server