[Library] Proximity Sensor 0.80

Due to human (non-bot) spam the first contribution of a user has to be reviewed and activated manually, all further contributions do not require this.
As long as a user does not have at least one reviewed and activated contribution, the user is unable to edit his profile, set a avatar, title picture or a signature.

Class to give you some informations when a player is near a WorldObject

Proximity Sensor v0.80
(This version works with 7.2 and 7.3 servers.)

Details :

This DLL is not a Mod, You have to add it as a Reference in your Visual Studio Project.

Namespace : Eco.ProximitySensor

Functions :

  • [ICODE]bool IsAnyone(this WorldObject Obj, int SensorDistance = 20)[/ICODE]
  • [ICODE]IEnumerable<User> GetAnyone(this WorldObject Obj, int SensorDistance = 20)[/ICODE]

You can implement it in your WorldObject by adding :

  • [ICODE]using Eco.ProximitySensor;[/ICODE]

And in you WorldObject declaration, you could add this override :

public override void Tick()
    if (this.IsAnyone())       // Return true if any player is near the object.
        foreach (User user in this.GetAnyone())      // Return a list of all players in range.


This code is here as an exemple, take care with Tick() which is called 10 times / second ! So don't put a chat message here, for exemple, this will flood the chat and i'm sure this is not what you would.

Sources :
Source code is provided on GitHub, follow this link : https://github.com/geeknessfr/ProximitySensor