MCPcopy Create free account
hub / github.com/OGSR/OGSR-Engine / OnEvent

Method OnEvent

ogsr_engine/xrGame/Actor_Events.cpp:29–178  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

27#pragma todo("KRodin: заменить на прямые вызовы вместо этих всратых ивентов!")
28
29void CActor::OnEvent(NET_Packet& P, u16 type)
30{
31 inherited::OnEvent(P, type);
32 CInventoryOwner::OnEvent(P, type);
33
34 u16 id;
35 switch (type)
36 {
37 case GE_TRADE_BUY:
38 case GE_OWNERSHIP_TAKE:
39 case GE_TRANSFER_TAKE: {
40 P.r_u16(id);
41 CObject* O = Level().Objects.net_Find(id);
42 if (!O)
43 {
44 Msg("! Error: No object to take/buy [%d]", id);
45 break;
46 }
47
48 CFoodItem* pFood = smart_cast<CFoodItem*>(O);
49 if (pFood)
50 pFood->m_eItemPlace = eItemPlaceRuck;
51
52 CGameObject* _GO = smart_cast<CGameObject*>(O);
53
54 if (inventory().CanTakeItem(smart_cast<CInventoryItem*>(_GO)))
55 {
56 O->H_SetParent(smart_cast<CObject*>(this));
57
58 inventory().Take(_GO, false, true);
59
60 CUIGameSP* pGameSP = NULL;
61 CUI* ui = HUD().GetUI();
62 if (ui && ui->UIGame())
63 {
64 pGameSP = smart_cast<CUIGameSP*>(HUD().GetUI()->UIGame());
65 if (Level().CurrentViewEntity() == this)
66 HUD().GetUI()->UIGame()->ReInitShownUI();
67 };
68
69 //добавить отсоединенный аддон в инвентарь
70 if (pGameSP)
71 {
72 if (pGameSP->MainInputReceiver() == pGameSP->InventoryMenu)
73 {
74 pGameSP->InventoryMenu->AddItemToBag(smart_cast<CInventoryItem*>(O));
75 }
76 }
77 }
78 else
79 {
80 NET_Packet _P;
81 u_EventGen(_P, GE_OWNERSHIP_REJECT, ID());
82 _P.w_u16(u16(O->ID()));
83 u_EventSend(_P);
84 }
85 }
86 break;

Callers

nothing calls this directly

Calls 15

OnEventFunction · 0.85
MsgFunction · 0.85
IDFunction · 0.85
CanTakeItemMethod · 0.80
H_SetParentMethod · 0.80
TakeMethod · 0.80
GetUIMethod · 0.80
UIGameMethod · 0.80
ReInitShownUIMethod · 0.80
AddItemToBagMethod · 0.80
r_eofMethod · 0.80
feel_touch_denyMethod · 0.80

Tested by

no test coverage detected