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 {
1032 {
1034 srcNew.
Copy(e.GetSrc());
1036
1037 Error(
"[syncinv] HandleInputData remote swap event REPLACED with TAKE (cmd=HAND_EVENT, event=" + e.
DumpToString() +
"), src item is null! Continuing.");
1038 }
1039 else
1040 {
1041 #ifdef ENABLE_LOGGING
1043 {
1044 Debug.
InventoryMoveLog(
"Failed - CheckRequestSrc",
"HAND_EVENT" ,
"n/a",
"ProcessInputData", e.m_Player.ToString() );
1045 }
1046 #endif
1047
1048 Error(
"[syncinv] HandleInputData remote input (cmd=HAND_EVENT, event=" + e.
DumpToString() +
") dropped, item not in bubble");
1049
1050 return true;
1051 }
1052 }
1053
1055 if (itemSrc)
1057 if (itemDst)
1059
1064 {
1065 #ifdef ENABLE_LOGGING
1067 {
1068 Debug.
InventoryMoveLog(
"Failed - CheckRequestSrc",
"HAND_EVENT" ,
"n/a",
"ProcessInputData", e.m_Player.ToString() );
1069 }
1070 #endif
1071
1073 {
1076 }
1077
1080
1082 {
1083 success = false;
1084 }
1085 else
1086 {
1087 return true;
1088 }
1089 }
1090
1091 if (success && !e.CheckRequestEx(validation))
1092 {
1093 #ifdef ENABLE_LOGGING
1095 {
1096 Debug.
InventoryMoveLog(
"Failed - CheckRequest",
"HAND_EVENT" ,
"n/a",
"ProcessInputData", e.m_Player.ToString() );
1097 }
1098 #endif
1099
1101
1104
1105#ifdef ENABLE_LOGGING
1107 {
1109 }
1110#endif
1111
1114
1116 {
1117 success = false;
1118 }
1119 else
1120 {
1121 return true;
1122 }
1123 }
1124
1128 {
1129 #ifdef ENABLE_LOGGING
1131 {
1132 Debug.
InventoryMoveLog(
"Failed - CanPerformEvent",
"HAND_EVENT" ,
"n/a",
"ProcessInputData", e.m_Player.ToString() );
1133 }
1134 #endif
1135
1137
1140
1141#ifdef ENABLE_LOGGING
1143 {
1145 }
1146#endif
1147
1150
1152 {
1153 success = false;
1154 }
1155 else
1156 {
1157 return true;
1158 }
1159 }
1160
1163
1166 {
1169 {
1170 #ifdef ENABLE_LOGGING
1172 {
1173 Debug.
InventoryMoveLog(
"Juncture not required",
"HAND_EVENT" ,
"n/a",
"ProcessInputData", e.m_Player.ToString() );
1174 }
1175 #endif
1176
1178 }
1180 {
1181 #ifdef ENABLE_LOGGING
1183 {
1184 Debug.
InventoryMoveLog(
"Juncture sended",
"HAND_EVENT" ,
"n/a",
"ProcessInputData", e.m_Player.ToString() );
1185 }
1186 #endif
1187
1190
1192
1193 if (itemSrc)
1195 if (itemDst)
1197 return true;
1198 }
1199 else
1200 {
1201 #ifdef ENABLE_LOGGING
1203 {
1204 Debug.
InventoryMoveLog(
"Juncture denied",
"HAND_EVENT" ,
"n/a",
"ProcessInputData", e.m_Player.ToString() );
1205 }
1206 #endif
1207
1209 return true;
1210 }
1211 }
1212
1215 {
1217 }
1218
1219 #ifdef ENABLE_LOGGING
1221 {
1222 Debug.
InventoryMoveLog(
"Success - ProcessHandEvent",
"HAND_EVENT" ,
"n/a",
"ProcessInputData", e.m_Player.ToString() );
1223 }
1224 #endif
1225
1226 if (success)
1227 {
1229 if (!e.m_Player.GetHumanInventory().ProcessHandEvent(e))
1230 {
1232
1233 }
1234 }
1235
1236 return true;
1237 }
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.
proto native InventoryLocation Copy(notnull InventoryLocation rhs)
copies location data to another location
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.