I was wondering if something like this can be done.
UPDATECode:BasePlayer player = ... foreach (Door door in doorlist) //no idea where to loop { // if door is near player then... }
Now I have to find if the door is near the player.Code:var doors = UnityEngine.Object.FindObjectsOfType<Door>(); foreach (Door door in doors) { }
Find doors in range
Discussion in 'Rust Development' started by Reynostrum, Nov 13, 2016.
-
You should be able to use vis.entities which allows you to specify a radius, and then just filter everything in the list that isn't a door.
-
Use BaseEntity.savelist to iterate
[DOUBLEPOST=1479020694][/DOUBLEPOST]FindObject very slow -
As Shady757 said, I would use vis.entities around a player. And convert all to a list with door. You can look in my SmartHomes plugin for a example.
