static void Postfix(VTEventTarget __instance) { String actionIdentifier = __instance.eventName + __instance.methodName + __instance.targetID + __instance.targetType.ToString(); /*foreach (VTEventTarget.ActionParamInfo aparam in __instance.parameterInfos) * { * actionIdentifier += aparam.name; * }*/ if (!__instance.TargetExists()) { Debug.Log("Target doesn't exist in invoke"); } if (Networker.isHost) { Debug.Log("Host sent Event action" + __instance.eventName + " of type " + __instance.methodName + " for target " + __instance.targetID); if (ObjectiveNetworker_Reciever.reverseScenarioActionsList.ContainsKey(__instance)) { int hash = 0; hash = ObjectiveNetworker_Reciever.reverseScenarioActionsList[__instance]; Message_ScenarioAction ScanarioActionOutMessage = new Message_ScenarioAction(PlayerManager.localUID, hash); NetworkSenderThread.Instance.SendPacketAsHostToAllClients(ScanarioActionOutMessage, Steamworks.EP2PSend.k_EP2PSendReliable); } } else { Debug.Log("Client sent Event action" + __instance.eventName + " of type " + __instance.methodName + " for target " + __instance.targetID); // NetworkSenderThread.Instance.SendPacketToSpecificPlayer(Networker.hostID, ScanarioActionOutMessage, Steamworks.EP2PSend.k_EP2PSendUnreliable); } }
static bool Prefix(VTEventInfo __instance, ConfigNode infoNode) { Debug.Log("bahacode scenario dictionary"); __instance.eventName = infoNode.GetValue("eventName"); __instance.actions = new List <VTEventTarget>(); foreach (ConfigNode node in infoNode.GetNodes("EventTarget")) { VTEventTarget vTEventTarget = new VTEventTarget(); vTEventTarget.LoadFromNode(node); __instance.actions.Add(vTEventTarget); Debug.Log("Compiling scenario dictonary my codd2"); String actionIdentifier = __instance.eventName + vTEventTarget.eventName + vTEventTarget.methodName + vTEventTarget.targetID + vTEventTarget.targetType.ToString(); /*foreach(VTEventTarget.ActionParamInfo aparam in vTEventTarget.parameterInfos) * { * actionIdentifier+= aparam.name; * }*/ Debug.Log(actionIdentifier); int hash = actionIdentifier.GetHashCode(); Debug.Log("Compiling scenario dictonary adding to my dictionary"); if (!ObjectiveNetworker_Reciever.scenarioActionsList.ContainsKey(hash)) { ObjectiveNetworker_Reciever.scenarioActionsList.Add(hash, vTEventTarget); } if (!ObjectiveNetworker_Reciever.reverseScenarioActionsList.ContainsKey(vTEventTarget)) { ObjectiveNetworker_Reciever.reverseScenarioActionsList.Add(vTEventTarget, hash); } } return(false);//dont run bahas code }
static bool Prefix(VTEventTarget __instance) { if (Networker.isHost) { return(true); } else { if (__instance.targetType == VTEventTarget.TargetTypes.System) { bool shouldComplete = ObjectiveNetworker_Reciever.completeNextEvent; Debug.Log($"Should complete is {shouldComplete}."); ObjectiveNetworker_Reciever.completeNextEvent = false; return(shouldComplete);// clients should not send kill obj packets or have them complete } } return(false); }