Dayz 1.25
Dayz Code 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:1224
ConstructionPart GetConstructionPart(string part_name)
Definition Construction.c:278
BaseBuildingBase m_Parent
Definition Construction.c:16
Definition ConstructionPart.c:2
Definition Debug.c:735
static bool IsBaseBuildingLogEnable()
Definition Debug.c:839
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:1300
void TakeMaterialsServer(string part_name, bool repairing=false)
Definition Construction.c:670
void DestroyCollisionTrigger()
Definition Construction.c:1208
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
295 {
297 {
298 return true;
299 }
300
301 return false;
302 }
bool HasMaterials(string part_name, bool repairing=false)
Definition Construction.c:616
bool MaterialIsRuined(string part_name)
Definition Construction.c:304
bool HasConflictPart(string part_name)
Definition Construction.c:436
bool IsPartConstructed(string part_name)
Definition Construction.c:601
bool CanUseToolToBuildPart(string part_name, ItemBase tool)
Definition Construction.c:949
bool HasRequiredPart(string part_name)
Definition Construction.c:410

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

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

◆ CanDestroyPart()

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

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

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

◆ CanDismantlePart()

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

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

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

◆ CanUseToolToBuildPart()

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

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

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

◆ CanUseToolToDismantlePart()

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

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

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

◆ CollisionCheckData()

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

Перекрестные ссылки 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
1181 {
1183 {
1184 if ( m_ConstructionBoxTrigger.GetPartName() == part_name ) //already created
1185 {
1186 return;
1187 }
1188 else
1189 {
1191 }
1192 }
1193
1194 //get proper trigger extents (min<max)
1195 vector extents[2];
1197
1198 //create trigger
1199 m_ConstructionBoxTrigger = ConstructionBoxTrigger.Cast( GetGame().CreateObject( "ConstructionBoxTrigger", center, false, false, false ) );
1200 m_ConstructionBoxTrigger.SetPosition( center );
1201 m_ConstructionBoxTrigger.SetOrientation( GetParent().GetOrientation() );
1203
1205 }
vector GetOrientation()
Definition AreaDamageManager.c:306
void GetTriggerExtents(vector min_max[2], out vector extents[2])
Definition Construction.c:1148
ConstructionBoxTrigger m_ConstructionBoxTrigger
Definition Construction.c:21
Definition Construction.c:1320
void SetPartName(string part_name)
Definition Construction.c:1323
string GetPartName()
Definition Construction.c:1328
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
1209 {
1210 GetGame().ObjectDelete( m_ConstructionBoxTrigger );
1212 }

Перекрестные ссылки 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:498
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
1172 {
1173 if ( m_CollisionBox )
1174 {
1175 m_CollisionBox.Destroy();
1177 }
1178 }
Shape m_CollisionBox
Definition Construction.c:19

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

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

◆ DestroyMaterialsServer()

void DestroyMaterialsServer ( Man player,
string part_name )
protected
740 {
742 string main_part_name = cPart.GetMainPartName();
743 string cfg_path = "cfgVehicles" + " " + GetParent().GetType() + " "+ "Construction" + " " + main_part_name + " " + part_name + " " + "Materials";
744
745 if ( GetGame().ConfigIsExisting( cfg_path ) )
746 {
747 int child_count = GetGame().ConfigGetChildrenCount( cfg_path );
748
749 for ( int i = 0; i < child_count; i++ )
750 {
751 string child_name;
752 GetGame().ConfigGetChildName( cfg_path, i, child_name );
753
754 //get type, quantity from material
755 string config_path;
756 string type;
757 string slot_name;
758 config_path = cfg_path + " " + child_name + " " + "type";
759 GetGame().ConfigGetText( config_path, type );
760 config_path = cfg_path + " " + child_name + " " + "slot_name";
761 GetGame().ConfigGetText( config_path, slot_name );
762 config_path = cfg_path + " " + child_name + " " + "quantity";
763 float quantity = GetGame().ConfigGetFloat( config_path );
764 config_path = cfg_path + " " + child_name + " " + "lockable";
765 bool lockable = GetGame().ConfigGetInt( config_path );
766
767 //get material
768 ItemBase attachment = ItemBase.Cast( GetParent().FindAttachmentBySlotName( slot_name ) );
769
770 //material still attached
771 if ( lockable ) //if lockable
772 {
773 if ( attachment )
774 {
776 attachment.GetInventory().GetCurrentInventoryLocation( inventory_location );
777 if (LogManager.IsBaseBuildingLogEnable()) bsbDebugPrint("[bsb] " + Object.GetDebugName(GetParent()) + " DestroyMaterialsServer unlock slot=" + inventory_location.GetSlot());
778
779 GetParent().GetInventory().SetSlotLock( inventory_location.GetSlot() , false );
780 GetGame().ObjectDelete( attachment ); //delete object
781 }
782 }
783 }
784 }
785 }
InventoryLocation.
Definition InventoryLocation.c:28
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:787
void DestroyMaterialsServer(Man player, string part_name)
Definition Construction.c:739
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:725
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
1161 {
1163
1164 vector mat[4];
1165 GetParent().GetTransform( mat );
1166
1168 m_CollisionBox.SetMatrix( mat );
1169 }
void DestroyDebugCollisionBox()
Definition Construction.c:1171
Definition Debug.c:14
static Shape DrawBox(vector pos1, vector pos2, int color=0x1fff7f7f)
Definition Debug.c:452

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

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

