2041{
2043
2045
2047
2049
2055
2056
2057
2063
2069
2071
2075
2076
2078 {
2080
2081
2082 RegisterNetSyncVariableInt( "m_SyncParts01" );
2083 RegisterNetSyncVariableInt( "m_SyncParts02" );
2084 RegisterNetSyncVariableInt( "m_SyncParts03" );
2085 RegisterNetSyncVariableInt( "m_InteractedPartId" );
2086 RegisterNetSyncVariableInt( "m_PerformedActionId" );
2087 RegisterNetSyncVariableBool( "m_HasBase" );
2088
2089
2091
2092 if (ConfigIsExisting("hybridAttachments"))
2093 {
2096 }
2097 if (ConfigIsExisting("mountables"))
2098 {
2101 }
2102
2104 }
2105
2107 {
2108 super.EEDelete(parent);
2109
2111 {
2112 areaDamage.Destroy();
2113 }
2114
2115 }
2116
2118 {
2119 return "disableBaseDamage";
2120 }
2121
2123 {
2124 return true;
2125 }
2126
2128 {
2129 return EInventoryIconVisibility.HIDE_VICINITY;
2130 }
2131
2132
2134 {
2136 {
2137 SetSynchDirty();
2138 }
2139 }
2140
2142 {
2144 super.OnVariablesSynchronized();
2145
2147 }
2148
2150 {
2151
2153
2154
2156
2157
2159 }
2160
2161
2163 {
2164
2165 int offset;
2166 int mask;
2167
2168 if ( part_id >= 1 && part_id <= 31 )
2169 {
2170 offset = part_id - 1;
2171 mask = 1 << offset;
2172
2174 }
2175 else if ( part_id >= 32 && part_id <= 62 )
2176 {
2177 offset = ( part_id % 32 );
2178 mask = 1 << offset;
2179
2181 }
2182 else if ( part_id >= 63 && part_id <= 93 )
2183 {
2184 offset = ( part_id % 63 );
2185 mask = 1 << offset;
2186
2188 }
2189 }
2190
2192 {
2193
2194 int offset;
2195 int mask;
2196
2197 if ( part_id >= 1 && part_id <= 31 )
2198 {
2199 offset = part_id - 1;
2200 mask = 1 << offset;
2201
2203 }
2204 else if ( part_id >= 32 && part_id <= 62 )
2205 {
2206 offset = ( part_id % 32 );
2207 mask = 1 << offset;
2208
2210 }
2211 else if ( part_id >= 63 && part_id <= 93 )
2212 {
2213 offset = ( part_id % 63 );
2214 mask = 1 << offset;
2215
2217 }
2218 }
2219
2221 {
2222
2223 int offset;
2224 int mask;
2225
2226 if ( part_id >= 1 && part_id <= 31 )
2227 {
2228 offset = part_id - 1;
2229 mask = 1 << offset;
2230
2232 {
2233 return true;
2234 }
2235 }
2236 else if ( part_id >= 32 && part_id <= 62 )
2237 {
2238 offset = ( part_id % 32 );
2239 mask = 1 << offset;
2240
2242 {
2243 return true;
2244 }
2245 }
2246 else if ( part_id >= 63 && part_id <= 93 )
2247 {
2248 offset = ( part_id % 63 );
2249 mask = 1 << offset;
2250
2252 {
2253 return true;
2254 }
2255 }
2256
2257 return false;
2258 }
2259
2261 {
2264 }
2265
2267 {
2268
2271 }
2272
2274 {
2276 {
2279
2280 switch( build_action_id )
2281 {
2285 }
2286 }
2287 }
2288
2289
2291 {
2293 bool is_base = part.
IsBase();
2296 if ( is_part_built_sync )
2297 {
2299 {
2303
2304 if (is_base)
2305 {
2308 }
2309 }
2310 }
2311 else
2312 {
2314 {
2318
2319 if (is_base)
2320 {
2323 }
2324 }
2325 }
2326
2327
2329 }
2330
2331
2333 {
2336
2337 for ( int i = 0; i < construction_parts.Count(); ++i )
2338 {
2339 string key = construction_parts.GetKey( i );
2342 }
2343
2344
2346 }
2347
2349 {
2352
2353 for ( int i = 0; i < construction_parts.Count(); ++i )
2354 {
2355 string key = construction_parts.GetKey( i );
2357
2358 if ( value.
GetId() ==
id )
2359 {
2360 return value;
2361 }
2362 }
2363
2364 return NULL;
2365 }
2366
2367
2368
2370 {
2372 }
2373
2375 {
2377 }
2378
2380 {
2381 return true;
2382 }
2383
2385 {
2386 return false;
2387 }
2388
2389
2391 {
2394 {
2396 }
2397
2398 return construction_kit;
2399 }
2400
2402 {
2405 {
2407 }
2408 }
2409
2411 {
2413 }
2414
2416 {
2417 return "";
2418 }
2419
2421 {
2424 }
2425
2426
2428 {
2431 }
2432
2433
2435 {
2436 super.OnStoreSave( ctx );
2437
2438
2442
2444 }
2445
2447 {
2448 if ( !super.OnStoreLoad( ctx, version ) )
2449 return false;
2450
2451
2452
2454 {
2456 return false;
2457 }
2459 {
2461 return false;
2462 }
2464 {
2466 return false;
2467 }
2468
2469
2471 {
2473 return false;
2474 }
2475
2476
2477 return true;
2478 }
2479
2481 {
2482 super.AfterStoreLoad();
2483
2485 {
2487 }
2488 }
2489
2491 {
2492
2494
2495
2498
2499
2501 }
2502
2504 {
2505 super.OnCreatePhysics();
2508 }
2509
2511 {
2513 return;
2514
2515 super.EEHealthLevelChanged(oldLevel,newLevel,zone);
2516
2518 return;
2519
2521 string part_name = zone;
2523
2525 {
2526 ConstructionPart construction_part = construction.GetConstructionPart( part_name );
2527
2528 if ( construction_part && construction.IsPartConstructed( part_name ) )
2529 {
2531 construction.DestroyConnectedParts(part_name);
2532 }
2533
2534
2535 if ( part_name.
Contains(
"barbed") )
2536 {
2537 BarbedWire barbed_wire = BarbedWire.Cast( FindAttachmentBySlotName( zone ) );
2538 if (barbed_wire)
2539 barbed_wire.SetMountedState( false );
2540 }
2541 }
2542 }
2543
2545 {
2547 {
2549 }
2550
2551 super.EEOnAfterLoad();
2552 }
2553
2555 {
2556 super.EEInit();
2557
2558
2560
2561
2562 #ifdef DEVELOPER
2564 #endif
2565 }
2566
2568 {
2569 super.EEItemAttached( item, slot_name );
2570
2574 }
2575
2577 {
2578 super.EEItemDetached( item, slot_name );
2579
2582 }
2583
2584 protected void OnSetSlotLock(
int slotId,
bool locked,
bool was_locked )
2585 {
2588
2591 }
2592
2593
2595 {
2596 return true;
2597 }
2598
2599
2600
2602 {
2604
2605
2606 if (construtionPart.
IsBase())
2607 {
2609
2610
2612 }
2613
2614
2616
2617
2619
2620
2622
2624
2626
2627
2629
2630
2632 }
2633
2635 {
2636
2638 }
2639
2640
2642 {
2645
2646
2648
2649
2651
2652
2654
2655
2657
2659
2660
2662
2663
2665
2666
2667 if (construtionPart.
IsBase())
2668 {
2669
2671 }
2672
2675 }
2676
2678 {
2679
2681 }
2682
2683
2684 void OnPartDestroyedServer(Man player,
string part_name,
int action_id,
bool destroyed_by_connected_part =
false)
2685 {
2688
2689
2691
2692
2694
2695
2697
2698
2700
2702
2703
2705
2706
2708
2709
2710 if (construtionPart.
IsBase())
2711 {
2712
2714 }
2715
2718 }
2719
2721 {
2722
2724 }
2725
2727 {
2728 bool process = false;
2729
2730
2734
2735 if (process)
2736 {
2737 if (!MemoryPointExists(part.
m_PartName +
"_min") || !MemoryPointExists(part.
m_PartName +
"_max"))
2738 {
2740 return;
2741 }
2742
2744 mins = ModelToWorld(GetMemoryPointPos(part.
m_PartName +
"_min"));
2745 maxs = ModelToWorld(GetMemoryPointPos(part.
m_PartName +
"_max"));
2746
2747
2749 minTmp[0] =
Math.
Min(mins[0],maxs[0]);
2750 maxTmp[0] =
Math.
Max(mins[0],maxs[0]);
2751 minTmp[1] =
Math.
Min(mins[1],maxs[1]);
2752 maxTmp[1] =
Math.
Max(mins[1],maxs[1]);
2753 minTmp[2] =
Math.
Min(mins[2],maxs[2]);
2754 maxTmp[2] =
Math.
Max(mins[2],maxs[2]);
2755 mins = minTmp;
2756 maxs = maxTmp;
2757
2758 maxs[1] = maxs[1] + 0.35;
2759
2761 }
2762 }
2763
2765 {
2768
2769
2771 foreach (
EntityAI entity : foundEntities)
2772 {
2775 }
2776 }
2777
2778
2780 {
2782
2786 }
2787
2789 {
2791
2793 {
2795 }
2796 else
2797 {
2799 }
2800
2802 }
2803
2805 {
2807
2809 foreach (
string slotName : attachmentSlots)
2810 {
2812 }
2813
2814
2817 else
2819
2821 }
2822
2824 {
2825 string slotNameMounted = slot_name + "_Mounted";
2826 EntityAI attachment = FindAttachmentBySlotName(slot_name);
2827
2828 if (attachment)
2829 {
2830 BarbedWire barbedWire = BarbedWire.Cast(attachment);
2831 if (barbedWire && barbedWire.IsMounted())
2833 else
2835
2836 if (is_locked)
2837 {
2838 SetAnimationPhase(slotNameMounted, 0);
2839 SetAnimationPhase(slot_name, 1);
2840 }
2841 else
2842 {
2843 SetAnimationPhase(slotNameMounted, 1);
2844 SetAnimationPhase(slot_name, 0);
2845 }
2846 }
2847 else
2848 {
2849 SetAnimationPhase(slotNameMounted, 1);
2850 SetAnimationPhase(slot_name, 1);
2851
2853 }
2854 }
2855
2856
2858 {
2861
2864
2867
2868 foreach (
string slotName : attachmentSlots)
2869 {
2871 }
2872
2873
2875 {
2878
2880 }
2881 else
2882 {
2885
2887 }
2888
2891 }
2892
2894 {
2895
2897 return;
2898
2899 string slot_name_mounted = slot_name + "_Mounted";
2900 EntityAI attachment = FindAttachmentBySlotName( slot_name );
2901
2902
2904 RemoveProxyPhysics( slot_name_mounted );
2905 RemoveProxyPhysics( slot_name );
2906
2907 if ( attachment )
2908 {
2910 if ( is_locked )
2911 {
2913 AddProxyPhysics( slot_name_mounted );
2914 }
2915 else
2916 {
2918 AddProxyPhysics( slot_name );
2919 }
2920 }
2921 }
2922
2924 {
2925 SetAffectPathgraph( true, false );
2927 }
2928
2930 {
2931 return true;
2932 }
2933
2935 {
2936 return true;
2937 }
2938
2940 {
2941 if ( attachment )
2942 {
2944 attachment.GetInventory().GetCurrentInventoryLocation( inventory_location );
2945
2946 return GetInventory().GetSlotLock( inventory_location.
GetSlot() );
2947 }
2948
2949 return false;
2950 }
2951
2953 {
2955 }
2956
2957
2959 {
2960 string config_path = "CfgVehicles" + " " + entity.GetType() + " " + "attachments";
2961 if (
GetGame().ConfigIsExisting( config_path ) )
2962 {
2964 }
2965 }
2966
2968 {
2969 return true;
2970 }
2971
2973 {
2974 return true;
2975 }
2976
2978 {
2979 return true;
2980 }
2981
2982
2984 {
2986 {
2988 }
2989
2991 }
2992
2994 {
2996 }
2997
2998
2999
3001 {
3002 return super.CanReceiveAttachment(attachment, slotId);
3003 }
3004
3006 {
3007 int attachment_count = GetInventory().AttachmentCount();
3008 if ( attachment_count > 0 )
3009 {
3010 if (
HasBase() && attachment_count == 1 )
3011 {
3012 return false;
3013 }
3014
3015 return true;
3016 }
3017
3018 return false;
3019 }
3020
3022 {
3023 return true;
3024 }
3025
3027 {
3028 return false;
3029 }
3030
3031
3033 {
3034 return false;
3035 }
3036
3038 {
3039 return false;
3040 }
3041
3042
3044 {
3045 return false;
3046 }
3047
3048
3049
3051 {
3052 return true;
3053 }
3054
3056 {
3057 return true;
3058 }
3059
3062 {
3063 return false;
3064 }
3065
3066
3068 {
3069 return true;
3070 }
3071
3072
3074 {
3075 return false;
3076 }
3077
3078
3080 {
3081 return true;
3082 }
3083
3084
3086 {
3087 if (
HasBase() || GetInventory().AttachmentCount() > 0 )
3088 {
3089 return false;
3090 }
3091
3092 return true;
3093 }
3094
3096 {
3099
3100 return item;
3101 }
3102
3103
3105 {
3107 {
3108
3110
3111
3114
3116 if ( MemoryPointExists( slot_name + "_min" ) )
3117 {
3118 min_max[0] = GetMemoryPointPos( slot_name + "_min" );
3119 }
3120 if ( MemoryPointExists( slot_name + "_max" ) )
3121 {
3122 min_max[1] = GetMemoryPointPos( slot_name + "_max" );
3123 }
3124
3125
3128
3129
3132 center = ModelToWorld( center );
3133
3134
3137
3138 areaDamage.SetExtents( extents[0], extents[1] );
3139 areaDamage.SetAreaPosition( center );
3140 areaDamage.SetAreaOrientation( orientation );
3143 areaDamage.SetHitZones( { "Torso","LeftHand","LeftLeg","LeftFoot","RightHand","RightLeg","RightFoot" } );
3144 areaDamage.SetAmmoName( "BarbedWireHit" );
3145 areaDamage.Spawn();
3146
3148 }
3149 }
3150
3152 {
3153 if ( angle_deg != 0 )
3154 {
3155
3156 orientation[0] = orientation[0] - angle_deg;
3157
3158
3160 if ( MemoryPointExists( "rotate_axis" ) )
3161 {
3162 rotate_axis = ModelToWorld( GetMemoryPointPos( "rotate_axis" ) );
3163 }
3164 float r_center_x = (
Math.
Cos( angle_deg *
Math.
DEG2RAD ) * ( center[0] - rotate_axis[0] ) ) - (
Math.
Sin( angle_deg *
Math.
DEG2RAD ) * ( center[2] - rotate_axis[2] ) ) + rotate_axis[0];
3165 float r_center_z = (
Math.
Sin( angle_deg *
Math.
DEG2RAD ) * ( center[0] - rotate_axis[0] ) ) + (
Math.
Cos( angle_deg *
Math.
DEG2RAD ) * ( center[2] - rotate_axis[2] ) ) + rotate_axis[2];
3166 center[0] = r_center_x;
3167 center[2] = r_center_z;
3168 }
3169 }
3170
3172 {
3174 {
3177 {
3178 if (areaDamage)
3179 {
3180 areaDamage.Destroy();
3181 }
3182
3184 }
3185 }
3186 }
3187
3189 {
3190 return true;
3191 }
3192
3193
3194
3195
3197 {
3199 }
3200
3202 {
3204 }
3205
3207 {
3209 }
3210
3212 {
3214
3215 switch ( material_type )
3216 {
3222 }
3223
3224 return "";
3225 }
3226
3228 {
3230
3231 switch ( material_type )
3232 {
3238 }
3239
3240 return "";
3241 }
3242
3243
3245 {
3247 {
3248
3250 {
3251 SetHealth(slot_name,"Health",item.GetHealth());
3252 }
3253 }
3254 }
3255
3257 {
3258 return 111;
3259 }
3260
3262 {
3263 super.SetActions();
3264
3268 }
3269
3270
3271
3272
3274 {
3275 }
3276
3279 {
3280 return null;
3281 }
3282
3284 {
3286 }
3287
3289 {
3292
3293 Man p;
3294
3295 #ifdef SERVER
3298 if (players.Count())
3299 p = players[0];
3300 #else
3302 #endif
3303
3305 {
3306 bool excluded = false;
3308 if (excludes)
3309 {
3310 foreach (string exclude : excludes)
3311 {
3313 {
3314 excluded = true;
3315 break;
3316 }
3317 }
3318 }
3319
3320 if (!excluded)
3321 {
3323 }
3324 }
3325
3327 }
3328}
3329
3331{
3332#ifdef BSB_DEBUG
3334#else
3335
3336#endif
3337}
3339{
3340#ifdef BSB_DEBUG_SPAM
3342#else
3343
3344#endif
3345}
const int AT_DISMANTLE_PART
const int AT_DESTROY_PART
void AddAction(typename actionName)
void RemoveAction(typename actionName)
void AreaDamageManager(EntityAI parent)
void OnPartDismantledClient(string part_name, int action_id)
const string ANIMATION_DEPLOYED
override int GetHideIconMask()
override void OnStoreSave(ParamsWriteContext ctx)
void SetActionFromSyncData()
bool CheckMemoryPointVerticalDistance(float max_dist, string selection, PlayerBase player)
override void OnDebugSpawn()
array< string > OnDebugSpawnBuildExcludes()
Excludes certain parts from being built by OnDebugSpawn, uses Contains to compare.
void SoundDestroyStart(string part_name)
const string SOUND_BUILD_WOOD_LOG
void SoundBuildStart(string part_name)
void UpdateAttachmentVisuals(string slot_name, bool is_locked)
void CalcDamageAreaRotation(float angle_deg, out vector center, out vector orientation)
override bool CanObstruct()
bool HasAttachmentsBesidesBase()
void RegisterPartForSync(int part_id)
const string SOUND_DISMANTLE_METAL
override bool CanReceiveAttachment(EntityAI attachment, int slotId)
void SetPartsAfterStoreLoad()
void DestroyConstruction()
ref array< string > m_HybridAttachments
string GetDismantleSoundByMaterial(string part_name)
bool IsAttachmentSlotLocked(EntityAI attachment)
override bool IsFacingPlayer(PlayerBase player, string selection)
void OnPartBuiltClient(string part_name, int action_id)
bool HasProperDistance(string selection, PlayerBase player)
override void OnCreatePhysics()
void OnPartBuiltServer(notnull Man player, string part_name, int action_id)
void RegisterActionForSync(int part_id, int action_id)
const string SOUND_BUILD_WOOD_PLANK
void SetPartsFromSyncData()
ref array< string > m_Mountables
const string SOUND_BUILD_WIRE
void ResetActionSyncData()
override string GetInvulnerabilityTypeString()
void OnPartDismantledServer(notnull Man player, string part_name, int action_id)
void CheckForHybridAttachments(EntityAI item, string slot_name)
override void EEOnAfterLoad()
override void EEItemDetached(EntityAI item, string slot_name)
vector GetKitSpawnPosition()
ref Construction m_Construction
bool IsFacingCamera(string selection)
bool CheckSlotVerticalDistance(int slot_id, PlayerBase player)
void GetAttachmentSlots(EntityAI entity, out array< string > attachment_slots)
override bool IsDeployable()
void OnPartDestroyedClient(string part_name, int action_id)
void UnregisterPartForSync(int part_id)
void bsbDebugSpam(string s)
override void OnVariablesSynchronized()
bool PerformRoofCheckForBase(string partName, PlayerBase player, out bool result)
Construction GetConstruction()
void SoundDismantleStart(string part_name)
ConstructionPart GetConstructionPartById(int id)
string GetConstructionKitType()
bool CheckLevelVerticalDistance(float max_dist, string selection, PlayerBase player)
void OnPartDestroyedServer(Man player, string part_name, int action_id, bool destroyed_by_connected_part=false)
bool CanFoldBaseBuildingObject()
override int GetDamageSystemVersionChange()
const string SOUND_DISMANTLE_WOOD_PLANK
override void EEItemAttached(EntityAI item, string slot_name)
const string SOUND_DISMANTLE_WOOD_LOG
class BaseBuildingBase extends ItemBase bsbDebugPrint(string s)
const string SOUND_BUILD_WOOD_STAIRS
ItemBase FoldBaseBuildingObject()
override bool CanPutInCargo(EntityAI parent)
override bool CanUseConstruction()
override void AfterStoreLoad()
void SetPartFromSyncData(ConstructionPart part)
override void EEHealthLevelChanged(int oldLevel, int newLevel, string zone)
override bool IgnoreOutOfReachCondition()
override bool OnStoreLoad(ParamsReadContext ctx, int version)
override bool ShowZonesHealth()
void UpdateAttachmentPhysics(string slot_name, bool is_locked)
override bool IsPlayerInside(PlayerBase player, string selection)
string GetBuildSoundByMaterial(string part_name)
ItemBase CreateConstructionKit()
const string SOUND_DISMANTLE_WIRE
bool MustBeBuiltFromOutside()
Some buildings can only be built from outside.
override bool IsTakeable()
float m_ConstructionKitHealth
override void EEDelete(EntityAI parent)
override void SetActions()
void HandleItemFalling(ConstructionPart part)
void DestroyConstructionKit(ItemBase construction_kit)
void CreateConstructionKitInHands(notnull PlayerBase player)
void ItemFall(vector min, vector max)
override bool CanUseConstructionBuild()
void OnSynchronizedClient()
void SynchronizeBaseState()
override bool IsIgnoredByConstruction()
ref map< string, ref AreaDamageManager > m_DamageTriggers
void SetBaseState(bool has_base)
const string SOUND_BUILD_METAL
void OnSetSlotLock(int slotId, bool locked, bool was_locked)
override bool CanPutIntoHands(EntityAI parent)
bool IsPartBuildInSyncData(int part_id)
override bool CanRemoveFromCargo(EntityAI parent)
const string SOUND_DISMANTLE_WOOD_STAIRS
const int ECE_PLACE_ON_SURFACE
PlayerSpawnPreset slotName
void Construction(BaseBuildingBase parent)
void DayZPlayerUtils()
cannot be instantiated
bool m_FixDamageSystemInit
override void SetLoopInterval(float time)
A particular version of the deferred loop used to not damage players inside vehicles.
override void SetDeferDuration(float time)
proto native World GetWorld()
override ScriptCallQueue GetCallQueue(int call_category)
proto native void ConfigGetTextArray(string path, out TStringArray values)
Get array of strings from config on path.
proto native DayZPlayer GetPlayer()
proto native void ObjectDelete(Object obj)
Super root of all classes in Enforce script.
static void Log(string message=LOG_DEFAULT, string plugin=LOG_DEFAULT, string author=LOG_DEFAULT, string label=LOG_DEFAULT, string entity=LOG_DEFAULT)
Prints debug message with normal prio.
Wrapper class for managing sound through SEffectManager.
proto native int GetSlot()
returns slot id if current type is Attachment
static proto native int GetSlotIdFromString(string slot_name)
converts string to slot_id
static proto native owned string GetSlotName(int id)
converts slot_id to string
provides access to slot configuration
override bool CanUseConstruction()
static bool IsBaseBuildingLogEnable()
proto void CallLater(func fn, int delay=0, bool repeat=false, void param1=NULL, void param2=NULL, void param3=NULL, void param4=NULL, void param5=NULL, void param6=NULL, void param7=NULL, void param8=NULL, void param9=NULL)
adds call into the queue with given parameters and arguments (arguments are held in memory until the ...
proto bool Write(void value_out)
proto bool Read(void value_in)
proto native void GetPlayerList(out array< Man > players)
Result for an object found in CGame.IsBoxCollidingGeometryProxy.
override string GetDebugName()
Serializer ParamsReadContext
proto native CGame GetGame()
Serializer ParamsWriteContext
proto void PrintToRPT(void var)
Prints content of variable to RPT file (performance warning - each write means fflush!...
static proto bool CastTo(out Class to, Class from)
Try to safely down-cast base class to child class.
static proto float Max(float x, float y)
Returns bigger of two given values.
static proto float Min(float x, float y)
Returns smaller of two given values.
static proto float Cos(float angle)
Returns cosinus of angle in radians.
static proto float Sin(float angle)
Returns sinus of angle in radians.
static const float DEG2RAD
class JsonUndergroundAreaTriggerData GetPosition
bool Contains(string sample)
Returns true if sample is substring of string.
proto int ToLower()
Changes string to lowercase. Returns length.