DayZ 1.26
DayZ Explorer by KGB
Загрузка...
Поиск...
Не найдено
Файл Construction.c

См. исходные тексты.

Структуры данных

class  StaticConstructionMethods
 
class  ConstructionBoxTrigger
 

Перечисления

enum  ConstructionMaterialType {
  MATERIAL_NONE = 0 , MATERIAL_LOG = 1 , MATERIAL_WOOD = 2 , MATERIAL_STAIRS = 3 ,
  MATERIAL_METAL = 4 , MATERIAL_WIRE = 5
}
 

Функции

void Construction (BaseBuildingBase parent)
 
void Init ()
 Launched from 'DayZGame.DeferredInit' to make earlier access, use, and updates impossible (downside of a non-static system)
 
BaseBuildingBase GetParent ()
 Get parent of the Effect.
 
void SetParent (BaseBuildingBase parent)
 
void AddToConstructedParts (string part_name)
 
void RemoveFromConstructedParts (string part_name)
 
void BuildPartServer (notnull Man player, string part_name, int action_id)
 
void DismantlePartServer (notnull Man player, string part_name, int action_id)
 
void DestroyPartServer (Man player, string part_name, int action_id, bool destroyed_by_connected_part=false)
 
void DestroyConnectedParts (string part_name)
 
bool ExceptionCheck (string part_name)
 Exceptions from 'dependent parts' hierarchy are handled here.
 
void InitVisuals ()
 
void UpdateVisuals ()
 
void UpdatePhysics ()
 
void InitBaseState ()
 
void UpdateConstructionParts ()
 
map< string, ref ConstructionPartGetConstructionParts ()
 
ConstructionPart GetConstructionPart (string part_name)
 
bool CanBuildPart (string part_name, ItemBase tool, bool use_tool)
 
bool MaterialIsRuined (string part_name)
 
void GetConstructionPartsToBuild (string main_part_name, out array< ConstructionPart > construction_parts, ItemBase tool, out string real_constructionTarget, bool use_tool)
 
ConstructionPart GetBaseConstructionPart ()
 
ConstructionPart GetGateConstructionPart ()
 
bool HasRequiredPart (string part_name)
 
bool HasConflictPart (string part_name)
 
ConstructionPart GetConstructionPartToDismantle (string part_name, ItemBase tool)
 
bool CanDismantlePart (string part_name, ItemBase tool)
 
bool HasDependentPart (string part_name)
 
array< stringGetValidDepenentPartsArray (string part_name, array< string > recurs=null)
 
array< stringGetRequiredParts (string part_name, string main_part_name)
 
ConstructionPart GetConstructionPartToDestroy (string part_name)
 
bool CanDestroyPart (string part_name)
 
void ShowConstructionPart (string part_name)
 
void HideConstructionPart (string part_name)
 
void ShowConstructionPartPhysics (string part_name)
 
void HideConstructionPartPhysics (string part_name)
 
bool IsPartConstructed (string part_name)
 
bool HasMaterials (string part_name, bool repairing=false)
 
bool HasMaterialWithQuantityAttached (string slot_name, float quantity)
 
void TakeMaterialsServer (string part_name, bool repairing=false)
 
void ReceiveMaterialsServer (notnull Man player, string part_name, string damagezone_name)
 
void DestroyMaterialsServer (Man player, string part_name)
 
void DropNonUsableMaterialsServer (Man player, string part_name)
 
void SetLockOnAttachedMaterials (string part_name, bool lock_slot)
 
bool CanUseToolToBuildPart (string part_name, ItemBase tool)
 
bool CanUseToolToDismantlePart (string part_name, ItemBase tool)
 
ConstructionMaterialType GetMaterialType (string part_name)
 
bool IsColliding (string part_name)
 
bool IsCollidingEx (CollisionCheckData check_data)
 Collision check for building part.
 
vector GetCollisionBoxSize (vector min_max[2])
 
void GetCollisionBoxData (string part_name, out vector min_max[2])
 
vector GetBoxCenter (vector min_max[2])
 
void GetTriggerExtents (vector min_max[2], out vector extents[2])
 
void DrawDebugCollisionBox (vector min_max[2], int color)
 
void DestroyDebugCollisionBox ()
 
void CreateCollisionTrigger (string part_name, vector min_max[2], vector center)
 
void DestroyCollisionTrigger ()
 
bool IsTriggerColliding ()
 
void CollisionCheckData ()
 

Переменные

enum ConstructionMaterialType REPAIR_MATERIAL_PERCENTAGE = 0.15
 
static const float DECONSTURCT_MATERIAL_LOSS = 0.2
 
ref map< string, ref ConstructionPartm_ConstructionParts
 
BaseBuildingBase m_Parent
 
Shape m_CollisionBox
 
ConstructionBoxTrigger m_ConstructionBoxTrigger
 
class StaticConstructionMethods m_AdditionalExcludes
 Data structure for passing parameters (extendable, modable)
 
string m_PartName
 
int m_PrimaryGeometry
 
int m_SecondaryGeometry
 

Перечисления

◆ ConstructionMaterialType

Элементы перечислений
MATERIAL_NONE 
MATERIAL_LOG 
MATERIAL_WOOD 
MATERIAL_STAIRS 
MATERIAL_METAL 
MATERIAL_WIRE 
2{
4 MATERIAL_LOG = 1,
9}
@ MATERIAL_STAIRS
Definition Construction.c:6
@ MATERIAL_METAL
Definition Construction.c:7
@ MATERIAL_WOOD
Definition Construction.c:5
@ MATERIAL_NONE
Definition Construction.c:3
@ MATERIAL_LOG
Definition Construction.c:4
@ MATERIAL_WIRE
Definition Construction.c:8

Функции

◆ AddToConstructedParts()

void AddToConstructedParts ( string part_name)
protected
53 {
55
56 if ( constrution_part )
57 {
58 if (LogManager.IsBaseBuildingLogEnable()) bsbDebugPrint("[bsb] Construction " + Object.GetDebugName(m_Parent) + " AddToConstructedParts part=" + constrution_part.GetPartName());
59 constrution_part.SetBuiltState( true );
60 }
61 }
class BaseBuildingBase extends ItemBase bsbDebugPrint(string s)
Definition BaseBuildingBase.c:1234
ConstructionPart GetConstructionPart(string part_name)
Definition Construction.c:280
BaseBuildingBase m_Parent
Definition Construction.c:16
Definition ConstructionPart.c:2
Definition Debug.c:600
static bool IsBaseBuildingLogEnable()
Definition Debug.c:704
Definition ObjectTyped.c:2
Definition EntityAI.c:95

Перекрестные ссылки bsbDebugPrint(), GetConstructionPart(), LogManager::IsBaseBuildingLogEnable() и m_Parent.

◆ BuildPartServer()

void BuildPartServer ( notnull Man player,
string part_name,
int action_id )
protected
76 {
77 if (LogManager.IsBaseBuildingLogEnable()) bsbDebugPrint("[bsb] Construction BuildPartServer | " + part_name);
78 //reset DamageZone health
79 string damage_zone;
80 if (DamageSystem.GetDamageZoneFromComponentName(GetParent(),part_name,damage_zone))
81 {
82 GetParent().SetAllowDamage(true);
83 GetParent().SetHealthMax(damage_zone);
84 GetParent().ProcessInvulnerabilityCheck(GetParent().GetInvulnerabilityTypeString());
85 }
86
87 //on action
89
90 //destroy build collision check trigger
92
93 //call event
95 }
override string GetInvulnerabilityTypeString()
Definition BaseBuildingBase.c:1310
void TakeMaterialsServer(string part_name, bool repairing=false)
Definition Construction.c:672
void DestroyCollisionTrigger()
Definition Construction.c:1210
override void OnPartBuiltServer(notnull Man player, string part_name, int action_id)
Definition Fence.c:297
BaseBuildingBase GetParent()
Get parent of the Effect.
Definition Construction.c:40

