Energy manager: Returns true if this device's virtual power cord can reach its energy source at the given position, depending on its cordLength config parameter. Otherwise returns false.
- Аргументы
-
from_position | vector position from where the measurement will be taken |
add_tolerance | float parameter will add to the cord's length in meters (optional) |
- Возвращает
bool
True if the power source will be at reach for the plug, or if config param cordLength is absent or 0. False if not, or is not plugged, or this device lacks Energy Manager component.
if ( my_device.GetCompEM().IsEnergySourceAtReach( position_player ) )
{
Print(
"Power source is at reach!");
}else{
Print(
"Power source is NOT at reach!");
}
proto native DayZPlayer GetPlayer()
proto native CGame GetGame()
proto void Print(void var)
Prints content of variable to console/log.
См. определение в файле ComponentEnergyManager.c строка 1031
1032 {
1033 if ( !
IsPlugged() && override_source_position ==
"-1 -1 -1" )
1034 {
1035 return false;
1036 }
1037
1039 {
1040 return true;
1041 }
1042
1043 vector source_pos;
1044 float distance;
1045
1046 if ( override_source_position == "-1 -1 -1" )
1047 {
1049
1050 if (!energy_source)
1051 return false;
1052
1053 source_pos = energy_source.GetPosition();
1054 distance = vector.Distance( from_position, source_pos );
1055 }
1056 else
1057 {
1058 source_pos = override_source_position;
1059 distance = vector.Distance( from_position, source_pos );
1060 }
1061
1063 {
1064 return false;
1065 }
1066 else
1067 {
1068 return true;
1069 }
1070 }
bool IsPlugged()
Energy manager: Returns true if this device is plugged into some other device (even if they are OFF o...
EntityAI GetEnergySource()
Energy manager: Returns the energy source this device is plugged into.
float GetCordLength()
Energy manager: Returns the length of the virtual power cord.
Перекрестные ссылки vector::Distance(), GetCordLength(), GetEnergySource() и IsPlugged().
Используется в Hologram::CorrectMaterialPathName() и UpdatePlugState().