◆ DropNonUsableMaterialsServer()

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

Перекрестные ссылки 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
377 {
378 for ( int i = 0; i < m_ConstructionParts.Count(); ++i )
379 {
380 string key = m_ConstructionParts.GetKey( i );
382
383 if ( value.IsBase() )
384 {
385 return value;
386 }
387 }
388
389 return NULL;
390 }

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

◆ GetBoxCenter()

vector GetBoxCenter ( vector min_max[2])
protected
1137 {
1138 vector center;
1139
1140 center[0] = ( min_max[1][0] - min_max[0][0] ) / 2;
1141 center[1] = ( min_max[1][1] - min_max[0][1] ) / 2;
1142 center[2] = ( min_max[1][2] - min_max[0][2] ) / 2;
1143 center = Vector( min_max[1][0] - center[0], min_max[1][1] - center[1], min_max[1][2] - center[2] ); //offset to box center
1144
1145 return center;
1146 }
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
1116 {
1118 string cfg_path = "cfgVehicles" + " " + GetParent().GetType() + " "+ "Construction" + " " + main_part_name + " " + part_name + " " + "collision_data";
1120 GetGame().ConfigGetTextArray( cfg_path, collision_data );
1121
1122 if ( collision_data.Count() > 0 )
1123 {
1124 if ( GetParent().MemoryPointExists( collision_data[0] ) )
1125 {
1126 min_max[0] = GetParent().GetMemoryPointPos( collision_data[0] );
1127 }
1128 if ( GetParent().MemoryPointExists( collision_data[1] ) )
1129 {
1130 min_max[1] = GetParent().GetMemoryPointPos( collision_data[1] );
1131 }
1132 }
1133 }
string GetMainPartName()
Definition ConstructionPart.c:35

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

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

◆ GetCollisionBoxSize()

vector GetCollisionBoxSize ( vector min_max[2])
protected
1104 {
1105 vector box_size = Vector( 0, 0, 0 );
1106
1107 box_size[0] = Math.AbsFloat( min_max[1][0] - min_max[0][0] );
1108 box_size[1] = Math.AbsFloat( min_max[1][1] - min_max[0][1] );
1109 box_size[2] = Math.AbsFloat( min_max[1][2] - min_max[0][2] );
1110
1111 return box_size;
1112 }
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
274 {
275 return m_ConstructionParts;
276 }

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

◆ GetConstructionPartsToBuild()

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

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

◆ GetConstructionPartToDestroy()

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

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

◆ GetConstructionPartToDismantle()

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

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

◆ GetGateConstructionPart()

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

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

◆ GetMaterialType()

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

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

◆ GetRequiredParts()

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

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

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

◆ GetTriggerExtents()

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

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

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

◆ GetValidDepenentPartsArray()

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

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

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

◆ HasConflictPart()

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

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

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

◆ HasDependentPart()

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

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

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

◆ HasMaterials()

bool HasMaterials ( string part_name,
bool repairing = false )
protected
617 {
619 string cfg_path = "cfgVehicles" + " " + GetParent().GetType() + " "+ "Construction" + " " + main_part_name + " " + part_name + " " + "Materials";
620
621 if ( GetGame().ConfigIsExisting( cfg_path ) )
622 {
623 int child_count = GetGame().ConfigGetChildrenCount( cfg_path );
624
625 for ( int i = 0; i < child_count; i++ )
626 {
627 string child_name;
628 GetGame().ConfigGetChildName( cfg_path, i, child_name );
629
630 //get type, quantity from material
631 string material_path;
632 string slot_name;
633 float quantity;
634 material_path = cfg_path + " " + child_name + " " + "slot_name";
635 GetGame().ConfigGetText( material_path, slot_name );
636 material_path = cfg_path + " " + child_name + " " + "quantity";
637 quantity = GetGame().ConfigGetFloat( material_path );
638
639 if (repairing)
640 {
643 }
644
645 //if the selected material (or its quantity) is not available
647 {
648 return false;
649 }
650 }
651 }
652
653 return true; //return true even if no material required
654 }
enum ConstructionMaterialType REPAIR_MATERIAL_PERCENTAGE
bool HasMaterialWithQuantityAttached(string slot_name, float quantity)
Definition Construction.c:657
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
658 {
659 ItemBase attachment = ItemBase.Cast( GetParent().FindAttachmentBySlotName( slot_name ) );
660
661 if ( attachment && attachment.GetQuantity() >= quantity )
662 {
663 return true;
664 }
665
666 return false;
667 }

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

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

