556 : ActionReciveData
557{
559}
560
562{
564};
565
567{
569 {
571 m_ActionData.m_ActionComponent =
new CAContinuousTime(time);
572 }
573
575 {
576 #ifdef DIAG_DEVELOPER
577 if (
m_ActionData.m_Player.GetConstructionActionData().GetFastConstructionMode() == EConstructionDebugModes.FAST)
578 return 1;
579 #endif
580
581 if (item)
582 return UATimeSpent.BASEBUILDING_CONSTRUCT_MEDIUM;
583 else
584 return UATimeSpent.BASEBUILDING_CONSTRUCT_SLOW;
585 }
586};
587
589{
591 {
596
600 }
601
603 {
606 }
607
609 {
610 ConstructionActionData cad = player.GetConstructionActionData();
612 if (part)
613 {
615 if (overrideText ==
string.
Empty)
617 else
619
620 #ifdef DIAG_DEVELOPER
621 if (DiagMenu.GetBool(
DiagMenuIDs.BASEBUILDING_FULLDEBUG))
622 {
624 }
625 #endif
626 }
627 }
628
630 {
631 m_InfoData =
new ActionInfoDataConstructionPossible();
632 }
633
635 {
636 return false;
637 }
638
640 {
641 return false;
642 }
643
645 {
646 #ifdef DIAG_DEVELOPER
647 if (player.GetConstructionActionData().GetFastConstructionMode() == EConstructionDebugModes.INSTANT)
648 return false;
649 #endif
650
652 if (!Class.CastTo(ent,target.GetObject()))
653 return false;
654
655 if (player.IsPlacingLocal() || player.IsPlacingServer())
656 return false;
657
658
659 if (player.GetBrokenLegs() ==
eBrokenLegs.BROKEN_LEGS)
660 return false;
661
662 if (!ent.CanUseConstruction() || !ent.CanUseConstructionBuild())
663 return false;
664
665 if ((!
GetGame().IsDedicatedServer()))
666 {
668 return false;
669
670 if (MiscGameplayFunctions.ComplexBuildCollideCheckClient(player, target, item,
m_VariantID))
672
673 return false;
674 }
675 return true;
676 }
677
679 {
682 string part_name = BuildPartActionData.Cast(action_data).m_PartType;
684
685 check_data.m_PartName = part_name;
687
688 bool canBuild = construction.CanBuildPart(part_name, action_data.
m_MainItem,
true);
689 #ifdef DIAG_DEVELOPER
690 if (action_data.
m_Player.GetConstructionActionData().GetFastConstructionMode())
691 canBuild = true;
692 #endif
694 {
695 bool collides = construction.IsCollidingEx(check_data);
696
697 return !collides && canBuild;
698 }
699 else
700 {
701 return canBuild;
702 }
703 }
704
706 {
709
710 string partName = BuildPartActionData.Cast(action_data).m_PartType;
713
714 checkData.m_PartName = partName;
716
718 #ifdef DIAG_DEVELOPER
719 if (action_data.
m_Player.GetConstructionActionData().GetFastConstructionMode())
720 canBuild = true;
721 #endif
722 if (!construction.IsCollidingEx(checkData) && canBuild)
723 {
724
726
727 #ifdef DIAG_DEVELOPER
728
729 if (action_data.
m_Player.GetConstructionActionData().GetFastConstructionMode())
730 return;
731 #endif
732
733
735 {
737 action_data.
m_MainItem.DecreaseHealth(UADamageApplied.BUILD,
false);
738 }
739 else
740 {
742 {
743 EntityAI gloves = action_data.
m_Player.GetInventory().FindAttachment(InventorySlots.GLOVES);
744 if (gloves && gloves.GetHealthLevel() < 4)
745 {
746 gloves.AddHealth("","", PlayerConstants.GLOVES_DAMAGE_HAND_CONSTRUCTION);
747 }
748 else if (Math.RandomFloat01() < PlayerConstants.CHANCE_TO_BLEED_HAND_CONSTRUCTION)
749 {
750 if (Math.RandomFloat01() < 0.5)
751 action_data.
m_Player.GetBleedingManagerServer().AttemptAddBleedingSourceBySelection(
"LeftForeArmRoll");
752 else
753 action_data.
m_Player.GetBleedingManagerServer().AttemptAddBleedingSourceBySelection(
"RightForeArmRoll");
755 }
756 }
757 }
758 }
759 }
760
762 {
763 return "Base_building";
764 }
765
767 {
768 BuildPartActionData action_data = new BuildPartActionData;
769 return action_data;
770 }
771
772
774 {
775 if (super.SetupAction(player, target, item, action_data, extra_data))
776 {
777 if (!
g_Game.IsDedicatedServer())
778 {
780 }
781
783 return true;
784 }
785
786 return false;
787 }
788
790 {
791 ConstructionActionData cad = action_data.m_Player.GetConstructionActionData();
793 BuildPartActionData.Cast(action_data).m_PartType = part.
GetPartName();
794 }
795
797 {
798 if (!item)
799 return;
800
801 switch (item.Type())
802 {
803 case Pickaxe:
804 case Shovel:
805 case FarmingHoe:
806 case FieldShovel:
808 break;
809 case Pliers:
811 break;
812 case SledgeHammer:
814 break;
815 case BrickTrowel:
817 break;
818 default:
820 break;
821 }
822 }
823
825 {
826 super.WriteToContext(ctx, action_data);
827
828 ctx.
Write(BuildPartActionData.Cast(action_data).m_PartType);
829 }
830
832 {
833 action_recive_data = new BuildPartActionReciveData;
834 super.ReadFromContext(ctx, action_recive_data);
835
836 string part_type;
837 if (ctx.
Read(part_type))
838 {
839 BuildPartActionReciveData.Cast(action_recive_data).m_PartType = part_type;
840 return true;
841 }
842 else
843 {
844 return false;
845 }
846 }
847
848 override void HandleReciveData(ActionReciveData action_recive_data, ActionData action_data)
849 {
850 super.HandleReciveData(action_recive_data, action_data);
851
852 BuildPartActionData.Cast(action_data).m_PartType = BuildPartActionReciveData.Cast(action_recive_data).m_PartType;
853 }
854
856 {
857 string partName = BuildPartActionData.Cast(action_data).m_PartType;
858
859 string itemName = "hands";
861 itemName = action_data.
m_MainItem.GetDisplayName();
862
863 string message =
string.Format(
"Built %1 on %2 with %3", partName, action_data.
m_Target.GetObject().GetDisplayName(), itemName);
864 return message;
865 }
866
868 {
870 }
871
873 {
875
876 ActionInfoDataConstructionPossible info = ActionInfoDataConstructionPossible.Cast(
m_InfoData);
877 ConstructionActionData cad = player.GetConstructionActionData();
879 info.SetConstructionPart(part);
880 info.SetTool(item);
881
884
885 return info.CanDisplayInfo();
886 }
887
890 {
893 ConstructionActionData cad = player.GetConstructionActionData();
895
896 if (part)
897 {
899 if (!ent.IsPlayerInsideEx(player, part.
GetPartName()))
900 {
902 return false;
903 else if (!bbb)
904 return false;
905 }
906 if (!construction.ConstructionDirectionCheck(player, part, EConstructionDirCheckType.INDOORS))
907 return false;
908 if (!construction.ConstructionInsiderBoxCheck(player, part))
909 return false;
910
911 return true;
912 }
913 return false;
914 }
915
918 {
920 }
921
923
925 [
Obsolete(
"Use 'SetBuildingAnimationEx' instead")]
927 {
929 }
930}
931
933{
935 {
937 }
938
940 {
943 }
944
946 {
947 return false;
948 }
949
951 {
952 ConstructionActionData cad = player.GetConstructionActionData();
954 if (part)
955 {
957 if (overrideText ==
string.
Empty)
959 else
961
962 #ifdef DIAG_DEVELOPER
963 if (DiagMenu.GetBool(
DiagMenuIDs.BASEBUILDING_FULLDEBUG))
964 {
966 }
967 #endif
968 }
969 }
970
972 {
973 #ifdef DIAG_DEVELOPER
974 if (player.GetConstructionActionData().GetFastConstructionMode() == EConstructionDebugModes.INSTANT)
975 return false;
976 #endif
977
978 if (item)
979 return false;
980
982 if (!Class.CastTo(ent,target.GetObject()))
983 return false;
984
985 if (player.IsPlacingLocal() || player.IsPlacingServer())
986 return false;
987
988
989 if (player.GetBrokenLegs() ==
eBrokenLegs.BROKEN_LEGS)
990 return false;
991
992 bool handConstructionCondition = ent.CanUseHandConstruction();
993 #ifdef DIAG_DEVELOPER
994 if (player.GetConstructionActionData().GetFastConstructionMode())
995 handConstructionCondition = true;
996 #endif
997
998 if (!ent.CanUseConstruction() || !ent.CanUseConstructionBuild() || !handConstructionCondition)
999 return false;
1000
1001 if ((!
GetGame().IsDedicatedServer()))
1002 {
1004 return false;
1005
1006 if (MiscGameplayFunctions.ComplexBuildCollideCheckClient(player, target, item,
m_VariantID))
1008
1009 return false;
1010 }
1011 return true;
1012 }
1013
1015 {
1018 string part_name = BuildPartActionData.Cast(action_data).m_PartType;
1020
1021 check_data.m_PartName = part_name;
1023
1024 bool canBuild = construction.CanBuildPart(part_name, null, false);
1025 #ifdef DIAG_DEVELOPER
1026 if (action_data.
m_Player.GetConstructionActionData().GetFastConstructionMode())
1027 canBuild = true;
1028 #endif
1030 {
1031 bool collides = construction.IsCollidingEx(check_data);
1032
1033 return !collides && canBuild;
1034 }
1035 else
1036 {
1037 return canBuild;
1038 }
1039 }
1040
1042 {
1044
1045 ActionInfoDataConstructionPossible info = ActionInfoDataConstructionPossible.Cast(
m_InfoData);
1046 ConstructionActionData cad = player.GetConstructionActionData();
1048 info.SetConstructionPart(part);
1049 info.SetTool(item);
1050
1052
1053
1054
1055
1056
1057
1059
1060 return info.CanDisplayInfo();
1061 }
1062
1064 {
1065 ConstructionActionData cad = action_data.m_Player.GetConstructionActionData();
1067 }
1068
1071 {
1073 }
1074
1077 {
1078 if (item)
1079 return;
1080
1081 BuildPartActionData buildData;
1082 if (Class.CastTo(buildData, action_data))
1083 {
1086 ConstructionPart part = construction.GetConstructionPart(buildData.m_PartType);
1088
1089 if (animOverrideID >= 0)
1090 m_CommandUID = animOverrideID;
1091 else
1093 }
1094 }
1095}
1096
1097
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.