DayZ 1.29
DayZ Explorer by KGB
 
Загрузка...
Поиск...
Не найдено

◆ HasFreeSocket()

bool ComponentEnergyManager::HasFreeSocket ( int socket_id = -1)
inlineprotected

Energy manager: Returns true if this device has any free socket to receive a plug. If optional parameter socket_id is provided then only that socket ID is checked.

См. определение в файле ComponentEnergyManager.c строка 955

956 {
957 if (socket_id == -1)
958 {
959 int plugged_devices = GetPluggedDevicesCount();
960 int plugged_devices_limit = GetSocketsCount();
961
962 if ( plugged_devices < plugged_devices_limit )
963 {
964 return true;
965 }
966
967 return false;
968 }
969 else
970 {
971 EntityAI device = GetDeviceBySocketID(socket_id);
972
973 if (device)
974 {
975 return false;
976 }
977 else
978 {
979 return true;
980 }
981 }
982 }
class LogManager EntityAI
int GetPluggedDevicesCount()
Energy manager: Returns the number of devices plugged into this one.
Определения ComponentEnergyManager.c:1201
int GetSocketsCount()
Energy manager: Returns the count of power sockets (whenever used or not)
Определения ComponentEnergyManager.c:1147
EntityAI GetDeviceBySocketID(int id)
Energy manager: Returns the device which is plugged into the given socket ID.
Определения ComponentEnergyManager.c:1343

Перекрестные ссылки GetDeviceBySocketID(), GetPluggedDevicesCount() и GetSocketsCount().

Используется в CanReceivePlugFrom().