Перекрестные ссылки bsbDebugPrint(), DestroyCollisionTrigger(), GetInvulnerabilityTypeString(), GetParent(), LogManager::IsBaseBuildingLogEnable() и TakeMaterialsServer().

◆ CanBuildPart()

bool CanBuildPart ( string part_name,
ItemBase tool,
bool use_tool )
protected
297 {
299 {
300 return true;
301 }
302
303 return false;
304 }
bool HasMaterials(string part_name, bool repairing=false)
Definition Construction.c:618
bool MaterialIsRuined(string part_name)
Definition Construction.c:306
bool HasConflictPart(string part_name)
Definition Construction.c:438
bool IsPartConstructed(string part_name)
Definition Construction.c:603
bool CanUseToolToBuildPart(string part_name, ItemBase tool)
Definition Construction.c:951
bool HasRequiredPart(string part_name)
Definition Construction.c:412

Перекрестные ссылки CanUseToolToBuildPart(), HasConflictPart(), HasMaterials(), HasRequiredPart(), IsPartConstructed() и MaterialIsRuined().

Используется в GetConstructionPartsToBuild().

◆ CanDestroyPart()

bool CanDestroyPart ( string part_name)
protected
568 {
570 {
571 return true;
572 }
573
574 return false;
575 }
bool HasDependentPart(string part_name)
Definition Construction.c:480

Перекрестные ссылки HasDependentPart() и IsPartConstructed().

Используется в GetConstructionPartToDestroy().

◆ CanDismantlePart()

bool CanDismantlePart ( string part_name,
ItemBase tool )
protected
469 {
471 {
472 return true;
473 }
474
475 return false;
476 }
bool CanUseToolToDismantlePart(string part_name, ItemBase tool)
Definition Construction.c:974

Перекрестные ссылки CanUseToolToDismantlePart(), HasDependentPart() и IsPartConstructed().

Используется в GetConstructionPartToDismantle().

◆ CanUseToolToBuildPart()

bool CanUseToolToBuildPart ( string part_name,
ItemBase tool )
protected
952 {
954 string part_cfg_path = "cfgVehicles" + " " + GetParent().GetType() + " "+ "Construction" + " " + construction_part.GetMainPartName() + " " + construction_part.GetPartName() + " " + "build_action_type";
955 if ( GetGame().ConfigIsExisting( part_cfg_path ) )
956 {
957 int part_build_action_type = GetGame().ConfigGetInt( part_cfg_path );
958 string tool_cfg_path = "cfgVehicles" + " " + tool.GetType() + " " + "build_action_type";
959
960 if ( GetGame().ConfigIsExisting( tool_cfg_path ) )
961 {
962 int tool_build_action_type = GetGame().ConfigGetInt( tool_cfg_path );
963
965 {
966 return true;
967 }
968 }
969 }
970
971 return false;
972 }
proto native CGame GetGame()

Перекрестные ссылки GetConstructionPart(), GetGame() и GetParent().

Используется в CanBuildPart().

◆ CanUseToolToDismantlePart()

bool CanUseToolToDismantlePart ( string part_name,
ItemBase tool )
protected
975 {
977 string part_cfg_path = "cfgVehicles" + " " + GetParent().GetType() + " "+ "Construction" + " " + construction_part.GetMainPartName() + " " + construction_part.GetPartName() + " " + "dismantle_action_type";
978 if ( GetGame().ConfigIsExisting( part_cfg_path ) )
979 {
980 int part_dismantle_action_type = GetGame().ConfigGetInt( part_cfg_path );
981 string tool_cfg_path = "cfgVehicles" + " " + tool.GetType() + " " + "dismantle_action_type";
982
983 if ( GetGame().ConfigIsExisting( tool_cfg_path ) )
984 {
985 int tool_dismantle_action_type = GetGame().ConfigGetInt( tool_cfg_path );
986
988 {
989 return true;
990 }
991 }
992 }
993
994 return false;
995 }

Перекрестные ссылки GetConstructionPart(), GetGame() и GetParent().

Используется в CanDismantlePart().

◆ CollisionCheckData()

void CollisionCheckData ( )
protected
1313 {
1315 m_PartName = "";
1318 }
class StaticConstructionMethods m_AdditionalExcludes
Data structure for passing parameters (extendable, modable)
int m_PrimaryGeometry
Definition Construction.c:1309
int m_SecondaryGeometry
Definition Construction.c:1310
string m_PartName
Definition Construction.c:1308

Перекрестные ссылки m_AdditionalExcludes, m_PartName, m_PrimaryGeometry и m_SecondaryGeometry.

Используется в ActionBuildPart::ActionConditionContinue(), ActionBuildShelter::ActionConditionContinue() и ActionBuildPart::OnFinishProgressServer().

◆ Construction()

◆ CreateCollisionTrigger()

void CreateCollisionTrigger ( string part_name,
vector min_max[2],
vector center )
protected
1183 {
1185 {
1186 if ( m_ConstructionBoxTrigger.GetPartName() == part_name ) //already created
1187 {
1188 return;
1189 }
1190 else
1191 {
1193 }
1194 }
1195
1196 //get proper trigger extents (min<max)
1197 vector extents[2];
1199
1200 //create trigger
1201 m_ConstructionBoxTrigger = ConstructionBoxTrigger.Cast( GetGame().CreateObject( "ConstructionBoxTrigger", center, false, false, false ) );
1202 m_ConstructionBoxTrigger.SetPosition( center );
1203 m_ConstructionBoxTrigger.SetOrientation( GetParent().GetOrientation() );
1205
1207 }
vector GetOrientation()
Definition AreaDamageManager.c:306
void GetTriggerExtents(vector min_max[2], out vector extents[2])
Definition Construction.c:1150
ConstructionBoxTrigger m_ConstructionBoxTrigger
Definition Construction.c:21
Definition Construction.c:1322
void SetPartName(string part_name)
Definition Construction.c:1325
string GetPartName()
Definition Construction.c:1330
void SetExtents(vector mins, vector maxs)
Set the size of the Trigger, avoid using SetCollisionBox directly.
Definition Trigger.c:116
Definition EnConvert.c:106

Перекрестные ссылки DestroyCollisionTrigger(), GetGame(), GetOrientation(), GetParent(), ConstructionBoxTrigger::GetPartName(), GetTriggerExtents(), m_ConstructionBoxTrigger, Trigger::SetExtents() и ConstructionBoxTrigger::SetPartName().

◆ DestroyCollisionTrigger()

void DestroyCollisionTrigger ( )
protected
1211 {
1212 GetGame().ObjectDelete( m_ConstructionBoxTrigger );
1214 }

Перекрестные ссылки GetGame() и m_ConstructionBoxTrigger.

Используется в BuildPartServer() и CreateCollisionTrigger().

◆ DestroyConnectedParts()

void DestroyConnectedParts ( string part_name)
protected
142 {
143 array<string> parts;// = new array<string>;
145 if (parts)
146 {
147 for (int i = 0; i < parts.Count(); i++)
148 {
149 if (LogManager.IsBaseBuildingLogEnable()) bsbDebugPrint("[bsb] Construction DestroyConnectedParts | " + parts.Get(i));
150 if (!ExceptionCheck(parts.Get(i)))
152 }
153 }
154 }
const int AT_DESTROY_PART
Definition _constants.c:8
void DestroyPartServer(Man player, string part_name, int action_id, bool destroyed_by_connected_part=false)
Definition Construction.c:121
array< string > GetValidDepenentPartsArray(string part_name, array< string > recurs=null)
Definition Construction.c:500
bool ExceptionCheck(string part_name)
Exceptions from 'dependent parts' hierarchy are handled here.
Definition Construction.c:157

