Skip to content

Eco.EM.Framework.Helpers

Kye edited this page Sep 19, 2022 · 1 revision

Helpers


Here you will find the documentation on the features in the Helpers part of the framework.

Documentation may be incomplete and might need additions, we will update this when we can.

Usage:

using Eco.EM.Framework.Helpers;

Our Helpers have a couple of little features included, some like Sensors, Player Sensor and Daylight Sensor (this may need to be changed a little to work properly)

Compare - Compares string value1 and string value2

ie:

IsLike(Input, Value) - This returns a bool ( true | false )
String 1 and string 2 are converted to lower to ensure proper matching.

Is Day light - A daylight sensor component

Returns true or false if its daylight good for items that need to know if its daylight or not,

IsDaylight(int DayTime = 7, int NightTime = 19)

Player Sensors - Player sensors have a few different types of sensors:

Anyone Near sensor - Detects if anyone is near the sensory object (distance can be set)
Authorized Player Sensor - Detects if the person near is authorized and should function if they are
Anyone in the same room sensor - Checks if anyone is in the same room as the sensor

Usage:

All 3 are bools, so they only return true or false.

AnyoneNear(WorldObject obj, int MaxSensorDistance = 20) - Default is 20 blocks but you can change it too what you like
AuthorizedPersonnelNear(WorldObject obj, int MaxSensorDistance = 20) - Default is 20 blocks but you can change it too what you like
AnyoneInSameRoom(WorldObject obj, int MaxSensorDistance = 20) - Default is 20 blocks but you can change it too what you like

Sensors - These are the sensors already put into actions of our own

Motion Sensor: Detections for motion in the room Used on lights or Misc ( In unity uses Animated States: IsOff and IsOn )

Proximity Sensor: Detects if someone is near the sensor, used on lights or misc ( In unity uses Animated States: IsOff and IsOn )

Authorized Sensor: Detects if the user is Authorized and then operates based on that ( In unity uses Animated States: IsOff and IsOn )

Usage:

Sensors.MotionSensor(WorldObject object | this, float range)
Sensors.ProximitySensor(WorldObject object | this, float range)
Sensors.AuthorizedSensor(WorldObject object | this, float range)

Ways to use:

public float Range = 10f; // this is done in blocks
public override void Tick()
{
    Sensors.Sensor( this, Range );
}
Clone this wiki locally