716 : ActionReciveData
717{
719}
720
722{
724};
725
727{
729 {
731 m_ActionData.m_ActionComponent =
new CAContinuousTime(time);
732 }
733
735 {
736 #ifdef DIAG_DEVELOPER
737 if (
m_ActionData.m_Player.GetConstructionActionData().GetFastConstructionMode() == EConstructionDebugModes.FAST)
738 return 1;
739 #endif
740
741 if (item)
742 return UATimeSpent.BASEBUILDING_CONSTRUCT_MEDIUM;
743 else
744 return UATimeSpent.BASEBUILDING_CONSTRUCT_SLOW;
745 }
746};
747
749{
751 {
756
760 }
761
763 {
766 }
767
769 {
770 ConstructionActionData cad = player.GetConstructionActionData();
772 if (part)
773 {
775 if (overrideText ==
string.
Empty)
777 else
779
780 #ifdef DIAG_DEVELOPER
781 if (DiagMenu.GetBool(
DiagMenuIDs.BASEBUILDING_FULLDEBUG))
782 {
784 }
785 #endif
786 }
787 }
788
790 {
791 m_InfoData =
new ActionInfoDataConstructionPossible();
792 }
793
795 {
796 return false;
797 }
798
800 {
801 return false;
802 }
803
805 {
806 #ifdef DIAG_DEVELOPER
807 if (player.GetConstructionActionData().GetFastConstructionMode() == EConstructionDebugModes.INSTANT)
808 return false;
809 #endif
810
812 if (!Class.CastTo(ent,target.GetObject()))
813 return false;
814
815 if (player.IsPlacingLocal() || player.IsPlacingServer())
816 return false;
817
818
819 if (player.GetBrokenLegs() ==
eBrokenLegs.BROKEN_LEGS)
820 return false;
821
822 if (!ent.CanUseConstruction() || !ent.CanUseConstructionBuild())
823 return false;
824
825 if ((!
GetGame().IsDedicatedServer()))
826 {
828 return false;
829
830 if (MiscGameplayFunctions.ComplexBuildCollideCheckClient(player, target, item,
m_VariantID))
832
833 return false;
834 }
835 return true;
836 }
837
839 {
842 string part_name = BuildPartActionData.Cast(action_data).m_PartType;
844
845 check_data.m_PartName = part_name;
847
848 bool canBuild = construction.CanBuildPart(part_name, action_data.
m_MainItem,
true);
849 #ifdef DIAG_DEVELOPER
850 if (action_data.
m_Player.GetConstructionActionData().GetFastConstructionMode())
851 canBuild = true;
852 #endif
854 {
855 bool collides = construction.IsCollidingEx(check_data);
856
857 return !collides && canBuild;
858 }
859 else
860 {
861 return canBuild;
862 }
863 }
864
866 {
869
870 string partName = BuildPartActionData.Cast(action_data).m_PartType;
873
874 checkData.m_PartName = partName;
876
878 #ifdef DIAG_DEVELOPER
879 if (action_data.
m_Player.GetConstructionActionData().GetFastConstructionMode())
880 canBuild = true;
881 #endif
882 if (!construction.IsCollidingEx(checkData) && canBuild)
883 {
884
886
887 #ifdef DIAG_DEVELOPER
888
889 if (action_data.
m_Player.GetConstructionActionData().GetFastConstructionMode())
890 return;
891 #endif
892
893
895 {
897 action_data.
m_MainItem.DecreaseHealth(UADamageApplied.BUILD,
false);
898 }
899 else
900 {
902 {
903 EntityAI gloves = action_data.
m_Player.GetInventory().FindAttachment(InventorySlots.GLOVES);
904 if (gloves && gloves.GetHealthLevel() < 4)
905 {
906 gloves.AddHealth("","", PlayerConstants.GLOVES_DAMAGE_HAND_CONSTRUCTION);
907 }
908 else if (Math.RandomFloat01() < PlayerConstants.CHANCE_TO_BLEED_HAND_CONSTRUCTION)
909 {
910 if (Math.RandomFloat01() < 0.5)
911 action_data.
m_Player.GetBleedingManagerServer().AttemptAddBleedingSourceBySelection(
"LeftForeArmRoll");
912 else
913 action_data.
m_Player.GetBleedingManagerServer().AttemptAddBleedingSourceBySelection(
"RightForeArmRoll");
915 }
916 }
917 }
918 }
919 }
920
922 {
923 return "Base_building";
924 }
925
927 {
928 BuildPartActionData action_data = new BuildPartActionData;
929 return action_data;
930 }
931
932
934 {
935 if (super.SetupAction(player, target, item, action_data, extra_data))
936 {
937 if (!
g_Game.IsDedicatedServer())
938 {
940 }
941
943 return true;
944 }
945
946 return false;
947 }
948
950 {
951 ConstructionActionData cad = action_data.m_Player.GetConstructionActionData();
953 BuildPartActionData.Cast(action_data).m_PartType = part.
GetPartName();
954 }
955
957 {
958 if (!item)
959 return;
960
961 switch (item.Type())
962 {
963 case Pickaxe:
964 case Shovel:
965 case FarmingHoe:
966 case FieldShovel:
968 break;
969 case Pliers:
971 break;
972 case SledgeHammer:
974 break;
975 case BrickTrowel:
977 break;
978 default:
980 break;
981 }
982 }
983
985 {
986 super.WriteToContext(ctx, action_data);
987
988 ctx.
Write(BuildPartActionData.Cast(action_data).m_PartType);
989 }
990
992 {
993 action_recive_data = new BuildPartActionReciveData;
994 super.ReadFromContext(ctx, action_recive_data);
995
996 string part_type;
997 if (ctx.
Read(part_type))
998 {
999 BuildPartActionReciveData.Cast(action_recive_data).m_PartType = part_type;
1000 return true;
1001 }
1002 else
1003 {
1004 return false;
1005 }
1006 }
1007
1008 override void HandleReciveData(ActionReciveData action_recive_data, ActionData action_data)
1009 {
1010 super.HandleReciveData(action_recive_data, action_data);
1011
1012 BuildPartActionData.Cast(action_data).m_PartType = BuildPartActionReciveData.Cast(action_recive_data).m_PartType;
1013 }
1014
1016 {
1017 string partName = BuildPartActionData.Cast(action_data).m_PartType;
1018
1019 string itemName = "hands";
1021 itemName = action_data.
m_MainItem.GetDisplayName();
1022
1023 string message =
string.Format(
"Built %1 on %2 with %3", partName, action_data.
m_Target.GetObject().GetDisplayName(), itemName);
1024 return message;
1025 }
1026
1028 {
1030 }
1031
1033 {
1035
1036 ActionInfoDataConstructionPossible info = ActionInfoDataConstructionPossible.Cast(
m_InfoData);
1037 ConstructionActionData cad = player.GetConstructionActionData();
1039 info.SetConstructionPart(part);
1040 info.SetTool(item);
1041
1044
1045 return info.CanDisplayInfo();
1046 }
1047
1050 {
1053 ConstructionActionData cad = player.GetConstructionActionData();
1055
1056 if (part)
1057 {
1059 if (!ent.IsPlayerInsideEx(player, part.
GetPartName()))
1060 {
1062 return false;
1063 else if (!bbb)
1064 return false;
1065 }
1066 if (!construction.ConstructionDirectionCheck(player, part, EConstructionDirCheckType.INDOORS))
1067 return false;
1068 if (!construction.ConstructionInsiderBoxCheck(player, part))
1069 return false;
1070
1071 return true;
1072 }
1073 return false;
1074 }
1075
1078 {
1080 }
1081
1083
1085 [
Obsolete(
"Use 'SetBuildingAnimationEx' instead")]
1087 {
1089 }
1090}
1091
1093{
1095 {
1097 }
1098
1100 {
1103 }
1104
1106 {
1107 return false;
1108 }
1109
1111 {
1112 ConstructionActionData cad = player.GetConstructionActionData();
1114 if (part)
1115 {
1117 if (overrideText ==
string.
Empty)
1119 else
1121
1122 #ifdef DIAG_DEVELOPER
1123 if (DiagMenu.GetBool(
DiagMenuIDs.BASEBUILDING_FULLDEBUG))
1124 {
1126 }
1127 #endif
1128 }
1129 }
1130
1132 {
1133 #ifdef DIAG_DEVELOPER
1134 if (player.GetConstructionActionData().GetFastConstructionMode() == EConstructionDebugModes.INSTANT)
1135 return false;
1136 #endif
1137
1138 if (item)
1139 return false;
1140
1142 if (!Class.CastTo(ent,target.GetObject()))
1143 return false;
1144
1145 if (player.IsPlacingLocal() || player.IsPlacingServer())
1146 return false;
1147
1148
1149 if (player.GetBrokenLegs() ==
eBrokenLegs.BROKEN_LEGS)
1150 return false;
1151
1152 bool handConstructionCondition = ent.CanUseHandConstruction();
1153 #ifdef DIAG_DEVELOPER
1154 if (player.GetConstructionActionData().GetFastConstructionMode())
1155 handConstructionCondition = true;
1156 #endif
1157
1158 if (!ent.CanUseConstruction() || !ent.CanUseConstructionBuild() || !handConstructionCondition)
1159 return false;
1160
1161 if ((!
GetGame().IsDedicatedServer()))
1162 {
1164 return false;
1165
1166 if (MiscGameplayFunctions.ComplexBuildCollideCheckClient(player, target, item,
m_VariantID))
1168
1169 return false;
1170 }
1171 return true;
1172 }
1173
1175 {
1178 string part_name = BuildPartActionData.Cast(action_data).m_PartType;
1180
1181 check_data.m_PartName = part_name;
1183
1184 bool canBuild = construction.CanBuildPart(part_name, null, false);
1185 #ifdef DIAG_DEVELOPER
1186 if (action_data.
m_Player.GetConstructionActionData().GetFastConstructionMode())
1187 canBuild = true;
1188 #endif
1190 {
1191 bool collides = construction.IsCollidingEx(check_data);
1192
1193 return !collides && canBuild;
1194 }
1195 else
1196 {
1197 return canBuild;
1198 }
1199 }
1200
1202 {
1204
1205 ActionInfoDataConstructionPossible info = ActionInfoDataConstructionPossible.Cast(
m_InfoData);
1206 ConstructionActionData cad = player.GetConstructionActionData();
1208 info.SetConstructionPart(part);
1209 info.SetTool(item);
1210
1212
1213
1214
1215
1216
1217
1219
1220 return info.CanDisplayInfo();
1221 }
1222
1224 {
1225 ConstructionActionData cad = action_data.m_Player.GetConstructionActionData();
1227 }
1228
1231 {
1233 }
1234
1237 {
1238 if (item)
1239 return;
1240
1241 BuildPartActionData buildData;
1242 if (Class.CastTo(buildData, action_data))
1243 {
1246 ConstructionPart part = construction.GetConstructionPart(buildData.m_PartType);
1248
1249 if (animOverrideID >= 0)
1250 m_CommandUID = animOverrideID;
1251 else
1253 }
1254 }
1255}
1256
1257
bool ActionConditionContinue(ActionData action_data)
ref ActionInfoDataBase m_InfoData
void OnActionInfoUpdate(PlayerBase player, ActionTarget target, ItemBase item)
void CreateConditionComponents()
ref CCIBase m_ConditionItem
ref CCTBase m_ConditionTarget
bool ActionCondition(PlayerBase player, ActionTarget target, ItemBase item)
BuildPartActionReciveData m_PartType
void ComposeBuildActionDataClient(PlayerBase player, ActionTarget target, ItemBase item, out ActionData action_data, Param extra_data=NULL)
bool GatherInfoData(PlayerBase player, ActionTarget target, ItemBase item)
bool PositioningCheck(PlayerBase player, ActionTarget target)
Can build from the inside only, if applicable.
override bool UseMainItem()
ConstructionPart GetTargetPart(ConstructionActionData cad)
Does not work on server, since variants are not updated there (invoker does not invoke)
ActionBuildPart ActionContinuousBase ActionBuildPartHandsGeneric()
void SetBuildingAnimationEx(PlayerBase player, ActionTarget target, ItemBase item, ActionData action_data, Param extra_data=NULL)
here we base anims on targeted part
void ActionTarget(Object object, Object parent, int componentIndex, vector cursorHitPos, float utility, string surfaceName="")
void ConstructionBase(EntityAI parent)
void CollisionCheckData()
EConstructionInfoCategories
void ConstructionPart(string name, string part_name, string main_part_name, int id, bool is_built, bool is_base, bool is_gate, array< string > required_parts)
class GP5GasMask extends MaskBase ItemBase
override bool SetupAction(PlayerBase player, ActionTarget target, ItemBase item, out ActionData action_data, Param extra_data=NULL)
override bool CanBeUsedInFreelook()
void ComposeBuildActionDataClient(PlayerBase player, ActionTarget target, ItemBase item, out ActionData action_data, Param extra_data=NULL)
override bool CanBeUsedLeaning()
bool PositioningCheck(PlayerBase player, ActionTarget target)
Can build from the inside only, if applicable.
override void CreateConditionComponents()
override string GetSoundCategory(ActionData action_data)
override bool ReadFromContext(ParamsReadContext ctx, out ActionReciveData action_recive_data)
void SetBuildingAnimation(ItemBase item)
override bool ActionConditionContinue(ActionData action_data)
override bool ActionCondition(PlayerBase player, ActionTarget target, ItemBase item)
void SetBuildingAnimationEx(PlayerBase player, ActionTarget target, ItemBase item, ActionData action_data, Param extra_data=NULL)
override ActionData CreateActionData()
ConstructionPart GetTargetPart(ConstructionActionData cad)
Does not work on server, since variants are not updated there (invoker does not invoke)
override void WriteToContext(ParamsWriteContext ctx, ActionData action_data)
override void InitInfoData()
override string GetAdminLogMessage(ActionData action_data)
override void OnFinishProgressServer(ActionData action_data)
bool GatherInfoData(PlayerBase player, ActionTarget target, ItemBase item)
override void HandleReciveData(ActionReciveData action_recive_data, ActionData action_data)
override void OnActionInfoUpdate(PlayerBase player, ActionTarget target, ItemBase item)
float SetCallbackDuration(ItemBase item)
override void CreateActionComponent()
ref ActionTarget m_Target
override bool MustBeBuiltFromOutside()
ConstructionPart GetBuildPartHandsGenericAtIndex(int idx)
ConstructionPart GetBuildPartAtIndex(int idx)
int GetHandBuildFBAnimOverride()
string GetBuildTextOverride()
bool DamageHandsOnBuild()
proto bool Write(void value_out)
proto bool Read(void value_in)
DayZPlayerConstants
defined in C++
Serializer ParamsReadContext
Serializer ParamsWriteContext
void Obsolete(string msg="")
proto void Insert(int index, string input)
Inserts a string into the n-th index, increasing the string length by the size of the input.