Перекрестные ссылки AT_DESTROY_PART, bsbDebugPrint(), DestroyPartServer(), ExceptionCheck(), GetValidDepenentPartsArray() и LogManager::IsBaseBuildingLogEnable().

◆ DestroyDebugCollisionBox()

void DestroyDebugCollisionBox ( )
protected
1174 {
1175 if ( m_CollisionBox )
1176 {
1177 m_CollisionBox.Destroy();
1179 }
1180 }
Shape m_CollisionBox
Definition Construction.c:19

Перекрестные ссылки m_CollisionBox.

Используется в DrawDebugCollisionBox(), Hologram::UpdateHologram() и Hologram::~Hologram().

◆ DestroyMaterialsServer()

void DestroyMaterialsServer ( Man player,
string part_name )
protected
742 {
744 string main_part_name = cPart.GetMainPartName();
745 string cfg_path = "cfgVehicles" + " " + GetParent().GetType() + " "+ "Construction" + " " + main_part_name + " " + part_name + " " + "Materials";
746
747 if ( GetGame().ConfigIsExisting( cfg_path ) )
748 {
749 int child_count = GetGame().ConfigGetChildrenCount( cfg_path );
750
751 for ( int i = 0; i < child_count; i++ )
752 {
753 string child_name;
754 GetGame().ConfigGetChildName( cfg_path, i, child_name );
755
756 //get type, quantity from material
757 string config_path;
758 string type;
759 string slot_name;
760 config_path = cfg_path + " " + child_name + " " + "type";
761 GetGame().ConfigGetText( config_path, type );
762 config_path = cfg_path + " " + child_name + " " + "slot_name";
763 GetGame().ConfigGetText( config_path, slot_name );
764 config_path = cfg_path + " " + child_name + " " + "quantity";
765 float quantity = GetGame().ConfigGetFloat( config_path );
766 config_path = cfg_path + " " + child_name + " " + "lockable";
767 bool lockable = GetGame().ConfigGetInt( config_path );
768
769 //get material
770 ItemBase attachment = ItemBase.Cast( GetParent().FindAttachmentBySlotName( slot_name ) );
771
772 //material still attached
773 if ( lockable ) //if lockable
774 {
775 if ( attachment )
776 {
778 attachment.GetInventory().GetCurrentInventoryLocation( inventory_location );
779 if (LogManager.IsBaseBuildingLogEnable()) bsbDebugPrint("[bsb] " + Object.GetDebugName(GetParent()) + " DestroyMaterialsServer unlock slot=" + inventory_location.GetSlot());
780
781 GetParent().GetInventory().SetSlotLock( inventory_location.GetSlot() , false );
782 GetGame().ObjectDelete( attachment ); //delete object
783 }
784 }
785 }
786 }
787 }
InventoryLocation.
Definition InventoryLocation.c:29
Definition InventoryItem.c:731

Перекрестные ссылки bsbDebugPrint(), GetConstructionPart(), GetGame(), GetParent() и LogManager::IsBaseBuildingLogEnable().

Используется в DestroyPartServer().

◆ DestroyPartServer()

void DestroyPartServer ( Man player,
string part_name,
int action_id,
bool destroyed_by_connected_part = false )
protected
122 {
123 if (LogManager.IsBaseBuildingLogEnable()) bsbDebugPrint("[bsb] Construction DestroyPartServer | " + part_name);
124 //destroy attached materials (if locked)
126
127 //drop non-usable materials
129
130 //call event
132
133 //set DamageZone health to zero (redundant?)
134 string damage_zone;
135 if ( DamageSystem.GetDamageZoneFromComponentName(GetParent(),part_name,damage_zone) && GetParent().GetHealth(damage_zone,"Health") > 0 )
136 {
137 GetParent().SetHealth(damage_zone,"Health",0);
138 }
139 }
void DropNonUsableMaterialsServer(Man player, string part_name)
Definition Construction.c:789
void DestroyMaterialsServer(Man player, string part_name)
Definition Construction.c:741
override void OnPartDestroyedServer(Man player, string part_name, int action_id, bool destroyed_by_connected_part=false)
Definition Fence.c:331

Перекрестные ссылки bsbDebugPrint(), DestroyMaterialsServer(), DropNonUsableMaterialsServer(), GetParent() и LogManager::IsBaseBuildingLogEnable().

Используется в DestroyConnectedParts().

◆ DismantlePartServer()

void DismantlePartServer ( notnull Man player,
string part_name,
int action_id )
protected
99 {
100 string damage_zone;
101 DamageSystem.GetDamageZoneFromComponentName( GetParent(),part_name,damage_zone );
102
103 if (LogManager.IsBaseBuildingLogEnable()) bsbDebugPrint("[bsb] Construction DismantlePartServer | " + part_name);
104 //receive materials
106
107 //drop non-usable materials
109
110 //call event
112
113 //set DamageZone health to zero (redundant?)
114 /*if ( GetParent().GetHealth(damage_zone,"Health") > 0 )
115 {
116 GetParent().SetHealth(damage_zone,"Health",0);
117 }*/
118 }
void ReceiveMaterialsServer(notnull Man player, string part_name, string damagezone_name)
Definition Construction.c:727
override void OnPartDismantledServer(notnull Man player, string part_name, int action_id)
Definition Fence.c:309

Перекрестные ссылки bsbDebugPrint(), DropNonUsableMaterialsServer(), GetParent(), LogManager::IsBaseBuildingLogEnable() и ReceiveMaterialsServer().

◆ DrawDebugCollisionBox()

void DrawDebugCollisionBox ( vector min_max[2],
int color )
protected
1163 {
1165
1166 vector mat[4];
1167 GetParent().GetTransform( mat );
1168
1170 m_CollisionBox.SetMatrix( mat );
1171 }
void DestroyDebugCollisionBox()
Definition Construction.c:1173
Definition Debug.c:14
static Shape DrawBox(vector pos1, vector pos2, int color=0x1fff7f7f)
Definition Debug.c:300

Перекрестные ссылки DestroyDebugCollisionBox(), Debug::DrawBox(), GetParent() и m_CollisionBox.

Используется в Hologram::IsCollidingBBox().

◆ DropNonUsableMaterialsServer()

