1627{
1629
1631
1633
1635
1641
1642
1643
1649
1655
1657
1661
1662
1664 {
1666
1667
1668 RegisterNetSyncVariableInt( "m_SyncParts01" );
1669 RegisterNetSyncVariableInt( "m_SyncParts02" );
1670 RegisterNetSyncVariableInt( "m_SyncParts03" );
1671 RegisterNetSyncVariableInt( "m_InteractedPartId" );
1672 RegisterNetSyncVariableInt( "m_PerformedActionId" );
1673 RegisterNetSyncVariableBool( "m_HasBase" );
1674
1675
1677
1678 if (ConfigIsExisting("hybridAttachments"))
1679 {
1682 }
1683 if (ConfigIsExisting("mountables"))
1684 {
1687 }
1688
1690 }
1691
1693 {
1694 super.EEDelete(parent);
1695
1697 {
1698 areaDamage.Destroy();
1699 }
1700
1701 }
1702
1704 {
1705 return "disableBaseDamage";
1706 }
1707
1709 {
1710 return true;
1711 }
1712
1714 {
1715 return EInventoryIconVisibility.HIDE_VICINITY;
1716 }
1717
1718
1720 {
1722 {
1723 SetSynchDirty();
1724 }
1725 }
1726
1728 {
1730 super.OnVariablesSynchronized();
1731
1733 }
1734
1736 {
1737
1739
1740
1742
1743
1745 }
1746
1747
1749 {
1750
1751 int offset;
1752 int mask;
1753
1754 if ( part_id >= 1 && part_id <= 31 )
1755 {
1756 offset = part_id - 1;
1757 mask = 1 << offset;
1758
1760 }
1761 else if ( part_id >= 32 && part_id <= 62 )
1762 {
1763 offset = ( part_id % 32 );
1764 mask = 1 << offset;
1765
1767 }
1768 else if ( part_id >= 63 && part_id <= 93 )
1769 {
1770 offset = ( part_id % 63 );
1771 mask = 1 << offset;
1772
1774 }
1775 }
1776
1778 {
1779
1780 int offset;
1781 int mask;
1782
1783 if ( part_id >= 1 && part_id <= 31 )
1784 {
1785 offset = part_id - 1;
1786 mask = 1 << offset;
1787
1789 }
1790 else if ( part_id >= 32 && part_id <= 62 )
1791 {
1792 offset = ( part_id % 32 );
1793 mask = 1 << offset;
1794
1796 }
1797 else if ( part_id >= 63 && part_id <= 93 )
1798 {
1799 offset = ( part_id % 63 );
1800 mask = 1 << offset;
1801
1803 }
1804 }
1805
1807 {
1808
1809 int offset;
1810 int mask;
1811
1812 if ( part_id >= 1 && part_id <= 31 )
1813 {
1814 offset = part_id - 1;
1815 mask = 1 << offset;
1816
1818 {
1819 return true;
1820 }
1821 }
1822 else if ( part_id >= 32 && part_id <= 62 )
1823 {
1824 offset = ( part_id % 32 );
1825 mask = 1 << offset;
1826
1828 {
1829 return true;
1830 }
1831 }
1832 else if ( part_id >= 63 && part_id <= 93 )
1833 {
1834 offset = ( part_id % 63 );
1835 mask = 1 << offset;
1836
1838 {
1839 return true;
1840 }
1841 }
1842
1843 return false;
1844 }
1845
1847 {
1850 }
1851
1853 {
1854
1857 }
1858
1860 {
1862 {
1865
1866 switch( build_action_id )
1867 {
1871 }
1872 }
1873 }
1874
1875
1877 {
1879 bool is_base = part.
IsBase();
1882 if ( is_part_built_sync )
1883 {
1885 {
1889
1890 if (is_base)
1891 {
1894 }
1895 }
1896 }
1897 else
1898 {
1900 {
1904
1905 if (is_base)
1906 {
1909 }
1910 }
1911 }
1912
1913
1915 }
1916
1917
1919 {
1922
1923 for ( int i = 0; i < construction_parts.Count(); ++i )
1924 {
1925 string key = construction_parts.GetKey( i );
1928 }
1929
1930
1932 }
1933
1935 {
1938
1939 for ( int i = 0; i < construction_parts.Count(); ++i )
1940 {
1941 string key = construction_parts.GetKey( i );
1943
1944 if ( value.
GetId() ==
id )
1945 {
1946 return value;
1947 }
1948 }
1949
1950 return NULL;
1951 }
1952
1953
1954
1956 {
1958 }
1959
1961 {
1963 }
1964
1966 {
1967 return true;
1968 }
1969
1971 {
1972 return false;
1973 }
1974
1975
1977 {
1980 {
1982 }
1983
1984 return construction_kit;
1985 }
1986
1988 {
1991 {
1993 }
1994 }
1995
1997 {
1999 }
2000
2002 {
2003 return "";
2004 }
2005
2007 {
2010 }
2011
2012
2014 {
2017 }
2018
2019
2021 {
2022 super.OnStoreSave( ctx );
2023
2024
2028
2030 }
2031
2033 {
2034 if ( !super.OnStoreLoad( ctx, version ) )
2035 return false;
2036
2037
2038
2040 {
2042 return false;
2043 }
2045 {
2047 return false;
2048 }
2050 {
2052 return false;
2053 }
2054
2055
2057 {
2059 return false;
2060 }
2061
2062
2063 return true;
2064 }
2065
2067 {
2068 super.AfterStoreLoad();
2069
2071 {
2073 }
2074 }
2075
2077 {
2078
2080
2081
2084
2085
2087 }
2088
2090 {
2091 super.OnCreatePhysics();
2094 }
2095
2097 {
2099 return;
2100
2101 super.EEHealthLevelChanged(oldLevel,newLevel,zone);
2102
2104 return;
2105
2107 string part_name = zone;
2109
2111 {
2112 ConstructionPart construction_part = construction.GetConstructionPart( part_name );
2113
2114 if ( construction_part && construction.IsPartConstructed( part_name ) )
2115 {
2117 construction.DestroyConnectedParts(part_name);
2118 }
2119
2120
2121 if ( part_name.
Contains(
"barbed") )
2122 {
2123 BarbedWire barbed_wire = BarbedWire.Cast( FindAttachmentBySlotName( zone ) );
2124 if (barbed_wire)
2125 barbed_wire.SetMountedState( false );
2126 }
2127 }
2128 }
2129
2131 {
2133 {
2135 }
2136
2137 super.EEOnAfterLoad();
2138 }
2139
2141 {
2142 super.EEInit();
2143
2144
2146
2147
2148 #ifdef DEVELOPER
2150 #endif
2151 }
2152
2154 {
2155 super.EEItemAttached( item, slot_name );
2156
2160 }
2161
2163 {
2164 super.EEItemDetached( item, slot_name );
2165
2168 }
2169
2170 protected void OnSetSlotLock(
int slotId,
bool locked,
bool was_locked )
2171 {
2174
2177 }
2178
2179
2181 {
2182 return true;
2183 }
2184
2185
2186
2188 {
2190
2191
2192 if (construtionPart.
IsBase())
2193 {
2195
2196
2198 }
2199
2200
2202
2203
2205
2206
2208
2210
2212
2213
2215
2216
2218 }
2219
2221 {
2222
2224 }
2225
2226
2228 {
2231
2232
2234
2235
2237
2238
2240
2241
2243
2245
2246
2248
2249
2251
2252
2253 if (construtionPart.
IsBase())
2254 {
2255
2257 }
2258
2261 }
2262
2264 {
2265
2267 }
2268
2269
2270 void OnPartDestroyedServer(Man player,
string part_name,
int action_id,
bool destroyed_by_connected_part =
false)
2271 {
2274
2275
2277
2278
2280
2281
2283
2284
2286
2288
2289
2291
2292
2294
2295
2296 if (construtionPart.
IsBase())
2297 {
2298
2300 }
2301
2304 }
2305
2307 {
2308
2310 }
2311
2313 {
2314 bool process = false;
2315
2316
2320
2321 if (process)
2322 {
2323 if (!MemoryPointExists(part.
m_PartName +
"_min") || !MemoryPointExists(part.
m_PartName +
"_max"))
2324 {
2326 return;
2327 }
2328
2330 mins = ModelToWorld(GetMemoryPointPos(part.
m_PartName +
"_min"));
2331 maxs = ModelToWorld(GetMemoryPointPos(part.
m_PartName +
"_max"));
2332
2333
2335 minTmp[0] =
Math.
Min(mins[0],maxs[0]);
2336 maxTmp[0] =
Math.
Max(mins[0],maxs[0]);
2337 minTmp[1] =
Math.
Min(mins[1],maxs[1]);
2338 maxTmp[1] =
Math.
Max(mins[1],maxs[1]);
2339 minTmp[2] =
Math.
Min(mins[2],maxs[2]);
2340 maxTmp[2] =
Math.
Max(mins[2],maxs[2]);
2341 mins = minTmp;
2342 maxs = maxTmp;
2343
2344 maxs[1] = maxs[1] + 0.35;
2345
2347 }
2348 }
2349
2351 {
2354
2355
2357 foreach (
EntityAI entity : foundEntities)
2358 {
2361 }
2362 }
2363
2364
2366 {
2368
2372 }
2373
2375 {
2377
2379 {
2381 }
2382 else
2383 {
2385 }
2386
2388 }
2389
2391 {
2393
2395 foreach (
string slotName : attachmentSlots)
2396 {
2398 }
2399
2400
2403 else
2405
2407 }
2408
2410 {
2411 string slotNameMounted = slot_name + "_Mounted";
2412 EntityAI attachment = FindAttachmentBySlotName(slot_name);
2413
2414 if (attachment)
2415 {
2416 BarbedWire barbedWire = BarbedWire.Cast(attachment);
2417 if (barbedWire && barbedWire.IsMounted())
2419 else
2421
2422 if (is_locked)
2423 {
2424 SetAnimationPhase(slotNameMounted, 0);
2425 SetAnimationPhase(slot_name, 1);
2426 }
2427 else
2428 {
2429 SetAnimationPhase(slotNameMounted, 1);
2430 SetAnimationPhase(slot_name, 0);
2431 }
2432 }
2433 else
2434 {
2435 SetAnimationPhase(slotNameMounted, 1);
2436 SetAnimationPhase(slot_name, 1);
2437
2439 }
2440 }
2441
2442
2444 {
2447
2450
2453
2454 foreach (
string slotName : attachmentSlots)
2455 {
2457 }
2458
2459
2461 {
2464
2466 }
2467 else
2468 {
2471
2473 }
2474
2477 }
2478
2480 {
2481
2483 return;
2484
2485 string slot_name_mounted = slot_name + "_Mounted";
2486 EntityAI attachment = FindAttachmentBySlotName( slot_name );
2487
2488
2490 RemoveProxyPhysics( slot_name_mounted );
2491 RemoveProxyPhysics( slot_name );
2492
2493 if ( attachment )
2494 {
2496 if ( is_locked )
2497 {
2499 AddProxyPhysics( slot_name_mounted );
2500 }
2501 else
2502 {
2504 AddProxyPhysics( slot_name );
2505 }
2506 }
2507 }
2508
2510 {
2511 SetAffectPathgraph( true, false );
2513 }
2514
2516 {
2517 return true;
2518 }
2519
2521 {
2522 return true;
2523 }
2524
2526 {
2527 if ( attachment )
2528 {
2530 attachment.GetInventory().GetCurrentInventoryLocation( inventory_location );
2531
2532 return GetInventory().GetSlotLock( inventory_location.
GetSlot() );
2533 }
2534
2535 return false;
2536 }
2537
2539 {
2541 }
2542
2543
2545 {
2546 string config_path = "CfgVehicles" + " " + entity.GetType() + " " + "attachments";
2547 if (
GetGame().ConfigIsExisting( config_path ) )
2548 {
2550 }
2551 }
2552
2554 {
2555 return true;
2556 }
2557
2559 {
2560 return true;
2561 }
2562
2564 {
2565 return true;
2566 }
2567
2568
2570 {
2572 {
2574 }
2575
2577 }
2578
2580 {
2582 }
2583
2584
2585
2587 {
2588 return super.CanReceiveAttachment(attachment, slotId);
2589 }
2590
2592 {
2593 int attachment_count = GetInventory().AttachmentCount();
2594 if ( attachment_count > 0 )
2595 {
2596 if (
HasBase() && attachment_count == 1 )
2597 {
2598 return false;
2599 }
2600
2601 return true;
2602 }
2603
2604 return false;
2605 }
2606
2608 {
2609 return true;
2610 }
2611
2613 {
2614 return false;
2615 }
2616
2617
2619 {
2620 return false;
2621 }
2622
2624 {
2625 return false;
2626 }
2627
2628
2630 {
2631 return false;
2632 }
2633
2634
2635
2637 {
2638 return true;
2639 }
2640
2642 {
2643 return true;
2644 }
2645
2648 {
2649 return false;
2650 }
2651
2652
2654 {
2655 return true;
2656 }
2657
2658
2660 {
2661 return false;
2662 }
2663
2664
2666 {
2667 return true;
2668 }
2669
2670
2672 {
2673 if (
HasBase() || GetInventory().AttachmentCount() > 0 )
2674 {
2675 return false;
2676 }
2677
2678 return true;
2679 }
2680
2682 {
2685
2686 return item;
2687 }
2688
2689
2691 {
2693 {
2694
2696
2697
2700
2702 if ( MemoryPointExists( slot_name + "_min" ) )
2703 {
2704 min_max[0] = GetMemoryPointPos( slot_name + "_min" );
2705 }
2706 if ( MemoryPointExists( slot_name + "_max" ) )
2707 {
2708 min_max[1] = GetMemoryPointPos( slot_name + "_max" );
2709 }
2710
2711
2714
2715
2718 center = ModelToWorld( center );
2719
2720
2723
2724 areaDamage.SetExtents( extents[0], extents[1] );
2725 areaDamage.SetAreaPosition( center );
2726 areaDamage.SetAreaOrientation( orientation );
2729 areaDamage.SetHitZones( { "Torso","LeftHand","LeftLeg","LeftFoot","RightHand","RightLeg","RightFoot" } );
2730 areaDamage.SetAmmoName( "BarbedWireHit" );
2731 areaDamage.Spawn();
2732
2734 }
2735 }
2736
2738 {
2739 if ( angle_deg != 0 )
2740 {
2741
2742 orientation[0] = orientation[0] - angle_deg;
2743
2744
2746 if ( MemoryPointExists( "rotate_axis" ) )
2747 {
2748 rotate_axis = ModelToWorld( GetMemoryPointPos( "rotate_axis" ) );
2749 }
2750 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];
2751 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];
2752 center[0] = r_center_x;
2753 center[2] = r_center_z;
2754 }
2755 }
2756
2758 {
2760 {
2763 {
2764 if (areaDamage)
2765 {
2766 areaDamage.Destroy();
2767 }
2768
2770 }
2771 }
2772 }
2773
2775 {
2776 return true;
2777 }
2778
2779
2780
2781
2783 {
2785 }
2786
2788 {
2790 }
2791
2793 {
2795 }
2796
2798 {
2800
2801 switch ( material_type )
2802 {
2808 }
2809
2810 return "";
2811 }
2812
2814 {
2816
2817 switch ( material_type )
2818 {
2824 }
2825
2826 return "";
2827 }
2828
2829
2831 {
2833 {
2834
2836 {
2837 SetHealth(slot_name,"Health",item.GetHealth());
2838 }
2839 }
2840 }
2841
2843 {
2844 return 111;
2845 }
2846
2848 {
2849 super.SetActions();
2850
2854 }
2855
2856
2857
2858
2860 {
2861 }
2862
2865 {
2866 return null;
2867 }
2868
2870 {
2872 }
2873
2875 {
2878
2879 Man p;
2880
2881 #ifdef SERVER
2884 if (players.Count())
2885 p = players[0];
2886 #else
2888 #endif
2889
2891 {
2892 bool excluded = false;
2894 if (excludes)
2895 {
2896 foreach (string exclude : excludes)
2897 {
2899 {
2900 excluded = true;
2901 break;
2902 }
2903 }
2904 }
2905
2906 if (!excluded)
2907 {
2909 }
2910 }
2911
2913 }
2914}
2915
2917{
2918#ifdef BSB_DEBUG
2920#else
2921
2922#endif
2923}
2925{
2926#ifdef BSB_DEBUG_SPAM
2928#else
2929
2930#endif
2931}
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.