◆ HasRequiredPart()

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

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

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

◆ HideConstructionPart()

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

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

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

◆ HideConstructionPartPhysics()

void HideConstructionPartPhysics ( string part_name)
protected
596 {
597 GetParent().RemoveProxyPhysics( part_name );
598 }

Перекрестные ссылки 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:577

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

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

◆ IsColliding()

bool IsColliding ( string part_name)
protected
1012 {
1014 return false;
1016
1017 if ( construction_part )
1018 {
1019 vector center;
1020 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)
1022 vector min_max[2]; //data used for creating trigger
1025
1026 excluded_objects.Insert( GetParent() );
1027
1028 //get min_max and center from config and memory points
1030
1032 center = GetParent().ModelToWorld( center ); //convert to world coordinates
1034
1035 //Create trigger
1036 //CreateCollisionTrigger( part_name, min_max, center );
1037
1038 //check collision on box trigger and collision box
1039 //IsTrigger colliding was turned off (for now) for easier way to build something with other players around
1040 if ( /* IsTriggerColliding() || */ GetGame().IsBoxCollidingGeometry( Vector( center[0], center[1] + absolute_ofset, center[2] ), GetParent().GetOrientation(), edge_length, ObjIntersectView, ObjIntersectGeom, excluded_objects, collided_objects ) )
1041 {
1042 //Debug
1043// DrawDebugCollisionBox( min_max, ARGB( 150, 255, 0, 0 ) );
1044 //
1045 for (int i = 0; i < collided_objects.Count(); i++)
1046 {
1047 //Print(collided_objects.Get(i).GetType());
1049 if ( entity && !entity.IsIgnoredByConstruction() )
1050 return true;
1051 }
1052 }
1053 //Debug
1054// DrawDebugCollisionBox( min_max, ARGB( 150, 255, 255, 255 ) );
1055 }
1056 return false;
1057 }
vector GetBoxCenter(vector min_max[2])
Definition Construction.c:1136
void GetCollisionBoxData(string part_name, out vector min_max[2])
Definition Construction.c:1115
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.

1061 {
1063 return false;
1065
1066 if ( construction_part )
1067 {
1068 vector center;
1069 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)
1071 vector min_max[2]; //data used for creating trigger
1074
1075 excluded_objects.Insert( GetParent() );
1076 if (check_data.m_AdditionalExcludes.Count() > 0)
1077 {
1078 excluded_objects.InsertAll(check_data.m_AdditionalExcludes);
1079 }
1080
1081 GetCollisionBoxData( check_data.m_PartName, min_max );
1083 center = GetParent().ModelToWorld( center ); //convert to world coordinates
1085
1086 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 ) )
1087 {
1088 //Debug
1089 //DrawDebugCollisionBox( min_max, ARGB( 150, 255, 0, 0 ) );
1090 for (int i = 0; i < collided_objects.Count(); i++)
1091 {
1093 if ( entity && !entity.IsIgnoredByConstruction() )
1094 return true;
1095 }
1096 }
1097 //Debug
1098 //DrawDebugCollisionBox( min_max, ARGB( 150, 255, 255, 255 ) );
1099 }
1100 return false;
1101 }

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

◆ IsPartConstructed()

bool IsPartConstructed ( string part_name)
protected

◆ IsTriggerColliding()

bool IsTriggerColliding ( )
protected
1215 {
1217 }
bool IsColliding()
Definition Construction.c:1338

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

◆ MaterialIsRuined()

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

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

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

◆ ReceiveMaterialsServer()

void ReceiveMaterialsServer ( notnull Man player,
string part_name,
string damagezone_name )
protected
726 {
728 bool is_base = construction_part.IsBase();
729 string main_part_name = construction_part.GetMainPartName();
730 string cfg_path = "cfgVehicles" + " " + GetParent().GetType() + " "+ "Construction" + " " + main_part_name + " " + part_name + " " + "Materials";
731
732 if ( GetGame().ConfigIsExisting( cfg_path ) )
733 {
735 }
736 }
Definition Construction.c:1221
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:1223

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

Перекрестные ссылки 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
578 {
579 if (LogManager.IsBaseBuildingLogEnable()) bsbDebugPrint("[bsb] Construction ShowConstructionPart - " + part_name);
580 GetParent().SetAnimationPhase( part_name, 0 );
581 }

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

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

◆ ShowConstructionPartPhysics()

void ShowConstructionPartPhysics ( string part_name)
protected
591 {
592 GetParent().AddProxyPhysics( part_name );
593 }

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

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

◆ TakeMaterialsServer()

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

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

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

◆ UpdateConstructionParts()

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

Перекрестные ссылки 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:595
void ShowConstructionPartPhysics(string part_name)
Definition Construction.c:590

Перекрестные ссылки 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().