void DropNonUsableMaterialsServer ( Man player,
string part_name )
protected
790 {
792
793 string cfg_path = "cfgVehicles" + " " + GetParent().GetType() + " " + "Construction" + " " + construction_part.GetMainPartName() + " " + construction_part.GetPartName() + " " + "platform_support";
794 string platform_support;
795
796 if ( GetGame().ConfigIsExisting( cfg_path ) )
797 {
798 GetGame().ConfigGetText( cfg_path, platform_support );
799 }
800
801 if ( platform_support.Length() > 0 || construction_part.IsBase() )
802 {
803 string at_cfg_path = "cfgVehicles" + " " + GetParent().GetType() + " "+ "GUIInventoryAttachmentsProps";
804
805 if ( GetGame().ConfigIsExisting( at_cfg_path ) )
806 {
807 int child_count = GetGame().ConfigGetChildrenCount( at_cfg_path );
808
809 for ( int i = 0; i < child_count; i++ )
810 {
811 string child_name;
812 GetGame().ConfigGetChildName( at_cfg_path, i, child_name );
813 child_name.ToLower();
814
815 if ( child_name.Contains( platform_support ) )
816 {
818 GetGame().ConfigGetTextArray( at_cfg_path + " " + child_name + " " + "attachmentSlots", attachment_slots );
819
820 for ( int j = 0; j < attachment_slots.Count(); ++j )
821 {
822 //get material
823 ItemBase attachment = ItemBase.Cast( GetParent().FindAttachmentBySlotName( attachment_slots.Get( j ) ) );
824
825 //material still attached
826 if ( attachment )
827 {
829 attachment.GetInventory().GetCurrentInventoryLocation( inventory_location );
830 if (LogManager.IsBaseBuildingLogEnable()) bsbDebugPrint("[bsb] " + Object.GetDebugName(GetParent()) + " DropNonUsableMaterials UNlocking slot=" + inventory_location.GetSlot());
831
832 //unlock slot
833 GetParent().GetInventory().SetSlotLock( inventory_location.GetSlot() , false );
834
835 EntityAI parent = GetParent();
836 if (!parent)
837 parent = player;
838
839 int quantity_max = attachment.GetTargetQuantityMax(-1);
841 vector mat[4];
842 attachment.GetTransform(mat);
843
844 if ( parent.MemoryPointExists("" + part_name + "_materials") )
845 {
846 vector destination = parent.GetMemoryPointPos("" + part_name + "_materials");
847 destination = GetGame().ObjectModelToWorld(parent,destination);
848 float health = attachment.GetHealth("","Health");
849 float quantity = attachment.GetQuantity() - 1;
850 if (quantity < 1.0)
851 quantity = 1.0;
852 float dir[4];
853 inventory_location.GetDir(dir);
854 dst.SetGroundEx(attachment,destination,dir);
855 //Print(dst.DumpToString());
856 MiscGameplayFunctions.CreateItemBasePiles(attachment.GetType(),destination,quantity,health,true);
857 attachment.AddQuantity( -quantity );
858 }
859 else
860 {
861 dst.SetGround(attachment,mat);
862
863 for ( int k = attachment.GetQuantity(); k > quantity_max; )
864 {
865 Object o = parent.GetInventory().LocationCreateEntity( dst, attachment.GetType(), ECE_PLACE_ON_SURFACE, RF_DEFAULT );
866 ItemBase new_item = ItemBase.Cast( o );
867
868 if( new_item )
869 {
870 MiscGameplayFunctions.TransferItemProperties( attachment, new_item );
871 attachment.AddQuantity( -quantity_max );
872 new_item.SetQuantity( quantity_max );
873 }
874 k -= quantity_max;
875 }
876 }
877
878 //drop
879 if (attachment.GetQuantity() > 0)
880 {
881 if ( GetGame().IsMultiplayer() )
882 {
884 }
885 else
886 {
888 }
889 }
890 else
891 {
892 attachment.Delete();
893 }
894 }
895 }
896 }
897 }
898 }
899 }
900 }
const int ECE_PLACE_ON_SURFACE
Definition CentralEconomy.c:37
const int RF_DEFAULT
Definition CentralEconomy.c:65
Definition Building.c:6
override bool LocalTakeToDst(notnull InventoryLocation src, notnull InventoryLocation dst)
Definition Man.c:829
override bool ServerTakeToDst(notnull InventoryLocation src, notnull InventoryLocation dst)
Definition Man.c:834

Перекрестные ссылки bsbDebugPrint(), ECE_PLACE_ON_SURFACE, GetConstructionPart(), GetGame(), GetParent(), LogManager::IsBaseBuildingLogEnable(), EntityAI::LocalTakeToDst(), RF_DEFAULT и EntityAI::ServerTakeToDst().

Используется в DestroyPartServer() и DismantlePartServer().

◆ ExceptionCheck()

bool ExceptionCheck ( string part_name)
protected

Exceptions from 'dependent parts' hierarchy are handled here.

158 {
159 //gate hack
161 if( /*Fence.Cast(m_Parent) && */part.IsGate() )
162 {
163 if( GetConstructionPart("wall_base_down").IsBuilt() || GetConstructionPart("wall_base_up").IsBuilt() )
164 return true;
165 }
166 return false;
167 }

Перекрестные ссылки GetConstructionPart().

Используется в DestroyConnectedParts().

◆ GetBaseConstructionPart()

ConstructionPart GetBaseConstructionPart ( )
protected
379 {
380 for ( int i = 0; i < m_ConstructionParts.Count(); ++i )
381 {
382 string key = m_ConstructionParts.GetKey( i );
384
385 if ( value.IsBase() )
386 {
387 return value;
388 }
389 }
390
391 return NULL;
392 }

Перекрестные ссылки m_ConstructionParts.

◆ GetBoxCenter()

vector GetBoxCenter ( vector min_max[2])
protected
1139 {
1140 vector center;
1141
1142 center[0] = ( min_max[1][0] - min_max[0][0] ) / 2;
1143 center[1] = ( min_max[1][1] - min_max[0][1] ) / 2;
1144 center[2] = ( min_max[1][2] - min_max[0][2] ) / 2;
1145 center = Vector( min_max[1][0] - center[0], min_max[1][1] - center[1], min_max[1][2] - center[2] ); //offset to box center
1146
1147 return center;
1148 }
proto native vector Vector(float x, float y, float z)
Vector constructor from components.

Перекрестные ссылки Vector().

Используется в IsColliding() и IsCollidingEx().

◆ GetCollisionBoxData()

void GetCollisionBoxData ( string part_name,
out vector min_max[2] )
protected
1118 {
1120 string cfg_path = "cfgVehicles" + " " + GetParent().GetType() + " "+ "Construction" + " " + main_part_name + " " + part_name + " " + "collision_data";
1122 GetGame().ConfigGetTextArray( cfg_path, collision_data );
1123
1124 if ( collision_data.Count() > 0 )
1125 {
1126 if ( GetParent().MemoryPointExists( collision_data[0] ) )
1127 {
1128 min_max[0] = GetParent().GetMemoryPointPos( collision_data[0] );
1129 }
1130 if ( GetParent().MemoryPointExists( collision_data[1] ) )
1131 {
1132 min_max[1] = GetParent().GetMemoryPointPos( collision_data[1] );
1133 }
1134 }
1135 }
string GetMainPartName()
Definition ConstructionPart.c:35

Перекрестные ссылки GetConstructionPart(), GetGame(), ConstructionPart::GetMainPartName() и GetParent().

Используется в IsColliding() и IsCollidingEx().

◆ GetCollisionBoxSize()

vector GetCollisionBoxSize ( vector min_max[2])
protected
1106 {
1107 vector box_size = Vector( 0, 0, 0 );
1108
1109 box_size[0] = Math.AbsFloat( min_max[1][0] - min_max[0][0] );
1110 box_size[1] = Math.AbsFloat( min_max[1][1] - min_max[0][1] );
1111 box_size[2] = Math.AbsFloat( min_max[1][2] - min_max[0][2] );
1112
1113 return box_size;
1114 }
Definition EnMath.c:7
static proto float AbsFloat(float f)
Returns absolute value.

Перекрестные ссылки Math::AbsFloat() и Vector().

Используется в GetTriggerExtents(), IsColliding() и IsCollidingEx().

◆ GetConstructionPart()

◆ GetConstructionParts()

map< string, ref ConstructionPart > GetConstructionParts ( )
protected
276 {
277 return m_ConstructionParts;
278 }

Перекрестные ссылки m_ConstructionParts.

◆ GetConstructionPartsToBuild()

