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

◆ OnRPCHealthSet()

void PluginBase::OnRPCHealthSet ( ParamsReadContext ctx,
PlayerBase player )
inlineprotected

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

655 {
656 Param3<int, string, string> p = new Param3<int, string, string>( 0, "", "" );
657 if ( !ctx.Read(p) )
658 return;
659
660 int buttonID = p.param1;
661 string zoneName = p.param2;
662 string healthType = p.param3;
663
664 if (buttonID > 3) // target change only
665 {
666 if (buttonID == 4) // ButtonTarget
667 m_HealthObserverMode.Set(player, true);
668 else if (buttonID == 5) // ButtonSelf
669 m_HealthObserverMode.Set(player, false);
670
671 return;
672 }
673
674 EntityAI target;
675 if (m_HealthObserverMode.Get(player) == false)
676 target = player;
677 else
678 {
680 target = EntityAI.Cast(itemDiagPlugin.GetWatchedItem(player));
681 }
682
683 if (zoneName == "Global")
684 zoneName = "";
685
686 float zoneMax = target.GetMaxHealth(zoneName, healthType);
687 float zoneCurrentHealth = target.GetHealth(zoneName, healthType);
688 float targetHealth;
689
690 if (buttonID == 0) // ButtonMin
691 targetHealth = 0;
692 else if (buttonID == 1) // ButtonMax
693 targetHealth = zoneMax;
694 else if (buttonID == 2) // ButtonAdd
695 targetHealth = zoneCurrentHealth + zoneMax * 0.1;
696 else if (buttonID == 3) // ButtonSubtract
697 targetHealth = zoneCurrentHealth - zoneMax * 0.1;
698
699 target.SetHealth(zoneName, healthType, targetHealth);
700 }
class LogManager EntityAI
void PluginItemDiagnostic()
Определения PluginItemDiagnostic.c:74
PluginBase GetPlugin(typename plugin_type)
Определения PluginManager.c:316
ref map< PlayerBase, bool > m_HealthObserverMode
Определения PluginDeveloperSync.c:42
proto bool Read(void value_in)

Перекрестные ссылки GetPlugin(), m_HealthObserverMode, PluginItemDiagnostic() и Serializer::Read().

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