638 : ActionReciveData
639{
641}
642
644{
646};
647
649{
651 {
653 m_ActionData.m_ActionComponent =
new CAContinuousTime(time);
654 }
655
657 {
658 #ifdef DIAG_DEVELOPER
659 if (
m_ActionData.m_Player.GetConstructionActionData().GetFastConstructionMode() == EConstructionDebugModes.FAST)
660 return 1;
661 #endif
662
663 if (item)
664 return UATimeSpent.BASEBUILDING_CONSTRUCT_MEDIUM;
665 else
666 return UATimeSpent.BASEBUILDING_CONSTRUCT_SLOW;
667 }
668};
669
671{
673 {
678
682 }
683
685 {
688 }
689
691 {
692 ConstructionActionData cad = player.GetConstructionActionData();
694 if (part)
695 {
697 if (overrideText ==
string.
Empty)
699 else
701
702 #ifdef DIAG_DEVELOPER
703 if (DiagMenu.GetBool(
DiagMenuIDs.BASEBUILDING_FULLDEBUG))
704 {
706 }
707 #endif
708 }
709 }
710
712 {
713 m_InfoData =
new ActionInfoDataConstructionPossible();
714 }
715
717 {
718 return false;
719 }
720
722 {
723 return false;
724 }
725
727 {
728 #ifdef DIAG_DEVELOPER
729 if (player.GetConstructionActionData().GetFastConstructionMode() == EConstructionDebugModes.INSTANT)
730 return false;
731 #endif
732
734 if (!Class.CastTo(ent,target.GetObject()))
735 return false;
736
737 if (player.IsPlacingLocal() || player.IsPlacingServer())
738 return false;
739
740
741 if (player.GetBrokenLegs() ==
eBrokenLegs.BROKEN_LEGS)
742 return false;
743
744 if (!ent.CanUseConstruction() || !ent.CanUseConstructionBuild())
745 return false;
746
747 if ((!
GetGame().IsDedicatedServer()))
748 {
750 return false;
751
752 if (MiscGameplayFunctions.ComplexBuildCollideCheckClient(player, target, item,
m_VariantID))
754
755 return false;
756 }
757 return true;
758 }
759
761 {
764 string part_name = BuildPartActionData.Cast(action_data).m_PartType;
766
767 check_data.m_PartName = part_name;
769
770 bool canBuild = construction.CanBuildPart(part_name, action_data.
m_MainItem,
true);
771 #ifdef DIAG_DEVELOPER
772 if (action_data.
m_Player.GetConstructionActionData().GetFastConstructionMode())
773 canBuild = true;
774 #endif
776 {
777 bool collides = construction.IsCollidingEx(check_data);
778
779 return !collides && canBuild;
780 }
781 else
782 {
783 return canBuild;
784 }
785 }
786
788 {
791
792 string partName = BuildPartActionData.Cast(action_data).m_PartType;
795
796 checkData.m_PartName = partName;
798
800 #ifdef DIAG_DEVELOPER
801 if (action_data.
m_Player.GetConstructionActionData().GetFastConstructionMode())
802 canBuild = true;
803 #endif
804 if (!construction.IsCollidingEx(checkData) && canBuild)
805 {
806
808
809 #ifdef DIAG_DEVELOPER
810
811 if (action_data.
m_Player.GetConstructionActionData().GetFastConstructionMode())
812 return;
813 #endif
814
815
817 {
819 action_data.
m_MainItem.DecreaseHealth(UADamageApplied.BUILD,
false);
820 }
821 else
822 {
824 {
825 EntityAI gloves = action_data.
m_Player.GetInventory().FindAttachment(InventorySlots.GLOVES);
826 if (gloves && gloves.GetHealthLevel() < 4)
827 {
828 gloves.AddHealth("","", PlayerConstants.GLOVES_DAMAGE_HAND_CONSTRUCTION);
829 }
830 else if (Math.RandomFloat01() < PlayerConstants.CHANCE_TO_BLEED_HAND_CONSTRUCTION)
831 {
832 if (Math.RandomFloat01() < 0.5)
833 action_data.
m_Player.GetBleedingManagerServer().AttemptAddBleedingSourceBySelection(
"LeftForeArmRoll");
834 else
835 action_data.
m_Player.GetBleedingManagerServer().AttemptAddBleedingSourceBySelection(
"RightForeArmRoll");
837 }
838 }
839 }
840 }
841 }
842
844 {
845 return "Base_building";
846 }
847
849 {
850 BuildPartActionData action_data = new BuildPartActionData;
851 return action_data;
852 }
853
854
856 {
857 if (super.SetupAction(player, target, item, action_data, extra_data))
858 {
859 if (!
g_Game.IsDedicatedServer())
860 {
862 }
863
865 return true;
866 }
867
868 return false;
869 }
870
872 {
873 ConstructionActionData cad = action_data.m_Player.GetConstructionActionData();
875 BuildPartActionData.Cast(action_data).m_PartType = part.
GetPartName();
876 }
877
879 {
880 if (!item)
881 return;
882
883 switch (item.Type())
884 {
885 case Pickaxe:
886 case Shovel:
887 case FarmingHoe:
888 case FieldShovel:
890 break;
891 case Pliers:
893 break;
894 case SledgeHammer:
896 break;
897 case BrickTrowel:
899 break;
900 default:
902 break;
903 }
904 }
905
907 {
908 super.WriteToContext(ctx, action_data);
909
910 ctx.
Write(BuildPartActionData.Cast(action_data).m_PartType);
911 }
912
914 {
915 action_recive_data = new BuildPartActionReciveData;
916 super.ReadFromContext(ctx, action_recive_data);
917
918 string part_type;
919 if (ctx.
Read(part_type))
920 {
921 BuildPartActionReciveData.Cast(action_recive_data).m_PartType = part_type;
922 return true;
923 }
924 else
925 {
926 return false;
927 }
928 }
929
930 override void HandleReciveData(ActionReciveData action_recive_data, ActionData action_data)
931 {
932 super.HandleReciveData(action_recive_data, action_data);
933
934 BuildPartActionData.Cast(action_data).m_PartType = BuildPartActionReciveData.Cast(action_recive_data).m_PartType;
935 }
936
938 {
939 string partName = BuildPartActionData.Cast(action_data).m_PartType;
940
941 string itemName = "hands";
943 itemName = action_data.
m_MainItem.GetDisplayName();
944
945 string message =
string.Format(
"Built %1 on %2 with %3", partName, action_data.
m_Target.GetObject().GetDisplayName(), itemName);
946 return message;
947 }
948
950 {
952 }
953
955 {
957
958 ActionInfoDataConstructionPossible info = ActionInfoDataConstructionPossible.Cast(
m_InfoData);
959 ConstructionActionData cad = player.GetConstructionActionData();
961 info.SetConstructionPart(part);
962 info.SetTool(item);
963
966
967 return info.CanDisplayInfo();
968 }
969
972 {
975 ConstructionActionData cad = player.GetConstructionActionData();
977
978 if (part)
979 {
981 if (!ent.IsPlayerInsideEx(player, part.
GetPartName()))
982 {
984 return false;
985 else if (!bbb)
986 return false;
987 }
988 if (!construction.ConstructionDirectionCheck(player, part, EConstructionDirCheckType.INDOORS))
989 return false;
990 if (!construction.ConstructionInsiderBoxCheck(player, part))
991 return false;
992
993 return true;
994 }
995 return false;
996 }
997
1000 {
1002 }
1003
1005
1007 [
Obsolete(
"Use 'SetBuildingAnimationEx' instead")]
1009 {
1011 }
1012}
1013
1015{
1017 {
1019 }
1020
1022 {
1025 }
1026
1028 {
1029 return false;
1030 }
1031
1033 {
1034 ConstructionActionData cad = player.GetConstructionActionData();
1036 if (part)
1037 {
1039 if (overrideText ==
string.
Empty)
1041 else
1043
1044 #ifdef DIAG_DEVELOPER
1045 if (DiagMenu.GetBool(
DiagMenuIDs.BASEBUILDING_FULLDEBUG))
1046 {
1048 }
1049 #endif
1050 }
1051 }
1052
1054 {
1055 #ifdef DIAG_DEVELOPER
1056 if (player.GetConstructionActionData().GetFastConstructionMode() == EConstructionDebugModes.INSTANT)
1057 return false;
1058 #endif
1059
1060 if (item)
1061 return false;
1062
1064 if (!Class.CastTo(ent,target.GetObject()))
1065 return false;
1066
1067 if (player.IsPlacingLocal() || player.IsPlacingServer())
1068 return false;
1069
1070
1071 if (player.GetBrokenLegs() ==
eBrokenLegs.BROKEN_LEGS)
1072 return false;
1073
1074 bool handConstructionCondition = ent.CanUseHandConstruction();
1075 #ifdef DIAG_DEVELOPER
1076 if (player.GetConstructionActionData().GetFastConstructionMode())
1077 handConstructionCondition = true;
1078 #endif
1079
1080 if (!ent.CanUseConstruction() || !ent.CanUseConstructionBuild() || !handConstructionCondition)
1081 return false;
1082
1083 if ((!
GetGame().IsDedicatedServer()))
1084 {
1086 return false;
1087
1088 if (MiscGameplayFunctions.ComplexBuildCollideCheckClient(player, target, item,
m_VariantID))
1090
1091 return false;
1092 }
1093 return true;
1094 }
1095
1097 {
1100 string part_name = BuildPartActionData.Cast(action_data).m_PartType;
1102
1103 check_data.m_PartName = part_name;
1105
1106 bool canBuild = construction.CanBuildPart(part_name, null, false);
1107 #ifdef DIAG_DEVELOPER
1108 if (action_data.
m_Player.GetConstructionActionData().GetFastConstructionMode())
1109 canBuild = true;
1110 #endif
1112 {
1113 bool collides = construction.IsCollidingEx(check_data);
1114
1115 return !collides && canBuild;
1116 }
1117 else
1118 {
1119 return canBuild;
1120 }
1121 }
1122
1124 {
1126
1127 ActionInfoDataConstructionPossible info = ActionInfoDataConstructionPossible.Cast(
m_InfoData);
1128 ConstructionActionData cad = player.GetConstructionActionData();
1130 info.SetConstructionPart(part);
1131 info.SetTool(item);
1132
1134
1135
1136
1137
1138
1139
1141
1142 return info.CanDisplayInfo();
1143 }
1144
1146 {
1147 ConstructionActionData cad = action_data.m_Player.GetConstructionActionData();
1149 }
1150
1153 {
1155 }
1156
1159 {
1160 if (item)
1161 return;
1162
1163 BuildPartActionData buildData;
1164 if (Class.CastTo(buildData, action_data))
1165 {
1168 ConstructionPart part = construction.GetConstructionPart(buildData.m_PartType);
1170
1171 if (animOverrideID >= 0)
1172 m_CommandUID = animOverrideID;
1173 else
1175 }
1176 }
1177}
1178
1179
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.