void GetConstructionPartsToBuild ( string main_part_name,
out array< ConstructionPart > construction_parts,
ItemBase tool,
out string real_constructionTarget,
bool use_tool )
protected
340 {
341 construction_parts.Clear();
342 string part_name;
344 string key;
345
346 for ( int i = 0; i < m_ConstructionParts.Count(); ++i )
347 {
348 key = m_ConstructionParts.GetKey( i );
350
351 if ( main_part_name == value.GetMainPartName() && CanBuildPart( value.GetPartName(), tool, use_tool ) )
352 {
353 construction_parts.Insert( value );
354 }
355
356 if ( main_part_name == value.GetPartName() )
357 {
358 part_name = value.GetMainPartName();
359 }
360 }
361
362 if( construction_parts.Count() == 0 && part_name )
363 {
364 for ( i = 0; i < m_ConstructionParts.Count(); ++i )
365 {
366 key = m_ConstructionParts.GetKey( i );
368
369 if ( part_name == value.GetMainPartName() && CanBuildPart( value.GetPartName(), tool, use_tool ) )
370 {
371 construction_parts.Insert( value );
372 }
373 }
374 }
375 }
bool CanBuildPart(string part_name, ItemBase tool, bool use_tool)
Definition Construction.c:296

Перекрестные ссылки CanBuildPart() и m_ConstructionParts.

◆ GetConstructionPartToDestroy()

ConstructionPart GetConstructionPartToDestroy ( string part_name)
protected
558 {
559 if ( CanDestroyPart( part_name ) )
560 {
562 }
563
564 return NULL;
565 }
bool CanDestroyPart(string part_name)
Definition Construction.c:567

Перекрестные ссылки CanDestroyPart() и GetConstructionPart().

◆ GetConstructionPartToDismantle()

ConstructionPart GetConstructionPartToDismantle ( string part_name,
ItemBase tool )
protected
459 {
461 {
463 }
464
465 return NULL;
466 }
bool CanDismantlePart(string part_name, ItemBase tool)
Definition Construction.c:468

Перекрестные ссылки CanDismantlePart() и GetConstructionPart().

◆ GetGateConstructionPart()

ConstructionPart GetGateConstructionPart ( )
protected
396 {
397 for ( int i = 0; i < m_ConstructionParts.Count(); ++i )
398 {
399 string key = m_ConstructionParts.GetKey( i );
401
402 if ( value.IsGate() )
403 {
404 return value;
405 }
406 }
407
408 return NULL;
409 }

Перекрестные ссылки m_ConstructionParts.

◆ GetMaterialType()

ConstructionMaterialType GetMaterialType ( string part_name)
protected
998 {
1000 string part_cfg_path = "cfgVehicles" + " " + GetParent().GetType() + " "+ "Construction" + " " + construction_part.GetMainPartName() + " " + construction_part.GetPartName() + " " + "material_type";
1001 if ( GetGame().ConfigIsExisting( part_cfg_path ) )
1002 {
1003 return GetGame().ConfigGetInt( part_cfg_path );
1004 }
1005
1006 return ConstructionMaterialType.MATERIAL_NONE;
1007 }
ConstructionMaterialType
Definition Construction.c:2

Перекрестные ссылки GetConstructionPart(), GetGame() и GetParent().

◆ GetRequiredParts()

array< string > GetRequiredParts ( string part_name,
string main_part_name )
protected
548 {
549 string cfg_path = "cfgVehicles" + " " + GetParent().GetType() + " " + "Construction" + " " + main_part_name + " " + part_name + " " + "required_parts";
551 GetGame().ConfigGetTextArray( cfg_path, required_parts );
552
553 return required_parts;
554 }

Перекрестные ссылки GetGame() и GetParent().

Используется в UpdateConstructionParts().

◆ GetTriggerExtents()

void GetTriggerExtents ( vector min_max[2],
out vector extents[2] )
protected
1151 {
1153 extents[0][0] = -egde_length[0] / 2; //min
1154 extents[0][1] = -egde_length[1] / 2;
1155 extents[0][2] = -egde_length[2] / 2;
1156 extents[1][0] = egde_length[0] / 2; //max
1157 extents[1][1] = egde_length[1] / 2;
1158 extents[1][2] = egde_length[2] / 2;
1159 }
vector GetCollisionBoxSize(vector min_max[2])
Definition Construction.c:1105

Перекрестные ссылки GetCollisionBoxSize().

Используется в CreateCollisionTrigger().

◆ GetValidDepenentPartsArray()

array< string > GetValidDepenentPartsArray ( string part_name,
array< string > recurs = null )
protected
501 {
502 string name;
503 string cfg_path;
505
506 for ( int i = 0; i < m_ConstructionParts.Count(); ++i )
507 {
508 name = m_ConstructionParts.GetKey( i );
510
511 if ( construction_part.IsBuilt() && construction_part.GetRequiredParts() && construction_part.GetRequiredParts().Find( part_name ) > -1 ) //does the construction part need 'part_name' to exist?
512 {
513 if ( !dependent_parts )
514 {
516 }
517
518 if ( !recurs || (recurs.Find(name) == -1 ) )
519 {
520 dependent_parts.Insert(name);
521 }
522// Print("part #" + i + ": " + name);
523 }
524 }
525
526 //fully recursive search, disconnected (unnescessary)
527 /*if (dependent_parts)
528 {
529 if ( dependent_parts.Count() > 0 )
530 {
531 ref array<string> temp = new array<string>;
532 for ( i = 0; i < dependent_parts.Count(); i++ )
533 {
534 temp = GetValidDepenentPartsArray(dependent_parts.Get(i),dependent_parts);
535 if (temp.Count() > 0)
536 {
537 dependent_parts.InsertAll(temp);
538 }
539 }
540 }
541 Print("dependent_parts.Count(): " + dependent_parts.Count());
542 }*/
543 return dependent_parts;
544 }
PlayerSpawnPresetDiscreteItemSetSlotData name
one set for cargo

Перекрестные ссылки m_ConstructionParts и name.

Используется в DestroyConnectedParts().

◆ HasConflictPart()

bool HasConflictPart ( string part_name)
protected
439 {
441 string cfg_path = "cfgVehicles" + " " + GetParent().GetType() + " "+ "Construction" + " " + main_part_name + " " + part_name + " " + "conflicted_parts";
443 GetGame().ConfigGetTextArray( cfg_path, conflict_parts );
444
445 //check if parts are already built
446 for ( int i = 0; i < conflict_parts.Count(); i++ )
447 {
448 if ( IsPartConstructed( conflict_parts.Get( i ) ) )
449 {
450 return true;
451 }
452 }
453
454 return false;
455 }

Перекрестные ссылки GetConstructionPart(), GetGame(), ConstructionPart::GetMainPartName(), GetParent() и IsPartConstructed().

Используется в CanBuildPart().

◆ HasDependentPart()

bool HasDependentPart ( string part_name)
protected
481 {
482 for ( int i = 0; i < m_ConstructionParts.Count(); ++i )
483 {
484 string key = m_ConstructionParts.GetKey( i );
486
487 if ( construction_part.IsBuilt() )
488 {
489 if ( construction_part.GetRequiredParts().Find( part_name ) > -1 )
490 {
491 return true;
492 }
493 }
494 }
495
496 return false;
497 }

Перекрестные ссылки m_ConstructionParts.

Используется в CanDestroyPart() и CanDismantlePart().

◆ HasMaterials()

