586 : ActionReciveData
587{
589}
590
592{
594};
595
597{
599 {
601 m_ActionData.m_ActionComponent =
new CAContinuousTime(time);
602 }
603
605 {
606 #ifdef DIAG_DEVELOPER
607 if (
m_ActionData.m_Player.GetConstructionActionData().GetFastConstructionMode() == EConstructionDebugModes.FAST)
608 return 1;
609 #endif
610
611 if (item)
612 return UATimeSpent.BASEBUILDING_CONSTRUCT_MEDIUM;
613 else
614 return UATimeSpent.BASEBUILDING_CONSTRUCT_SLOW;
615 }
616};
617
619{
621 {
626
630 }
631
633 {
636 }
637
639 {
640 ConstructionActionData cad = player.GetConstructionActionData();
642 if (part)
643 {
645 if (overrideText ==
string.
Empty)
647 else
649
650 #ifdef DIAG_DEVELOPER
651 if (DiagMenu.GetBool(
DiagMenuIDs.BASEBUILDING_FULLDEBUG))
652 {
654 }
655 #endif
656 }
657 }
658
660 {
661 m_InfoData =
new ActionInfoDataConstructionPossible();
662 }
663
665 {
666 return false;
667 }
668
670 {
671 return false;
672 }
673
675 {
676 #ifdef DIAG_DEVELOPER
677 if (player.GetConstructionActionData().GetFastConstructionMode() == EConstructionDebugModes.INSTANT)
678 return false;
679 #endif
680
682 if (!Class.CastTo(ent,target.GetObject()))
683 return false;
684
685 if (player.IsPlacingLocal() || player.IsPlacingServer())
686 return false;
687
688
689 if (player.GetBrokenLegs() ==
eBrokenLegs.BROKEN_LEGS)
690 return false;
691
692 if (!ent.CanUseConstruction() || !ent.CanUseConstructionBuild())
693 return false;
694
695 if ((!
GetGame().IsDedicatedServer()))
696 {
698 return false;
699
700 if (MiscGameplayFunctions.ComplexBuildCollideCheckClient(player, target, item,
m_VariantID))
702
703 return false;
704 }
705 return true;
706 }
707
709 {
712 string part_name = BuildPartActionData.Cast(action_data).m_PartType;
714
715 check_data.m_PartName = part_name;
717
718 bool canBuild = construction.CanBuildPart(part_name, action_data.
m_MainItem,
true);
719 #ifdef DIAG_DEVELOPER
720 if (action_data.
m_Player.GetConstructionActionData().GetFastConstructionMode())
721 canBuild = true;
722 #endif
724 {
725 bool collides = construction.IsCollidingEx(check_data);
726
727 return !collides && canBuild;
728 }
729 else
730 {
731 return canBuild;
732 }
733 }
734
736 {
739
740 string partName = BuildPartActionData.Cast(action_data).m_PartType;
743
744 checkData.m_PartName = partName;
746
748 #ifdef DIAG_DEVELOPER
749 if (action_data.
m_Player.GetConstructionActionData().GetFastConstructionMode())
750 canBuild = true;
751 #endif
752 if (!construction.IsCollidingEx(checkData) && canBuild)
753 {
754
756
757 #ifdef DIAG_DEVELOPER
758
759 if (action_data.
m_Player.GetConstructionActionData().GetFastConstructionMode())
760 return;
761 #endif
762
763
765 {
767 action_data.
m_MainItem.DecreaseHealth(UADamageApplied.BUILD,
false);
768 }
769 else
770 {
772 {
773 EntityAI gloves = action_data.
m_Player.GetInventory().FindAttachment(InventorySlots.GLOVES);
774 if (gloves && gloves.GetHealthLevel() < 4)
775 {
776 gloves.AddHealth("","", PlayerConstants.GLOVES_DAMAGE_HAND_CONSTRUCTION);
777 }
778 else if (Math.RandomFloat01() < PlayerConstants.CHANCE_TO_BLEED_HAND_CONSTRUCTION)
779 {
780 if (Math.RandomFloat01() < 0.5)
781 action_data.
m_Player.GetBleedingManagerServer().AttemptAddBleedingSourceBySelection(
"LeftForeArmRoll");
782 else
783 action_data.
m_Player.GetBleedingManagerServer().AttemptAddBleedingSourceBySelection(
"RightForeArmRoll");
785 }
786 }
787 }
788 }
789 }
790
792 {
793 return "Base_building";
794 }
795
797 {
798 BuildPartActionData action_data = new BuildPartActionData;
799 return action_data;
800 }
801
802
804 {
805 if (super.SetupAction(player, target, item, action_data, extra_data))
806 {
807 if (!
g_Game.IsDedicatedServer())
808 {
810 }
811
813 return true;
814 }
815
816 return false;
817 }
818
820 {
821 ConstructionActionData cad = action_data.m_Player.GetConstructionActionData();
823 BuildPartActionData.Cast(action_data).m_PartType = part.
GetPartName();
824 }
825
827 {
828 if (!item)
829 return;
830
831 switch (item.Type())
832 {
833 case Pickaxe:
834 case Shovel:
835 case FarmingHoe:
836 case FieldShovel:
838 break;
839 case Pliers:
841 break;
842 case SledgeHammer:
844 break;
845 case BrickTrowel:
847 break;
848 default:
850 break;
851 }
852 }
853
855 {
856 super.WriteToContext(ctx, action_data);
857
858 ctx.
Write(BuildPartActionData.Cast(action_data).m_PartType);
859 }
860
862 {
863 action_recive_data = new BuildPartActionReciveData;
864 super.ReadFromContext(ctx, action_recive_data);
865
866 string part_type;
867 if (ctx.
Read(part_type))
868 {
869 BuildPartActionReciveData.Cast(action_recive_data).m_PartType = part_type;
870 return true;
871 }
872 else
873 {
874 return false;
875 }
876 }
877
878 override void HandleReciveData(ActionReciveData action_recive_data, ActionData action_data)
879 {
880 super.HandleReciveData(action_recive_data, action_data);
881
882 BuildPartActionData.Cast(action_data).m_PartType = BuildPartActionReciveData.Cast(action_recive_data).m_PartType;
883 }
884
886 {
887 string partName = BuildPartActionData.Cast(action_data).m_PartType;
888
889 string itemName = "hands";
891 itemName = action_data.
m_MainItem.GetDisplayName();
892
893 string message =
string.Format(
"Built %1 on %2 with %3", partName, action_data.
m_Target.GetObject().GetDisplayName(), itemName);
894 return message;
895 }
896
898 {
900 }
901
903 {
905
906 ActionInfoDataConstructionPossible info = ActionInfoDataConstructionPossible.Cast(
m_InfoData);
907 ConstructionActionData cad = player.GetConstructionActionData();
909 info.SetConstructionPart(part);
910 info.SetTool(item);
911
914
915 return info.CanDisplayInfo();
916 }
917
920 {
923 ConstructionActionData cad = player.GetConstructionActionData();
925
926 if (part)
927 {
929 if (!ent.IsPlayerInsideEx(player, part.
GetPartName()))
930 {
932 return false;
933 else if (!bbb)
934 return false;
935 }
936 if (!construction.ConstructionDirectionCheck(player, part, EConstructionDirCheckType.INDOORS))
937 return false;
938 if (!construction.ConstructionInsiderBoxCheck(player, part))
939 return false;
940
941 return true;
942 }
943 return false;
944 }
945
948 {
950 }
951
953
955 [
Obsolete(
"Use 'SetBuildingAnimationEx' instead")]
957 {
959 }
960}
961
963{
965 {
967 }
968
970 {
973 }
974
976 {
977 return false;
978 }
979
981 {
982 ConstructionActionData cad = player.GetConstructionActionData();
984 if (part)
985 {
987 if (overrideText ==
string.
Empty)
989 else
991
992 #ifdef DIAG_DEVELOPER
993 if (DiagMenu.GetBool(
DiagMenuIDs.BASEBUILDING_FULLDEBUG))
994 {
996 }
997 #endif
998 }
999 }
1000
1002 {
1003 #ifdef DIAG_DEVELOPER
1004 if (player.GetConstructionActionData().GetFastConstructionMode() == EConstructionDebugModes.INSTANT)
1005 return false;
1006 #endif
1007
1008 if (item)
1009 return false;
1010
1012 if (!Class.CastTo(ent,target.GetObject()))
1013 return false;
1014
1015 if (player.IsPlacingLocal() || player.IsPlacingServer())
1016 return false;
1017
1018
1019 if (player.GetBrokenLegs() ==
eBrokenLegs.BROKEN_LEGS)
1020 return false;
1021
1022 bool handConstructionCondition = ent.CanUseHandConstruction();
1023 #ifdef DIAG_DEVELOPER
1024 if (player.GetConstructionActionData().GetFastConstructionMode())
1025 handConstructionCondition = true;
1026 #endif
1027
1028 if (!ent.CanUseConstruction() || !ent.CanUseConstructionBuild() || !handConstructionCondition)
1029 return false;
1030
1031 if ((!
GetGame().IsDedicatedServer()))
1032 {
1034 return false;
1035
1036 if (MiscGameplayFunctions.ComplexBuildCollideCheckClient(player, target, item,
m_VariantID))
1038
1039 return false;
1040 }
1041 return true;
1042 }
1043
1045 {
1048 string part_name = BuildPartActionData.Cast(action_data).m_PartType;
1050
1051 check_data.m_PartName = part_name;
1053
1054 bool canBuild = construction.CanBuildPart(part_name, null, false);
1055 #ifdef DIAG_DEVELOPER
1056 if (action_data.
m_Player.GetConstructionActionData().GetFastConstructionMode())
1057 canBuild = true;
1058 #endif
1060 {
1061 bool collides = construction.IsCollidingEx(check_data);
1062
1063 return !collides && canBuild;
1064 }
1065 else
1066 {
1067 return canBuild;
1068 }
1069 }
1070
1072 {
1074
1075 ActionInfoDataConstructionPossible info = ActionInfoDataConstructionPossible.Cast(
m_InfoData);
1076 ConstructionActionData cad = player.GetConstructionActionData();
1078 info.SetConstructionPart(part);
1079 info.SetTool(item);
1080
1082
1083
1084
1085
1086
1087
1089
1090 return info.CanDisplayInfo();
1091 }
1092
1094 {
1095 ConstructionActionData cad = action_data.m_Player.GetConstructionActionData();
1097 }
1098
1101 {
1103 }
1104
1107 {
1108 if (item)
1109 return;
1110
1111 BuildPartActionData buildData;
1112 if (Class.CastTo(buildData, action_data))
1113 {
1116 ConstructionPart part = construction.GetConstructionPart(buildData.m_PartType);
1118
1119 if (animOverrideID >= 0)
1120 m_CommandUID = animOverrideID;
1121 else
1123 }
1124 }
1125}
1126
1127
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.