Pass partial information to guards so guards can do minimal checks if needed The guards can't prevent event so it would be incorrect to pass full InventoryValidation struct. We have to make sure guards don't inadvertantly produce different results in the FSM as that will create desync (two players attempting to put a rag into the same fireplace slot at the same time)
kumarjac: This indicates a failure in replication relationships as player full inventory should be synchronized always if player exists on the remote
TODO(kumarjac): Is this one correct to be 'RemoveMovableOverride' or are the other Validate methdos wrong with 'EnableMovableOverride'?
Do not check for action validity on remotes or when performing through juncture. Juncture locks guarentee the item is safe to interact with and the server has validated the command at this point. Checking at this point is both wasteful and can result in a failure which leads to desync
if it already happened on server, remote just needs to comply TODO(kumarjac): Move m_IsRemote check to inside of HandEventBase.CanPerformEventEx
Is called twice unfortunately... but it works so won't change
1005 {
1007 bool success = true;
1008
1011
1017
1018 EntityAI itemSrc = e.GetSrcEntity();
1020
1021 #ifdef ENABLE_LOGGING
1023 {
1024 Debug.
InventoryMoveLog(
"STS = " + e.m_Player.GetSimulationTimeStamp() +
" event= " + e.
DumpToString(),
"HAND_EVENT" ,
"n/a",
"ProcessInputData", e.m_Player.ToString() );
1025 }
1026 #endif
1027
1028 if (validation.
m_IsRemote && !e.GetSrcEntity())
1029 {
1031
1032 #ifdef ENABLE_LOGGING
1034 {
1035 Debug.
InventoryMoveLog(
"Failed - CheckRequestSrc",
"HAND_EVENT" ,
"n/a",
"ProcessInputData", e.m_Player.ToString() );
1036 }
1037 #endif
1038
1039 Error(
"[syncinv] HandleInputData remote input (cmd=HAND_EVENT, event=" + e.
DumpToString() +
") dropped, item not in bubble");
1040
1041 return true;
1042 }
1043
1045 if (itemSrc)
1047 if (itemDst)
1049
1054 {
1055 #ifdef ENABLE_LOGGING
1057 {
1058 Debug.
InventoryMoveLog(
"Failed - CheckRequestSrc",
"HAND_EVENT" ,
"n/a",
"ProcessInputData", e.m_Player.ToString() );
1059 }
1060 #endif
1061
1063 {
1066 }
1067
1070
1072 {
1073 success = false;
1074 }
1075 else
1076 {
1077 return true;
1078 }
1079 }
1080
1081 if (success && !e.CheckRequestEx(validation))
1082 {
1083 #ifdef ENABLE_LOGGING
1085 {
1086 Debug.
InventoryMoveLog(
"Failed - CheckRequest",
"HAND_EVENT" ,
"n/a",
"ProcessInputData", e.m_Player.ToString() );
1087 }
1088 #endif
1089
1091
1094
1095#ifdef ENABLE_LOGGING
1097 {
1099 }
1100#endif
1101
1104
1106 {
1107 success = false;
1108 }
1109 else
1110 {
1111 return true;
1112 }
1113 }
1114
1118 {
1119 #ifdef ENABLE_LOGGING
1121 {
1122 Debug.
InventoryMoveLog(
"Failed - CanPerformEvent",
"HAND_EVENT" ,
"n/a",
"ProcessInputData", e.m_Player.ToString() );
1123 }
1124 #endif
1125
1127
1130
1131#ifdef ENABLE_LOGGING
1133 {
1135 }
1136#endif
1137
1140
1142 {
1143 success = false;
1144 }
1145 else
1146 {
1147 return true;
1148 }
1149 }
1150
1153
1156 {
1159 {
1160 #ifdef ENABLE_LOGGING
1162 {
1163 Debug.
InventoryMoveLog(
"Juncture not required",
"HAND_EVENT" ,
"n/a",
"ProcessInputData", e.m_Player.ToString() );
1164 }
1165 #endif
1166
1168 }
1170 {
1171 #ifdef ENABLE_LOGGING
1173 {
1174 Debug.
InventoryMoveLog(
"Juncture sended",
"HAND_EVENT" ,
"n/a",
"ProcessInputData", e.m_Player.ToString() );
1175 }
1176 #endif
1177
1180
1182
1183 if (itemSrc)
1185 if (itemDst)
1187 return true;
1188 }
1189 else
1190 {
1191 #ifdef ENABLE_LOGGING
1193 {
1194 Debug.
InventoryMoveLog(
"Juncture denied",
"HAND_EVENT" ,
"n/a",
"ProcessInputData", e.m_Player.ToString() );
1195 }
1196 #endif
1197
1199 return true;
1200 }
1201 }
1202
1205 {
1207 }
1208
1209 #ifdef ENABLE_LOGGING
1211 {
1212 Debug.
InventoryMoveLog(
"Success - ProcessHandEvent",
"HAND_EVENT" ,
"n/a",
"ProcessInputData", e.m_Player.ToString() );
1213 }
1214 #endif
1215
1216 if (success)
1217 {
1219 if (!e.m_Player.GetHumanInventory().ProcessHandEvent(e))
1220 {
1222
1223 }
1224 }
1225
1226 return true;
1227 }
void syncDebugPrint(string s)
InventoryValidationResult
InventoryValidationReason
void EnableMovableOverride(EntityAI item)
void CheckForRope(InventoryLocation src, InventoryLocation dst)
void RemoveMovableOverride(EntityAI item)
DayZPlayer GetDayZPlayerOwner()
static void InventoryMoveLog(string message=LOG_DEFAULT, string plugin=LOG_DEFAULT, string author=LOG_DEFAULT, string label=LOG_DEFAULT, string entity=LOG_DEFAULT)
override InventoryLocation GetDst()
override bool AcquireInventoryJunctureFromServer(notnull Man player)
override EntityAI GetSecondSrcEntity()
override string DumpToString()
override void ClearInventoryReservation()
override bool CheckRequestSrc()
override bool CanPerformEventEx(InventoryValidation validation)
Abstracted event, not to be used, only inherited.
InventoryValidationResult m_Result
InventoryValidationReason m_Reason
static bool IsSyncLogEnable()
static bool IsInventoryMoveLogEnable()
DayZPlayerInstanceType
defined in C++
proto native DayZPlayerInstanceType GetInstanceType()
void Error(string err)
Messagebox with error message.