bool HasMaterials ( string part_name,
bool repairing = false )
protected
619 {
621 string cfg_path = "cfgVehicles" + " " + GetParent().GetType() + " "+ "Construction" + " " + main_part_name + " " + part_name + " " + "Materials";
622
623 if ( GetGame().ConfigIsExisting( cfg_path ) )
624 {
625 int child_count = GetGame().ConfigGetChildrenCount( cfg_path );
626
627 for ( int i = 0; i < child_count; i++ )
628 {
629 string child_name;
630 GetGame().ConfigGetChildName( cfg_path, i, child_name );
631
632 //get type, quantity from material
633 string material_path;
634 string slot_name;
635 float quantity;
636 material_path = cfg_path + " " + child_name + " " + "slot_name";
637 GetGame().ConfigGetText( material_path, slot_name );
638 material_path = cfg_path + " " + child_name + " " + "quantity";
639 quantity = GetGame().ConfigGetFloat( material_path );
640
641 if (repairing)
642 {
645 }
646
647 //if the selected material (or its quantity) is not available
649 {
650 return false;
651 }
652 }
653 }
654
655 return true; //return true even if no material required
656 }
enum ConstructionMaterialType REPAIR_MATERIAL_PERCENTAGE
bool HasMaterialWithQuantityAttached(string slot_name, float quantity)
Definition Construction.c:659
static proto float Max(float x, float y)
Returns bigger of two given values.
static proto float Floor(float f)
Returns floor of value.

Перекрестные ссылки Math::Floor(), GetConstructionPart(), GetGame(), ConstructionPart::GetMainPartName(), GetParent(), HasMaterialWithQuantityAttached(), Math::Max() и REPAIR_MATERIAL_PERCENTAGE.

Используется в CanBuildPart().

◆ HasMaterialWithQuantityAttached()

bool HasMaterialWithQuantityAttached ( string slot_name,
float quantity )
protected
660 {
661 ItemBase attachment = ItemBase.Cast( GetParent().FindAttachmentBySlotName( slot_name ) );
662
663 if ( attachment && attachment.GetQuantity() >= quantity )
664 {
665 return true;
666 }
667
668 return false;
669 }

Перекрестные ссылки GetParent().

Используется в HasMaterials().

◆ HasRequiredPart()

bool HasRequiredPart ( string part_name)
protected
413 {
415 string cfg_path = "cfgVehicles" + " " + GetParent().GetType() + " "+ "Construction" + " " + main_part_name + " " + part_name + " " + "required_parts";
416
418 GetGame().ConfigGetTextArray( cfg_path, required_parts );
419
420 //check if parts are already built
421 for ( int i = 0; i < required_parts.Count(); ++i )
422 {
423 if ( !IsPartConstructed( required_parts.Get( i ) ) )
424 {
425 return false;
426 }
427 //hack - gate
428 /*else if (part_name == "wall_gate" && (IsPartConstructed("wall_base_down") || IsPartConstructed("wall_base_up")))
429 {
430 return true;
431 }*/
432 }
433
434 return true;
435 }

Перекрестные ссылки GetConstructionPart(), GetGame(), ConstructionPart::GetMainPartName(), GetParent() и IsPartConstructed().

Используется в CanBuildPart().

◆ HideConstructionPart()

void HideConstructionPart ( string part_name)
protected
586 {
587 if (LogManager.IsBaseBuildingLogEnable()) bsbDebugPrint("[bsb] Construction HideConstructionPart - " + part_name);
588 GetParent().SetAnimationPhase( part_name, 1 );
589 }

Перекрестные ссылки bsbDebugPrint(), GetParent() и LogManager::IsBaseBuildingLogEnable().

Используется в UpdateVisuals().

◆ HideConstructionPartPhysics()

void HideConstructionPartPhysics ( string part_name)
protected
598 {
599 GetParent().RemoveProxyPhysics( part_name );
600 }

Перекрестные ссылки GetParent().

Используется в UpdatePhysics().

◆ Init()

void Init ( )
protected

Launched from 'DayZGame.DeferredInit' to make earlier access, use, and updates impossible (downside of a non-static system)

35 {
37 }
void UpdateConstructionParts()
Definition Construction.c:235

Перекрестные ссылки UpdateConstructionParts().

◆ InitBaseState()

void InitBaseState ( )
protected
229 {
230 if (LogManager.IsBaseBuildingLogEnable()) bsbDebugPrint("[bsb] Construction " + Object.GetDebugName(m_Parent) + " InitBaseState");
231 InitVisuals();
232 }
void InitVisuals()
Definition Construction.c:173

Перекрестные ссылки bsbDebugPrint(), InitVisuals(), LogManager::IsBaseBuildingLogEnable() и m_Parent.

Используется в ItemBase::EEInit().

◆ InitVisuals()

void InitVisuals ( )
protected
174 {
175 if (LogManager.IsBaseBuildingLogEnable()) bsbDebugPrint("[bsb] Construction " + Object.GetDebugName(m_Parent) + " InitVisuals");
176 for ( int i = 0; i < m_ConstructionParts.Count(); ++i )
177 {
178 string key = m_ConstructionParts.GetKey( i );
180
181 if ( value.IsBuilt() )
182 {
183 ShowConstructionPart( value.GetPartName() );
184 }
185 }
186 }
void ShowConstructionPart(string part_name)
Definition Construction.c:579

Перекрестные ссылки bsbDebugPrint(), LogManager::IsBaseBuildingLogEnable(), m_ConstructionParts, m_Parent и ShowConstructionPart().

Используется в InitBaseState() и ItemBase::InitBaseState().

◆ IsColliding()

bool IsColliding ( string part_name)
protected
1014 {
1016 return false;
1018
1019 if ( construction_part )
1020 {
1021 vector center;
1022 float absolute_ofset = 0.05; //we need to lift BBox even more, because it colliddes with house floors due to various reasons (probably geometry or float imperfections)
1024 vector min_max[2]; //data used for creating trigger
1027
1028 excluded_objects.Insert( GetParent() );
1029
1030 //get min_max and center from config and memory points
1032
1034 center = GetParent().ModelToWorld( center ); //convert to world coordinates
1036
1037 //Create trigger
1038 //CreateCollisionTrigger( part_name, min_max, center );
1039
1040 //check collision on box trigger and collision box
1041 //IsTrigger colliding was turned off (for now) for easier way to build something with other players around
1042 if ( /* IsTriggerColliding() || */ GetGame().IsBoxCollidingGeometry( Vector( center[0], center[1] + absolute_ofset, center[2] ), GetParent().GetOrientation(), edge_length, ObjIntersectView, ObjIntersectGeom, excluded_objects, collided_objects ) )
1043 {
1044 //Debug
1045// DrawDebugCollisionBox( min_max, ARGB( 150, 255, 0, 0 ) );
1046 //
1047 for (int i = 0; i < collided_objects.Count(); i++)
1048 {
1049 //Print(collided_objects.Get(i).GetType());
1051 if ( entity && !entity.IsIgnoredByConstruction() )
1052 return true;
1053 }
1054 }
1055 //Debug
1056// DrawDebugCollisionBox( min_max, ARGB( 150, 255, 255, 255 ) );
1057 }
1058 return false;
1059 }
vector GetBoxCenter(vector min_max[2])
Definition Construction.c:1138
void GetCollisionBoxData(string part_name, out vector min_max[2])
Definition Construction.c:1117
Definition CfgGameplayHandler.c:2
static bool GetDisableIsCollidingCheck()
Definition CfgGameplayHandler.c:317

Перекрестные ссылки GetBoxCenter(), GetCollisionBoxData(), GetCollisionBoxSize(), GetConstructionPart(), CfgGameplayHandler::GetDisableIsCollidingCheck(), GetGame(), GetOrientation(), GetParent() и Vector().

◆ IsCollidingEx()

bool IsCollidingEx ( CollisionCheckData check_data)
protected

Collision check for building part.

