1632{
1634
1636
1638
1640
1646
1647
1648
1654
1660
1662
1666
1667
1669 {
1671
1672
1673 RegisterNetSyncVariableInt( "m_SyncParts01" );
1674 RegisterNetSyncVariableInt( "m_SyncParts02" );
1675 RegisterNetSyncVariableInt( "m_SyncParts03" );
1676 RegisterNetSyncVariableInt( "m_InteractedPartId" );
1677 RegisterNetSyncVariableInt( "m_PerformedActionId" );
1678 RegisterNetSyncVariableBool( "m_HasBase" );
1679
1680
1682
1683 if (ConfigIsExisting("hybridAttachments"))
1684 {
1687 }
1688 if (ConfigIsExisting("mountables"))
1689 {
1692 }
1693
1695 }
1696
1698 {
1699 super.EEDelete(parent);
1700
1702 {
1703 areaDamage.Destroy();
1704 }
1705
1706 }
1707
1709 {
1710 return "disableBaseDamage";
1711 }
1712
1714 {
1715 return true;
1716 }
1717
1719 {
1720 return EInventoryIconVisibility.HIDE_VICINITY;
1721 }
1722
1723
1725 {
1727 {
1728 SetSynchDirty();
1729 }
1730 }
1731
1733 {
1735 super.OnVariablesSynchronized();
1736
1738 }
1739
1741 {
1742
1744
1745
1747
1748
1750 }
1751
1752
1754 {
1755
1756 int offset;
1757 int mask;
1758
1759 if ( part_id >= 1 && part_id <= 31 )
1760 {
1761 offset = part_id - 1;
1762 mask = 1 << offset;
1763
1765 }
1766 else if ( part_id >= 32 && part_id <= 62 )
1767 {
1768 offset = ( part_id % 32 );
1769 mask = 1 << offset;
1770
1772 }
1773 else if ( part_id >= 63 && part_id <= 93 )
1774 {
1775 offset = ( part_id % 63 );
1776 mask = 1 << offset;
1777
1779 }
1780 }
1781
1783 {
1784
1785 int offset;
1786 int mask;
1787
1788 if ( part_id >= 1 && part_id <= 31 )
1789 {
1790 offset = part_id - 1;
1791 mask = 1 << offset;
1792
1794 }
1795 else if ( part_id >= 32 && part_id <= 62 )
1796 {
1797 offset = ( part_id % 32 );
1798 mask = 1 << offset;
1799
1801 }
1802 else if ( part_id >= 63 && part_id <= 93 )
1803 {
1804 offset = ( part_id % 63 );
1805 mask = 1 << offset;
1806
1808 }
1809 }
1810
1812 {
1813
1814 int offset;
1815 int mask;
1816
1817 if ( part_id >= 1 && part_id <= 31 )
1818 {
1819 offset = part_id - 1;
1820 mask = 1 << offset;
1821
1823 {
1824 return true;
1825 }
1826 }
1827 else if ( part_id >= 32 && part_id <= 62 )
1828 {
1829 offset = ( part_id % 32 );
1830 mask = 1 << offset;
1831
1833 {
1834 return true;
1835 }
1836 }
1837 else if ( part_id >= 63 && part_id <= 93 )
1838 {
1839 offset = ( part_id % 63 );
1840 mask = 1 << offset;
1841
1843 {
1844 return true;
1845 }
1846 }
1847
1848 return false;
1849 }
1850
1852 {
1855 }
1856
1858 {
1859
1862 }
1863
1865 {
1867 {
1870
1871 switch( build_action_id )
1872 {
1876 }
1877 }
1878 }
1879
1880
1882 {
1884 bool is_base = part.
IsBase();
1887 if ( is_part_built_sync )
1888 {
1890 {
1894
1895 if (is_base)
1896 {
1899 }
1900 }
1901 }
1902 else
1903 {
1905 {
1909
1910 if (is_base)
1911 {
1914 }
1915 }
1916 }
1917
1918
1920 }
1921
1922
1924 {
1927
1928 for ( int i = 0; i < construction_parts.Count(); ++i )
1929 {
1930 string key = construction_parts.GetKey( i );
1933 }
1934
1935
1937 }
1938
1940 {
1943
1944 for ( int i = 0; i < construction_parts.Count(); ++i )
1945 {
1946 string key = construction_parts.GetKey( i );
1948
1949 if ( value.
GetId() ==
id )
1950 {
1951 return value;
1952 }
1953 }
1954
1955 return NULL;
1956 }
1957
1958
1959
1961 {
1963 }
1964
1966 {
1968 }
1969
1971 {
1972 return true;
1973 }
1974
1976 {
1977 return false;
1978 }
1979
1980
1982 {
1985 {
1987 }
1988
1989 return construction_kit;
1990 }
1991
1993 {
1996 {
1998 }
1999 }
2000
2002 {
2004 }
2005
2007 {
2008 return "";
2009 }
2010
2012 {
2015 }
2016
2017
2019 {
2022 }
2023
2024
2026 {
2027 super.OnStoreSave( ctx );
2028
2029
2033
2035 }
2036
2038 {
2039 if ( !super.OnStoreLoad( ctx, version ) )
2040 return false;
2041
2042
2043
2045 {
2047 return false;
2048 }
2050 {
2052 return false;
2053 }
2055 {
2057 return false;
2058 }
2059
2060
2062 {
2064 return false;
2065 }
2066
2067
2068 return true;
2069 }
2070
2072 {
2073 super.AfterStoreLoad();
2074
2076 {
2078 }
2079 }
2080
2082 {
2083
2085
2086
2089
2090
2092 }
2093
2095 {
2096 super.OnCreatePhysics();
2099 }
2100
2102 {
2104 return;
2105
2106 super.EEHealthLevelChanged(oldLevel,newLevel,zone);
2107
2109 return;
2110
2112 string part_name = zone;
2114
2116 {
2117 ConstructionPart construction_part = construction.GetConstructionPart( part_name );
2118
2119 if ( construction_part && construction.IsPartConstructed( part_name ) )
2120 {
2122 construction.DestroyConnectedParts(part_name);
2123 }
2124
2125
2126 if ( part_name.
Contains(
"barbed") )
2127 {
2128 BarbedWire barbed_wire = BarbedWire.Cast( FindAttachmentBySlotName( zone ) );
2129 if (barbed_wire)
2130 barbed_wire.SetMountedState( false );
2131 }
2132 }
2133 }
2134
2136 {
2138 {
2140 }
2141
2142 super.EEOnAfterLoad();
2143 }
2144
2146 {
2147 super.EEInit();
2148
2149
2151
2152
2153 #ifdef DEVELOPER
2155 #endif
2156 }
2157
2159 {
2160 super.EEItemAttached( item, slot_name );
2161
2165 }
2166
2168 {
2169 super.EEItemDetached( item, slot_name );
2170
2173 }
2174
2175 protected void OnSetSlotLock(
int slotId,
bool locked,
bool was_locked )
2176 {
2179
2182 }
2183
2184
2186 {
2187 return true;
2188 }
2189
2190
2191
2193 {
2195
2196
2197 if (construtionPart.
IsBase())
2198 {
2200
2201
2203 }
2204
2205
2207
2208
2210
2211
2213
2215
2217
2218
2220
2221
2223 }
2224
2226 {
2227
2229 }
2230
2231
2233 {
2236
2237
2239
2240
2242
2243
2245
2246
2248
2250
2251
2253
2254
2256
2257
2258 if (construtionPart.
IsBase())
2259 {
2260
2262 }
2263
2266 }
2267
2269 {
2270
2272 }
2273
2274
2275 void OnPartDestroyedServer(Man player,
string part_name,
int action_id,
bool destroyed_by_connected_part =
false)
2276 {
2279
2280
2282
2283
2285
2286
2288
2289
2291
2293
2294
2296
2297
2299
2300
2301 if (construtionPart.
IsBase())
2302 {
2303
2305 }
2306
2309 }
2310
2312 {
2313
2315 }
2316
2318 {
2319 bool process = false;
2320
2321
2325
2326 if (process)
2327 {
2328 if (!MemoryPointExists(part.
m_PartName +
"_min") || !MemoryPointExists(part.
m_PartName +
"_max"))
2329 {
2331 return;
2332 }
2333
2335 mins = ModelToWorld(GetMemoryPointPos(part.
m_PartName +
"_min"));
2336 maxs = ModelToWorld(GetMemoryPointPos(part.
m_PartName +
"_max"));
2337
2338
2340 minTmp[0] =
Math.
Min(mins[0],maxs[0]);
2341 maxTmp[0] =
Math.
Max(mins[0],maxs[0]);
2342 minTmp[1] =
Math.
Min(mins[1],maxs[1]);
2343 maxTmp[1] =
Math.
Max(mins[1],maxs[1]);
2344 minTmp[2] =
Math.
Min(mins[2],maxs[2]);
2345 maxTmp[2] =
Math.
Max(mins[2],maxs[2]);
2346 mins = minTmp;
2347 maxs = maxTmp;
2348
2349 maxs[1] = maxs[1] + 0.35;
2350
2352 }
2353 }
2354
2356 {
2359
2360
2362 foreach (
EntityAI entity : foundEntities)
2363 {
2366 }
2367 }
2368
2369
2371 {
2373
2377 }
2378
2380 {
2382
2384 {
2386 }
2387 else
2388 {
2390 }
2391
2393 }
2394
2396 {
2398
2400 foreach (
string slotName : attachmentSlots)
2401 {
2403 }
2404
2405
2408 else
2410
2412 }
2413
2415 {
2416 string slotNameMounted = slot_name + "_Mounted";
2417 EntityAI attachment = FindAttachmentBySlotName(slot_name);
2418
2419 if (attachment)
2420 {
2421 BarbedWire barbedWire = BarbedWire.Cast(attachment);
2422 if (barbedWire && barbedWire.IsMounted())
2424 else
2426
2427 if (is_locked)
2428 {
2429 SetAnimationPhase(slotNameMounted, 0);
2430 SetAnimationPhase(slot_name, 1);
2431 }
2432 else
2433 {
2434 SetAnimationPhase(slotNameMounted, 1);
2435 SetAnimationPhase(slot_name, 0);
2436 }
2437 }
2438 else
2439 {
2440 SetAnimationPhase(slotNameMounted, 1);
2441 SetAnimationPhase(slot_name, 1);
2442
2444 }
2445 }
2446
2447
2449 {
2452
2455
2458
2459 foreach (
string slotName : attachmentSlots)
2460 {
2462 }
2463
2464
2466 {
2469
2471 }
2472 else
2473 {
2476
2478 }
2479
2482 }
2483
2485 {
2486
2488 return;
2489
2490 string slot_name_mounted = slot_name + "_Mounted";
2491 EntityAI attachment = FindAttachmentBySlotName( slot_name );
2492
2493
2495 RemoveProxyPhysics( slot_name_mounted );
2496 RemoveProxyPhysics( slot_name );
2497
2498 if ( attachment )
2499 {
2501 if ( is_locked )
2502 {
2504 AddProxyPhysics( slot_name_mounted );
2505 }
2506 else
2507 {
2509 AddProxyPhysics( slot_name );
2510 }
2511 }
2512 }
2513
2515 {
2516 SetAffectPathgraph( true, false );
2518 }
2519
2521 {
2522 return true;
2523 }
2524
2526 {
2527 return true;
2528 }
2529
2531 {
2532 if ( attachment )
2533 {
2535 attachment.GetInventory().GetCurrentInventoryLocation( inventory_location );
2536
2537 return GetInventory().GetSlotLock( inventory_location.
GetSlot() );
2538 }
2539
2540 return false;
2541 }
2542
2544 {
2546 }
2547
2548
2550 {
2551 string config_path = "CfgVehicles" + " " + entity.GetType() + " " + "attachments";
2552 if (
GetGame().ConfigIsExisting( config_path ) )
2553 {
2555 }
2556 }
2557
2559 {
2560 return true;
2561 }
2562
2564 {
2565 return true;
2566 }
2567
2569 {
2570 return true;
2571 }
2572
2573
2575 {
2577 {
2579 }
2580
2582 }
2583
2585 {
2587 }
2588
2589
2590
2592 {
2593 return super.CanReceiveAttachment(attachment, slotId);
2594 }
2595
2597 {
2598 int attachment_count = GetInventory().AttachmentCount();
2599 if ( attachment_count > 0 )
2600 {
2601 if (
HasBase() && attachment_count == 1 )
2602 {
2603 return false;
2604 }
2605
2606 return true;
2607 }
2608
2609 return false;
2610 }
2611
2613 {
2614 return true;
2615 }
2616
2618 {
2619 return false;
2620 }
2621
2622
2624 {
2625 return false;
2626 }
2627
2629 {
2630 return false;
2631 }
2632
2633
2635 {
2636 return false;
2637 }
2638
2639
2640
2642 {
2643 return true;
2644 }
2645
2647 {
2648 return true;
2649 }
2650
2653 {
2654 return false;
2655 }
2656
2657
2659 {
2660 return true;
2661 }
2662
2663
2665 {
2666 return false;
2667 }
2668
2669
2671 {
2672 return true;
2673 }
2674
2675
2677 {
2678 if (
HasBase() || GetInventory().AttachmentCount() > 0 )
2679 {
2680 return false;
2681 }
2682
2683 return true;
2684 }
2685
2687 {
2690
2691 return item;
2692 }
2693
2694
2696 {
2698 {
2699
2701
2702
2705
2707 if ( MemoryPointExists( slot_name + "_min" ) )
2708 {
2709 min_max[0] = GetMemoryPointPos( slot_name + "_min" );
2710 }
2711 if ( MemoryPointExists( slot_name + "_max" ) )
2712 {
2713 min_max[1] = GetMemoryPointPos( slot_name + "_max" );
2714 }
2715
2716
2719
2720
2723 center = ModelToWorld( center );
2724
2725
2728
2729 areaDamage.SetExtents( extents[0], extents[1] );
2730 areaDamage.SetAreaPosition( center );
2731 areaDamage.SetAreaOrientation( orientation );
2734 areaDamage.SetHitZones( { "Torso","LeftHand","LeftLeg","LeftFoot","RightHand","RightLeg","RightFoot" } );
2735 areaDamage.SetAmmoName( "BarbedWireHit" );
2736 areaDamage.Spawn();
2737
2739 }
2740 }
2741
2743 {
2744 if ( angle_deg != 0 )
2745 {
2746
2747 orientation[0] = orientation[0] - angle_deg;
2748
2749
2751 if ( MemoryPointExists( "rotate_axis" ) )
2752 {
2753 rotate_axis = ModelToWorld( GetMemoryPointPos( "rotate_axis" ) );
2754 }
2755 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];
2756 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];
2757 center[0] = r_center_x;
2758 center[2] = r_center_z;
2759 }
2760 }
2761
2763 {
2765 {
2768 {
2769 if (areaDamage)
2770 {
2771 areaDamage.Destroy();
2772 }
2773
2775 }
2776 }
2777 }
2778
2780 {
2781 return true;
2782 }
2783
2784
2785
2786
2788 {
2790 }
2791
2793 {
2795 }
2796
2798 {
2800 }
2801
2803 {
2805
2806 switch ( material_type )
2807 {
2813 }
2814
2815 return "";
2816 }
2817
2819 {
2821
2822 switch ( material_type )
2823 {
2829 }
2830
2831 return "";
2832 }
2833
2834
2836 {
2838 {
2839
2841 {
2842 SetHealth(slot_name,"Health",item.GetHealth());
2843 }
2844 }
2845 }
2846
2848 {
2849 return 111;
2850 }
2851
2853 {
2854 super.SetActions();
2855
2859 }
2860
2861
2862
2863
2865 {
2866 }
2867
2870 {
2871 return null;
2872 }
2873
2875 {
2877 }
2878
2880 {
2883
2884 Man p;
2885
2886 #ifdef SERVER
2889 if (players.Count())
2890 p = players[0];
2891 #else
2893 #endif
2894
2896 {
2897 bool excluded = false;
2899 if (excludes)
2900 {
2901 foreach (string exclude : excludes)
2902 {
2904 {
2905 excluded = true;
2906 break;
2907 }
2908 }
2909 }
2910
2911 if (!excluded)
2912 {
2914 }
2915 }
2916
2918 }
2919}
2920
2922{
2923#ifdef BSB_DEBUG
2925#else
2926
2927#endif
2928}
2930{
2931#ifdef BSB_DEBUG_SPAM
2933#else
2934
2935#endif
2936}
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.