25 SetFlags(EntityFlags.ACTIVE,
true);
26 SetEventMask(EntityEvent.FRAME);
31 protected override void EOnFrame(IEntity owner,
float timeSlice)
71 DbgUI.Begin(
"Send Info Message");
75 IEntity ent = GetSelectedAiEntity();
76 DbgUI.Text(
string.Format(
"Selected Entity: %1", ent.ToString()));
80 AIControlComponent controlComp = AIControlComponent.Cast(ent.FindComponent(AIControlComponent));
81 AIAgent senderAgent = controlComp.GetAIAgent();
83 const int buttonWidth = 500;
84 if (DbgUI.Button(
"INFO: NO AMMO -> GROUP", buttonWidth))
85 SendNoAmmoToGroup(ent, senderAgent);
89 DbgUI.Text(
"You must select an AI Entity with Game Master first!");
100 AIControlComponent controlComp = AIControlComponent.Cast(senderEnt.FindComponent(AIControlComponent));
101 AIAgent senderAgent = controlComp.GetAIAgent();
102 AICommunicationComponent mailbox = senderAgent.GetCommunicationComponent();
111 protected void BroadcastMessage(AIAgent senderAgent,
SCR_AIMessageBase msg, AIAgent receiver)
113 AICommunicationComponent mailbox = senderAgent.GetCommunicationComponent();
115 mailbox.RequestBroadcast(msg, receiver);
120 protected IEntity GetSelectedAiEntity()
124 set<SCR_EditableEntityComponent> selectedEntities =
new set<SCR_EditableEntityComponent>();
125 filter.GetEntities(selectedEntities);
127 if (selectedEntities.Count() != 1)
130 SCR_EditableCharacterComponent editCharacterComp = SCR_EditableCharacterComponent.Cast(selectedEntities[0]);
132 if (!editCharacterComp)
135 return editCharacterComp.GetAgent().GetControlledEntity();
142 protected void SendNoAmmoToGroup(IEntity senderEnt, AIAgent senderAgent)
146 msg.m_entityToSupply = senderEnt;
149 auto weaponManager = BaseWeaponManagerComponent.Cast(senderEnt.FindComponent(BaseWeaponManagerComponent));
152 Print(
string.Format(
"SendNoAmmoToGroup: %1, %2", senderEnt.ToString(), msg.m_MagazineWell.ToString()), LogLevel.DEBUG);
154 AIAgent receiver = senderAgent.GetParentGroup();
155 BroadcastMessage(senderAgent, msg, receiver);