1063 {
1065 return false;
1067
1068 if ( construction_part )
1069 {
1070 vector center;
1071 float absolute_ofset = 0.05; //we need to lift BBox even more, because it colliddes with house floors due to various reasons (probably geometry or float imperfections)
1073 vector min_max[2]; //data used for creating trigger
1076
1077 excluded_objects.Insert( GetParent() );
1078 if (check_data.m_AdditionalExcludes.Count() > 0)
1079 {
1080 excluded_objects.InsertAll(check_data.m_AdditionalExcludes);
1081 }
1082
1083 GetCollisionBoxData( check_data.m_PartName, min_max );
1085 center = GetParent().ModelToWorld( center ); //convert to world coordinates
1087
1088 if ( GetGame().IsBoxCollidingGeometry( Vector( center[0], center[1] + absolute_ofset, center[2] ), GetParent().GetOrientation(), edge_length, check_data.m_PrimaryGeometry, check_data.m_SecondaryGeometry, excluded_objects, collided_objects ) )
1089 {
1090 //Debug
1091 //DrawDebugCollisionBox( min_max, ARGB( 150, 255, 0, 0 ) );
1092 for (int i = 0; i < collided_objects.Count(); i++)
1093 {
1095 if ( entity && !entity.IsIgnoredByConstruction() )
1096 return true;
1097 }
1098 }
1099 //Debug
1100 //DrawDebugCollisionBox( min_max, ARGB( 150, 255, 255, 255 ) );
1101 }
1102 return false;
1103 }

Перекрестные ссылки GetBoxCenter(), GetCollisionBoxData(), GetCollisionBoxSize(), GetConstructionPart(), CfgGameplayHandler::GetDisableIsCollidingCheck(), GetGame(), GetOrientation(), GetParent() и Vector().

◆ IsPartConstructed()

bool IsPartConstructed ( string part_name)
protected

◆ IsTriggerColliding()

bool IsTriggerColliding ( )
protected
1217 {
1219 }
bool IsColliding()
Definition Construction.c:1340

Перекрестные ссылки ConstructionBoxTrigger::IsColliding() и m_ConstructionBoxTrigger.

◆ MaterialIsRuined()

bool MaterialIsRuined ( string part_name)
protected
307 {
309 string cfg_path = "cfgVehicles" + " " + GetParent().GetType() + " "+ "Construction" + " " + main_part_name + " " + part_name + " " + "Materials";
310
311 if ( GetGame().ConfigIsExisting( cfg_path ) )
312 {
313 int child_count = GetGame().ConfigGetChildrenCount( cfg_path );
314
315 for ( int i = 0; i < child_count; i++ )
316 {
317 string child_name;
318 GetGame().ConfigGetChildName( cfg_path, i, child_name );
319
320 //get type, quantity from material
321 string config_path;
322 string slot_name;
323 config_path = cfg_path + " " + child_name + " " + "slot_name";
324 GetGame().ConfigGetText( config_path, slot_name );
325 config_path = cfg_path + " " + child_name + " " + "quantity";
326 float quantity = GetGame().ConfigGetFloat( config_path );
327 config_path = cfg_path + " " + child_name + " " + "lockable";
328 bool lockable = GetGame().ConfigGetInt( config_path );
329
330 ItemBase attachment = ItemBase.Cast( GetParent().FindAttachmentBySlotName( slot_name ) );
331 if (attachment.IsRuined())
332 return true;
333 }
334 }
335 return false;
336 }

Перекрестные ссылки GetConstructionPart(), GetGame(), ConstructionPart::GetMainPartName() и GetParent().

Используется в CanBuildPart().

◆ ReceiveMaterialsServer()

void ReceiveMaterialsServer ( notnull Man player,
string part_name,
string damagezone_name )
protected
728 {
730 bool is_base = construction_part.IsBase();
731 string main_part_name = construction_part.GetMainPartName();
732 string cfg_path = "cfgVehicles" + " " + GetParent().GetType() + " "+ "Construction" + " " + main_part_name + " " + part_name + " " + "Materials";
733
734 if ( GetGame().ConfigIsExisting( cfg_path ) )
735 {
737 }
738 }
Definition Construction.c:1223
static void SpawnConstructionMaterialPiles(notnull EntityAI entity, Man player, string cfg_path, string main_part_name, string damagezone_name="", bool is_base=false)
spawns material from any construction; 'player' parameter optional
Definition Construction.c:1225

Перекрестные ссылки GetConstructionPart(), GetGame(), GetParent() и StaticConstructionMethods::SpawnConstructionMaterialPiles().

Используется в DismantlePartServer().

◆ RemoveFromConstructedParts()

void RemoveFromConstructedParts ( string part_name)
protected
64 {
66
67 if ( constrution_part )
68 {
69 if (LogManager.IsBaseBuildingLogEnable()) bsbDebugPrint("[bsb] Construction " + Object.GetDebugName(m_Parent) + " RemoveFromConstructedParts part=" + constrution_part.GetPartName());
70 constrution_part.SetBuiltState( false );
71 }
72 }

Перекрестные ссылки bsbDebugPrint(), GetConstructionPart(), LogManager::IsBaseBuildingLogEnable() и m_Parent.

◆ SetLockOnAttachedMaterials()

void SetLockOnAttachedMaterials ( string part_name,
bool lock_slot )
protected
904 {
906 string cfg_path = "cfgVehicles" + " " + GetParent().GetType() + " "+ "Construction" + " " + main_part_name + " " + part_name + " " + "Materials";
907
908 if ( GetGame().ConfigIsExisting( cfg_path ) )
909 {
910 int child_count = GetGame().ConfigGetChildrenCount( cfg_path );
911
912 for ( int i = 0; i < child_count; i++ )
913 {
914 string child_name;
915 GetGame().ConfigGetChildName( cfg_path, i, child_name );
916
917 //get type, quantity from material
918 string config_path;
919 string type;
920 string slot_name;
921 config_path = cfg_path + " " + child_name + " " + "type";
922 GetGame().ConfigGetText( config_path, type );
923 config_path = cfg_path + " " + child_name + " " + "slot_name";
924 GetGame().ConfigGetText( config_path, slot_name );
925 config_path = cfg_path + " " + child_name + " " + "quantity";
926 float quantity = GetGame().ConfigGetFloat( config_path );
927 config_path = cfg_path + " " + child_name + " " + "lockable";
928 bool lockable = GetGame().ConfigGetInt( config_path );
929
930 //get material
931 ItemBase attachment = ItemBase.Cast( GetParent().FindAttachmentBySlotName( slot_name ) );
932
933 //material still attached
934 if ( lockable ) //if lockable
935 {
936 if ( attachment )
937 {
939 attachment.GetInventory().GetCurrentInventoryLocation( inventory_location );
940 if (LogManager.IsBaseBuildingLogEnable()) bsbDebugPrint("[bsb] " + Object.GetDebugName(GetParent()) + " SetLockOnAttachedMaterials lock=" + lock_slot +" slot=" + inventory_location.GetSlot());
941 GetParent().GetInventory().SetSlotLock( inventory_location.GetSlot(), lock_slot );
942 }
943 }
944 }
945 }
946 }

Перекрестные ссылки bsbDebugPrint(), GetConstructionPart(), GetGame(), ConstructionPart::GetMainPartName(), GetParent() и LogManager::IsBaseBuildingLogEnable().

◆ SetParent()

void SetParent ( BaseBuildingBase parent)
protected
45 {
46 m_Parent = parent;
47 }

Перекрестные ссылки m_Parent.

◆ ShowConstructionPart()

void ShowConstructionPart ( string part_name)
protected
580 {
581 if (LogManager.IsBaseBuildingLogEnable()) bsbDebugPrint("[bsb] Construction ShowConstructionPart - " + part_name);
582 GetParent().SetAnimationPhase( part_name, 0 );
583 }

Перекрестные ссылки bsbDebugPrint(), GetParent() и LogManager::IsBaseBuildingLogEnable().

Используется в InitVisuals() и UpdateVisuals().

◆ ShowConstructionPartPhysics()

void ShowConstructionPartPhysics ( string part_name)
protected
593 {
594 GetParent().AddProxyPhysics( part_name );
595 }

Перекрестные ссылки GetParent().

Используется в UpdatePhysics().

◆ TakeMaterialsServer()

void TakeMaterialsServer ( string part_name,
bool repairing = false )
protected
673 {
675 string cfg_path = "cfgVehicles" + " " + GetParent().GetType() + " "+ "Construction" + " " + main_part_name + " " + part_name + " " + "Materials";
676
677 if ( GetGame().ConfigIsExisting( cfg_path ) )
678 {
679 int child_count = GetGame().ConfigGetChildrenCount( cfg_path );
680
681 for ( int i = 0; i < child_count; i++ )
682 {
683 string child_name;
684 GetGame().ConfigGetChildName( cfg_path, i, child_name );
685
686 //get type, quantity from material
687 string config_path;
688 string slot_name;
689 config_path = cfg_path + " " + child_name + " " + "slot_name";
690 GetGame().ConfigGetText( config_path, slot_name );
691 config_path = cfg_path + " " + child_name + " " + "quantity";
692 float quantity = GetGame().ConfigGetFloat( config_path );
693 config_path = cfg_path + " " + child_name + " " + "lockable";
694 bool lockable = GetGame().ConfigGetInt( config_path );
695
696 ItemBase attachment = ItemBase.Cast( GetParent().FindAttachmentBySlotName( slot_name ) );
697 if ( lockable )
698 {
699 //lock attachment
701 attachment.GetInventory().GetCurrentInventoryLocation( inventory_location );
702
703 GetParent().GetInventory().SetSlotLock( inventory_location.GetSlot(), true );
704 }
705 else
706 {
707 if ( quantity > -1 ) //0 - ignores quantity
708 {
709 if (repairing)
710 {
713 }
714 //subtract quantity
715 attachment.AddQuantity( -quantity );
716 }
717 else //-1 - deletes the object
718 {
719 GetGame().ObjectDelete( attachment );
720 }
721 }
722 }
723 }
724 }

Перекрестные ссылки Math::Floor(), GetConstructionPart(), GetGame(), ConstructionPart::GetMainPartName(), GetParent(), Math::Max() и REPAIR_MATERIAL_PERCENTAGE.

Используется в BuildPartServer().

◆ UpdateConstructionParts()

void UpdateConstructionParts ( )
protected
236 {
237 m_ConstructionParts.Clear();
238
239 string construction_path = "cfgVehicles" + " " + GetParent().GetType() + " " + "Construction";
240
241 if ( GetGame().ConfigIsExisting( construction_path ) )
242 {
243 //main parts
244 for ( int i = 0; i < GetGame().ConfigGetChildrenCount( construction_path ); ++i )
245 {
246 string main_part_name;
247 GetGame().ConfigGetChildName( construction_path, i, main_part_name );
249
250 //parts
251 for ( int j = 0; j < GetGame().ConfigGetChildrenCount( part_path ); ++j )
252 {
253 string part_name;
254 GetGame().ConfigGetChildName( part_path, j, part_name );
255
256 string name;
257 GetGame().ConfigGetTextRaw( part_path + " " + part_name + " " + "name", name ); //name
258 GetGame().FormatRawConfigStringKeys(name);
259 bool show_on_init = GetGame().ConfigGetInt( part_path + " " + part_name + " " + "show_on_init" ); //show on init
260 int id = GetGame().ConfigGetInt( part_path + " " + part_name + " " + "id" ); //part id
261 bool is_base = GetGame().ConfigGetInt( part_path + " " + part_name + " " + "is_base" ); //is base (part)
262 bool is_gate = GetGame().ConfigGetInt( part_path + " " + part_name + " " + "is_gate" ); //is gate (part)
263
265
266 if (LogManager.IsBaseBuildingLogEnable()) bsbDebugPrint("[bsb] Construction name=" + name + " part_name=" + part_name + " show=" + show_on_init + " base=" + is_base + " gate=" + is_gate);
267 }
268 }
269 }
270 }
array< string > GetRequiredParts(string part_name, string main_part_name)
Definition Construction.c:547

Перекрестные ссылки bsbDebugPrint(), GetGame(), GetParent(), GetRequiredParts(), LogManager::IsBaseBuildingLogEnable(), m_ConstructionParts и name.

Используется в Init().

◆ UpdatePhysics()

void UpdatePhysics ( )
protected
208 {
209 if (LogManager.IsBaseBuildingLogEnable()) bsbDebugPrint("[bsb] Construction " + Object.GetDebugName(m_Parent) + " UpdatePhysics m_ConstructionParts=" + m_ConstructionParts.Count());
210 for ( int i = 0; i < m_ConstructionParts.Count(); ++i )
211 {
212 string key = m_ConstructionParts.GetKey( i );
214
215 if ( value.IsBuilt() )
216 {
217 if (LogManager.IsBaseBuildingLogEnable()) bsbDebugPrint("[bsb] GetType=" + m_Parent.GetType() + " i=" + i + " ADD");
218 ShowConstructionPartPhysics( value.GetPartName() );
219 }
220 else
221 {
222 if (LogManager.IsBaseBuildingLogEnable()) bsbDebugPrint("[bsb] GetType=" + m_Parent.GetType() + " i=" + i + " RM");
223 HideConstructionPartPhysics( value.GetPartName() );
224 }
225 }
226 }
void HideConstructionPartPhysics(string part_name)
Definition Construction.c:597
void ShowConstructionPartPhysics(string part_name)
Definition Construction.c:592

Перекрестные ссылки bsbDebugPrint(), HideConstructionPartPhysics(), LogManager::IsBaseBuildingLogEnable(), m_ConstructionParts, m_Parent и ShowConstructionPartPhysics().

Используется в ItemBase::EEInit(), ItemBase::OnItemLocationChanged(), ItemBase::Refresh() и ItemBase::RefreshPhysics().

◆ UpdateVisuals()

void UpdateVisuals ( )
protected

Переменные

◆ DECONSTURCT_MATERIAL_LOSS

const float DECONSTURCT_MATERIAL_LOSS = 0.2
static

◆ m_AdditionalExcludes

class StaticConstructionMethods m_AdditionalExcludes
protected

Data structure for passing parameters (extendable, modable)

Используется в CollisionCheckData().

◆ m_CollisionBox

Shape m_CollisionBox
protected

Используется в DestroyDebugCollisionBox() и DrawDebugCollisionBox().

◆ m_ConstructionBoxTrigger

ConstructionBoxTrigger m_ConstructionBoxTrigger
protected

◆ m_ConstructionParts

◆ m_Parent

BaseBuildingBase m_Parent
protected

◆ m_PartName

string m_PartName
protected

Используется в CollisionCheckData().

◆ m_PrimaryGeometry

int m_PrimaryGeometry
protected

Используется в CollisionCheckData().

◆ m_SecondaryGeometry

int m_SecondaryGeometry
protected

Используется в CollisionCheckData().

◆ REPAIR_MATERIAL_PERCENTAGE

enum ConstructionMaterialType REPAIR_MATERIAL_PERCENTAGE = 0.15

Используется в HasMaterials() и TakeMaterialsServer().