diff --git a/Prefabs/Characters/Factions/BLUFOR/US_Army/Character_US_Medic_P_OTF.et b/Prefabs/Characters/Factions/BLUFOR/US_Army/Character_US_Medic_P_OTF.et index ef5d902..d367489 100644 --- a/Prefabs/Characters/Factions/BLUFOR/US_Army/Character_US_Medic_P_OTF.et +++ b/Prefabs/Characters/Factions/BLUFOR/US_Army/Character_US_Medic_P_OTF.et @@ -1,6 +1,17 @@ SCR_ChimeraCharacter : "{C9E4FEAF5AAC8D8C}Prefabs/Characters/Factions/BLUFOR/US_Army/Character_US_Medic.et" { ID "51FA8A5F10E81780" components { + SCR_CharacterInventoryStorageComponent "{520EA1D2DB118DAC}" { + components { + SCR_EquipmentStorageComponent "{56B49DA9722B635D}" { + InitialStorageSlots { + SCR_EquipmentStorageSlot BinocularSlot { + Prefab "{0CF54B9A85D8E0D4}Prefabs/Items/Equipment/Binoculars/Binoculars_M22/Binoculars_M22.et" + } + } + } + } + } PS_PlayableComponent "{5EFCC1946F475F15}" { m_bIsPlayable 1 } diff --git a/Prefabs/Characters/Factions/BLUFOR/US_Army/Character_US_Rifleman_P_OTF.et b/Prefabs/Characters/Factions/BLUFOR/US_Army/Character_US_Rifleman_P_OTF.et index 2d27195..88d293b 100644 --- a/Prefabs/Characters/Factions/BLUFOR/US_Army/Character_US_Rifleman_P_OTF.et +++ b/Prefabs/Characters/Factions/BLUFOR/US_Army/Character_US_Rifleman_P_OTF.et @@ -1,6 +1,17 @@ SCR_ChimeraCharacter : "{26A9756790131354}Prefabs/Characters/Factions/BLUFOR/US_Army/Character_US_Rifleman.et" { ID "52092032B0E62200" components { + SCR_CharacterInventoryStorageComponent "{520EA1D2DB118DAC}" { + components { + SCR_EquipmentStorageComponent "{56B49DA9722B635D}" { + InitialStorageSlots { + SCR_EquipmentStorageSlot BinocularSlot { + Prefab "{0CF54B9A85D8E0D4}Prefabs/Items/Equipment/Binoculars/Binoculars_M22/Binoculars_M22.et" + } + } + } + } + } PS_PlayableComponent "{5EFCC1946F475F15}" { m_bIsPlayable 1 } diff --git a/Prefabs/Characters/Factions/BLUFOR/US_Army/Character_US_SL_P_OTF_Commander.et b/Prefabs/Characters/Factions/BLUFOR/US_Army/Character_US_SL_P_OTF_Commander.et index a01607d..5d3ff19 100644 --- a/Prefabs/Characters/Factions/BLUFOR/US_Army/Character_US_SL_P_OTF_Commander.et +++ b/Prefabs/Characters/Factions/BLUFOR/US_Army/Character_US_SL_P_OTF_Commander.et @@ -4,7 +4,7 @@ SCR_ChimeraCharacter : "{DBC177C261C93B9D}Prefabs/Characters/Factions/BLUFOR/US_ GRAD_CharacterRoleComponent "{5EFAD1CA30638A4A}" { m_sCharacterRole "OTF Commander" } - PS_PlayableComponent "{5E61249FA37809F5}" { + PS_PlayableComponent "{5EFCC1946F475F15}" { m_name "Blufor Commander" } SCR_InventoryStorageManagerComponent "{520EA1D2DB118DE5}" { diff --git a/Prefabs/Characters/Factions/OPFOR/USSR_Army/Character_USSR_Medic_P_OTF.et b/Prefabs/Characters/Factions/OPFOR/USSR_Army/Character_USSR_Medic_P_OTF.et index dc3e3df..c6ab86d 100644 --- a/Prefabs/Characters/Factions/OPFOR/USSR_Army/Character_USSR_Medic_P_OTF.et +++ b/Prefabs/Characters/Factions/OPFOR/USSR_Army/Character_USSR_Medic_P_OTF.et @@ -1,6 +1,17 @@ SCR_ChimeraCharacter : "{AB9726163EC1BD81}Prefabs/Characters/Factions/OPFOR/USSR_Army/Character_USSR_Medic.et" { ID "51FAD317FC20EC1B" components { + SCR_CharacterInventoryStorageComponent "{520EA1D2DB118DAC}" { + components { + SCR_EquipmentStorageComponent "{56B49DA9722B635D}" { + InitialStorageSlots { + SCR_EquipmentStorageSlot BinocularSlot { + Prefab "{243948B23D90BECB}Prefabs/Items/Equipment/Binoculars/Binoculars_B8/Binoculars_B8.et" + } + } + } + } + } PS_PlayableComponent "{5EFCC1946F475F15}" { m_bIsPlayable 1 } diff --git a/Prefabs/Characters/Factions/OPFOR/USSR_Army/Character_USSR_SL_P_OTF_Commander.et b/Prefabs/Characters/Factions/OPFOR/USSR_Army/Character_USSR_SL_P_OTF_Commander.et index c6edd2d..32d2e05 100644 --- a/Prefabs/Characters/Factions/OPFOR/USSR_Army/Character_USSR_SL_P_OTF_Commander.et +++ b/Prefabs/Characters/Factions/OPFOR/USSR_Army/Character_USSR_SL_P_OTF_Commander.et @@ -4,7 +4,7 @@ SCR_ChimeraCharacter : "{A5F4D7FEBDB57182}Prefabs/Characters/Factions/OPFOR/USSR GRAD_CharacterRoleComponent "{5EFAD1CA30638A4A}" { m_sCharacterRole "OTF Commander" } - PS_PlayableComponent "{5E61249E802F3DC3}" { + PS_PlayableComponent "{5EFCC1946F475F15}" { m_name "Opfor Commander" } CharacterWeaponSlotComponent "{520EA1D2F659CFAB}" { @@ -12,15 +12,15 @@ SCR_ChimeraCharacter : "{A5F4D7FEBDB57182}Prefabs/Characters/Factions/OPFOR/USSR } SCR_InventoryStorageManagerComponent "{520EA1D2DB118DE5}" { InitialInventoryItems { - ItemsInitConfigurationItem "{5F0ABB2A8C9FF1BE}" { - TargetStorage "Prefabs/Characters/Uniforms/Jacket_M88.et" + ItemsInitConfigurationItem "{54A68D6220405B43}" { PrefabsToSpawn { - "{B0E67230AEEE2DF3}Prefabs/Items/Wallet.et" + "{77EAE5E07DC4678A}Prefabs/Weapons/Grenades/Smoke_RDG2.et" "{77EAE5E07DC4678A}Prefabs/Weapons/Grenades/Smoke_RDG2.et" "{645C73791ECA1698}Prefabs/Weapons/Grenades/Grenade_RGD5.et" "{0A84AA5A3884176F}Prefabs/Weapons/Magazines/Magazine_545x39_AK_30rnd_Last_5Tracer.et" "{0A84AA5A3884176F}Prefabs/Weapons/Magazines/Magazine_545x39_AK_30rnd_Last_5Tracer.et" "{0A84AA5A3884176F}Prefabs/Weapons/Magazines/Magazine_545x39_AK_30rnd_Last_5Tracer.et" "{0A84AA5A3884176F}Prefabs/Weapons/Magazines/Magazine_545x39_AK_30rnd_Last_5Tracer.et" "{E5912E45754CD421}Prefabs/Weapons/Magazines/Magazine_545x39_AK_30rnd_Tracer.et" "{E5912E45754CD421}Prefabs/Weapons/Magazines/Magazine_545x39_AK_30rnd_Tracer.et" } } - ItemsInitConfigurationItem "{54A68D6220405B43}" { + ItemsInitConfigurationItem "{5F0ABB2A8C9FF1BE}" { + TargetStorage "Prefabs/Characters/Uniforms/Jacket_M88.et" PrefabsToSpawn { - "{77EAE5E07DC4678A}Prefabs/Weapons/Grenades/Smoke_RDG2.et" "{77EAE5E07DC4678A}Prefabs/Weapons/Grenades/Smoke_RDG2.et" "{645C73791ECA1698}Prefabs/Weapons/Grenades/Grenade_RGD5.et" "{0A84AA5A3884176F}Prefabs/Weapons/Magazines/Magazine_545x39_AK_30rnd_Last_5Tracer.et" "{0A84AA5A3884176F}Prefabs/Weapons/Magazines/Magazine_545x39_AK_30rnd_Last_5Tracer.et" "{0A84AA5A3884176F}Prefabs/Weapons/Magazines/Magazine_545x39_AK_30rnd_Last_5Tracer.et" "{0A84AA5A3884176F}Prefabs/Weapons/Magazines/Magazine_545x39_AK_30rnd_Last_5Tracer.et" "{E5912E45754CD421}Prefabs/Weapons/Magazines/Magazine_545x39_AK_30rnd_Tracer.et" "{E5912E45754CD421}Prefabs/Weapons/Magazines/Magazine_545x39_AK_30rnd_Tracer.et" + "{B0E67230AEEE2DF3}Prefabs/Items/Wallet.et" } } } diff --git a/Prefabs/GRAD_OTF_Blufor_Flag.et b/Prefabs/GRAD_OTF_Blufor_Flag.et index ddfd2f3..3357441 100644 --- a/Prefabs/GRAD_OTF_Blufor_Flag.et +++ b/Prefabs/GRAD_OTF_Blufor_Flag.et @@ -10,10 +10,9 @@ GenericEntity : "{E55FC02F8C1518A2}Prefabs/Structures/Military/Flags/FlagPole_02 ADM_ShopMerchandise "{5EFC80FFD2B8E928}" { m_Merchandise ADM_MerchandiseItem "{5EFC80FFE3F971FE}" { m_sPrefab "{2EBF60EF24B108FC}Prefabs/Weapons/Magazines/Magazine_556x45_STANAG_30rnd_Ball.et" - m_AllowSaleWithFullInventory 0 } - m_RequiredPayment { - ADM_PaymentMethodCurrency "{5EFC80FFECB97029}" { + m_BuyPayment { + ADM_PaymentMethodCurrency "{618C86A40F3A2D59}" { m_Quantity 10 } } @@ -21,10 +20,9 @@ GenericEntity : "{E55FC02F8C1518A2}Prefabs/Structures/Military/Flags/FlagPole_02 ADM_ShopMerchandise "{5EFC80FFEBD53515}" { m_Merchandise ADM_MerchandiseItem "{5EFC80FFF5FFE1B0}" { m_sPrefab "{D8F2CA92583B23D3}Prefabs/Weapons/Magazines/Magazine_556x45_STANAG_30rnd_Last_5Tracer.et" - m_AllowSaleWithFullInventory 0 } - m_RequiredPayment { - ADM_PaymentMethodCurrency "{5EFC80FFF04ED6D9}" { + m_BuyPayment { + ADM_PaymentMethodCurrency "{618C86A40AF4A259}" { m_Quantity 10 } } @@ -32,10 +30,9 @@ GenericEntity : "{E55FC02F8C1518A2}Prefabs/Structures/Military/Flags/FlagPole_02 ADM_ShopMerchandise "{5EFC80FFFD8C1F89}" { m_Merchandise ADM_MerchandiseItem "{5EFC80FFFE52977C}" { m_sPrefab "{A9A385FE1F7BF4BD}Prefabs/Weapons/Magazines/Magazine_556x45_STANAG_30rnd_Tracer.et" - m_AllowSaleWithFullInventory 0 } - m_RequiredPayment { - ADM_PaymentMethodCurrency "{5EFC80FF0414650A}" { + m_BuyPayment { + ADM_PaymentMethodCurrency "{618C86A4119D4A57}" { m_Quantity 10 } } @@ -44,8 +41,8 @@ GenericEntity : "{E55FC02F8C1518A2}Prefabs/Structures/Military/Flags/FlagPole_02 m_Merchandise ADM_MerchandiseVehicle "{5EFC9AD91D463E32}" { m_sPrefab "{F6B23D17D5067C11}Prefabs/Vehicles/Wheeled/M151A2/M151A2_M2HB.et" } - m_RequiredPayment { - ADM_PaymentMethodCurrency "{5EFC9AD93EFD82B5}" { + m_BuyPayment { + ADM_PaymentMethodCurrency "{618C86A41B1B5997}" { m_Quantity 2000 } } @@ -54,8 +51,8 @@ GenericEntity : "{E55FC02F8C1518A2}Prefabs/Structures/Military/Flags/FlagPole_02 m_Merchandise ADM_MerchandiseVehicle "{5EFC9E9BF9C0882F}" { m_sPrefab "{70BAEEFC2D3FEE64}Prefabs/Vehicles/Helicopters/UH1H/UH1H.et" } - m_RequiredPayment { - ADM_PaymentMethodCurrency "{5EFC9E9B1355521B}" { + m_BuyPayment { + ADM_PaymentMethodCurrency "{618C86A42079D21D}" { m_Quantity 3000 } } @@ -64,8 +61,8 @@ GenericEntity : "{E55FC02F8C1518A2}Prefabs/Structures/Military/Flags/FlagPole_02 m_Merchandise ADM_MerchandiseVehicle "{5EFC9E9B2152420F}" { m_sPrefab "{F1FBD0972FA5FE09}Prefabs/Vehicles/Wheeled/M923A1/M923A1_transport.et" } - m_RequiredPayment { - ADM_PaymentMethodCurrency "{5EFC9E9D9CDADA83}" { + m_BuyPayment { + ADM_PaymentMethodCurrency "{618C86A429630AAC}" { m_Quantity 1000 } } @@ -73,10 +70,9 @@ GenericEntity : "{E55FC02F8C1518A2}Prefabs/Structures/Military/Flags/FlagPole_02 ADM_ShopMerchandise "{5EFC9E9D7815D580}" { m_Merchandise ADM_MerchandiseItem "{5EFC9E9C856BB5D8}" { m_sPrefab "{3E413771E1834D2F}Prefabs/Weapons/Rifles/M16/Rifle_M16A2.et" - m_AllowSaleWithFullInventory 0 } - m_RequiredPayment { - ADM_PaymentMethodCurrency "{5EFC9E9C81E5743E}" { + m_BuyPayment { + ADM_PaymentMethodCurrency "{618C86A4308695A3}" { m_Quantity 250 } } @@ -85,8 +81,8 @@ GenericEntity : "{E55FC02F8C1518A2}Prefabs/Structures/Military/Flags/FlagPole_02 m_Merchandise ADM_MerchandiseItem "{5EFCF0B366F35735}" { m_sPrefab "{E8F00BF730225B00}Prefabs/Weapons/Grenades/Grenade_M67.et" } - m_RequiredPayment { - ADM_PaymentMethodCurrency "{5EFCF0B36D48E38F}" { + m_BuyPayment { + ADM_PaymentMethodCurrency "{618C86A4446EC82F}" { m_Quantity 50 } } @@ -95,8 +91,8 @@ GenericEntity : "{E55FC02F8C1518A2}Prefabs/Structures/Military/Flags/FlagPole_02 m_Merchandise ADM_MerchandiseItem "{5EFCF0B3756D23B1}" { m_sPrefab "{9DB69176CEF0EE97}Prefabs/Weapons/Grenades/Smoke_ANM8HC.et" } - m_RequiredPayment { - ADM_PaymentMethodCurrency "{5EFCF0B370B2C600}" { + m_BuyPayment { + ADM_PaymentMethodCurrency "{618C86A44251F362}" { m_Quantity 15 } } @@ -105,8 +101,8 @@ GenericEntity : "{E55FC02F8C1518A2}Prefabs/Structures/Military/Flags/FlagPole_02 m_Merchandise ADM_MerchandiseItem "{5F0ABB2E02718191}" { m_sPrefab "{D2B48DEBEF38D7D7}Prefabs/Weapons/MachineGuns/M249/MG_M249.et" } - m_RequiredPayment { - ADM_PaymentMethodCurrency "{5F0ABB2E14AAB475}" { + m_BuyPayment { + ADM_PaymentMethodCurrency "{618C86A448161866}" { m_Quantity 500 } } @@ -115,18 +111,18 @@ GenericEntity : "{E55FC02F8C1518A2}Prefabs/Structures/Military/Flags/FlagPole_02 m_Merchandise ADM_MerchandiseItem "{5F0ABB2E1ECDA3A8}" { m_sPrefab "{06D722FC2666EB83}Prefabs/Weapons/Magazines/Box_556x45_M249_200rnd_4Ball_1Tracer.et" } - m_RequiredPayment { - ADM_PaymentMethodCurrency "{5F0ABB2E27895E9C}" { + m_BuyPayment { + ADM_PaymentMethodCurrency "{618C86A450545472}" { m_Quantity 80 } } } - ADM_ShopMerchandise "{5F0ABB2E2C76A96F}" { - m_Merchandise ADM_MerchandiseType "{5F0ABB2E2ED858DD}" { + ADM_ShopMerchandise "{618C86AA12ED6763}" { + m_Merchandise ADM_MerchandiseItem "{618C86AA27797A95}" { m_sPrefab "{4FCBBDF274FD2157}Prefabs/Weapons/Magazines/Box_556x45_M249_200rnd_Ball.et" } - m_RequiredPayment { - ADM_PaymentMethodCurrency "{5F0ABB2E34C23A7D}" { + m_BuyPayment { + ADM_PaymentMethodCurrency "{618C86AA4D8A4025}" { m_Quantity 80 } } @@ -135,8 +131,8 @@ GenericEntity : "{E55FC02F8C1518A2}Prefabs/Structures/Military/Flags/FlagPole_02 m_Merchandise ADM_MerchandiseItem "{5F0ABB2E3D35DDFB}" { m_sPrefab "{4EEDDB27C023B8B9}Prefabs/Weapons/Magazines/Box_556x45_M249_200rnd_Tracer.et" } - m_RequiredPayment { - ADM_PaymentMethodCurrency "{5F0ABB2E45B303AD}" { + m_BuyPayment { + ADM_PaymentMethodCurrency "{618C86A46A0F3EFF}" { m_Quantity 80 } } @@ -145,8 +141,8 @@ GenericEntity : "{E55FC02F8C1518A2}Prefabs/Structures/Military/Flags/FlagPole_02 m_Merchandise ADM_MerchandiseItem "{5F0ABB2E49426C0E}" { m_sPrefab "{9C5C20FB0E01E64F}Prefabs/Weapons/Launchers/M72/Launcher_M72A3.et" } - m_RequiredPayment { - ADM_PaymentMethodCurrency "{5F0ABB2E515B3CD1}" { + m_BuyPayment { + ADM_PaymentMethodCurrency "{618C86A47CE46F82}" { m_Quantity 400 } } @@ -155,8 +151,8 @@ GenericEntity : "{E55FC02F8C1518A2}Prefabs/Structures/Military/Flags/FlagPole_02 m_Merchandise ADM_MerchandiseItem "{5F0ABB2E5AEFBC67}" { m_sPrefab "{79FA751EEBE25DDE}Prefabs/Weapons/Ammo/Ammo_Rocket_M72A3.et" } - m_RequiredPayment { - ADM_PaymentMethodCurrency "{5F0ABB2E6DC1D99C}" { + m_BuyPayment { + ADM_PaymentMethodCurrency "{618C86AB870AE11C}" { m_Quantity 200 } } @@ -165,8 +161,8 @@ GenericEntity : "{E55FC02F8C1518A2}Prefabs/Structures/Military/Flags/FlagPole_02 m_Merchandise ADM_MerchandiseItem "{5F0ABB2937092439}" { m_sPrefab "{06B68C58B72EAAC6}Prefabs/Items/Equipment/Backpacks/Backpack_ALICE_Medium.et" } - m_RequiredPayment { - ADM_PaymentMethodCurrency "{5F0ABB293C17701D}" { + m_BuyPayment { + ADM_PaymentMethodCurrency "{618C86AB8878804B}" { m_Quantity 10 } } @@ -188,14 +184,6 @@ GenericEntity : "{E55FC02F8C1518A2}Prefabs/Structures/Military/Flags/FlagPole_02 "main" } } - GRAD_CheckBalanceUserAction "{5F0C7C86D7075612}" { - ParentContextList { - "main" - } - UIInfo UIInfo "{5F0C7C86D39E4A6B}" { - Name "Check Balance" - } - } } } RplComponent "{5EFC80FFAFF86E41}" { diff --git a/Prefabs/GRAD_OTF_Opfor_Barrel.et b/Prefabs/GRAD_OTF_Opfor_Barrel.et index 3aef683..1b518d9 100644 --- a/Prefabs/GRAD_OTF_Opfor_Barrel.et +++ b/Prefabs/GRAD_OTF_Opfor_Barrel.et @@ -12,10 +12,9 @@ GenericEntity : "{46F077BDA1AF95B2}PrefabsEditable/Auto/Props/Industrial/E_Barre ADM_ShopMerchandise "{5EFAFA0833468140}" { m_Merchandise ADM_MerchandiseItem "{5EFAFA083912A160}" { m_sPrefab "{E5912E45754CD421}Prefabs/Weapons/Magazines/Magazine_545x39_AK_30rnd_Tracer.et" - m_AllowSaleWithFullInventory 0 } - m_RequiredPayment { - ADM_PaymentMethodCurrency "{5EFAFA087D2A56F3}" { + m_BuyPayment { + ADM_PaymentMethodCurrency "{618C86A521BC3664}" { m_Quantity 10 } } @@ -23,10 +22,9 @@ GenericEntity : "{46F077BDA1AF95B2}PrefabsEditable/Auto/Props/Industrial/E_Barre ADM_ShopMerchandise "{5EFAFA086779FEC2}" { m_Merchandise ADM_MerchandiseItem "{5EFAFA086F3E896C}" { m_sPrefab "{0A84AA5A3884176F}Prefabs/Weapons/Magazines/Magazine_545x39_AK_30rnd_Last_5Tracer.et" - m_AllowSaleWithFullInventory 0 } - m_RequiredPayment { - ADM_PaymentMethodCurrency "{5EFAFA0986B9E03F}" { + m_BuyPayment { + ADM_PaymentMethodCurrency "{618C86A52848DC80}" { m_Quantity 10 } } @@ -34,10 +32,9 @@ GenericEntity : "{46F077BDA1AF95B2}PrefabsEditable/Auto/Props/Industrial/E_Barre ADM_ShopMerchandise "{5EFAFA0869A4AAB0}" { m_Merchandise ADM_MerchandiseItem "{5EFAFA08755EDA9E}" { m_sPrefab "{BBB50A815A2F916B}Prefabs/Weapons/Magazines/Magazine_545x39_AK_30rnd_Ball.et" - m_AllowSaleWithFullInventory 0 } - m_RequiredPayment { - ADM_PaymentMethodCurrency "{5EFAFA098C878D04}" { + m_BuyPayment { + ADM_PaymentMethodCurrency "{618C86A53640B6F0}" { m_Quantity 10 } } @@ -45,10 +42,9 @@ GenericEntity : "{46F077BDA1AF95B2}PrefabsEditable/Auto/Props/Industrial/E_Barre ADM_ShopMerchandise "{5EFC9E9CAE72242C}" { m_Merchandise ADM_MerchandiseItem "{5EFC9E9CB5F5D6D5}" { m_sPrefab "{FA5C25BF66A53DCF}Prefabs/Weapons/Rifles/AK74/Rifle_AK74.et" - m_AllowSaleWithFullInventory 0 } - m_RequiredPayment { - ADM_PaymentMethodCurrency "{5EFC9E9CB3458783}" { + m_BuyPayment { + ADM_PaymentMethodCurrency "{618C86A5387AB37D}" { m_Quantity 250 } } @@ -57,8 +53,8 @@ GenericEntity : "{46F077BDA1AF95B2}PrefabsEditable/Auto/Props/Industrial/E_Barre m_Merchandise ADM_MerchandiseItem "{5EFCF0B1E0860003}" { m_sPrefab "{D6EF54367CECE1D9}Prefabs/Weapons/Explosives/Mine_TM62M/Mine_TM62M.et" } - m_RequiredPayment { - ADM_PaymentMethodCurrency "{5EFCF0B1ECB531C6}" { + m_BuyPayment { + ADM_PaymentMethodCurrency "{618C86A5BF41B331}" { m_Quantity 250 } } @@ -67,8 +63,8 @@ GenericEntity : "{46F077BDA1AF95B2}PrefabsEditable/Auto/Props/Industrial/E_Barre m_Merchandise ADM_MerchandiseItem "{5EFCF0B30A3BF0A3}" { m_sPrefab "{645C73791ECA1698}Prefabs/Weapons/Grenades/Grenade_RGD5.et" } - m_RequiredPayment { - ADM_PaymentMethodCurrency "{5EFCF0B3169CD57A}" { + m_BuyPayment { + ADM_PaymentMethodCurrency "{618C86A54D47EDE9}" { m_Quantity 50 } } @@ -77,8 +73,8 @@ GenericEntity : "{46F077BDA1AF95B2}PrefabsEditable/Auto/Props/Industrial/E_Barre m_Merchandise ADM_MerchandiseItem "{5EFCF0B331282F25}" { m_sPrefab "{77EAE5E07DC4678A}Prefabs/Weapons/Grenades/Smoke_RDG2.et" } - m_RequiredPayment { - ADM_PaymentMethodCurrency "{5EFCF0B33F966D94}" { + m_BuyPayment { + ADM_PaymentMethodCurrency "{618C86A55444252F}" { m_Quantity 15 } } @@ -87,8 +83,8 @@ GenericEntity : "{46F077BDA1AF95B2}PrefabsEditable/Auto/Props/Industrial/E_Barre m_Merchandise ADM_MerchandiseItem "{5F02B81DCB6C5BB5}" { m_sPrefab "{764124BAA469BEC8}Prefabs/Props/Military/Sandbags/Sandbag_01_round_burlap_OTF.et" } - m_RequiredPayment { - ADM_PaymentMethodCurrency "{5F02B81DD6FC1E2B}" { + m_BuyPayment { + ADM_PaymentMethodCurrency "{618C86A55FE308D5}" { m_Quantity 150 } } @@ -97,8 +93,8 @@ GenericEntity : "{46F077BDA1AF95B2}PrefabsEditable/Auto/Props/Industrial/E_Barre m_Merchandise ADM_MerchandiseItem "{5F02C18D9B3D3EC8}" { m_sPrefab "{5749FA9F11F8E736}Prefabs/Props/Military/Sandbags/Sandbag_01_round_high_burlap_OTF.et" } - m_RequiredPayment { - ADM_PaymentMethodCurrency "{5F02C18DA65260D1}" { + m_BuyPayment { + ADM_PaymentMethodCurrency "{618C86A564A3ACF6}" { m_Quantity 300 } } @@ -107,8 +103,8 @@ GenericEntity : "{46F077BDA1AF95B2}PrefabsEditable/Auto/Props/Industrial/E_Barre m_Merchandise ADM_MerchandiseItem "{5F02C18DB5ACCD29}" { m_sPrefab "{3C652B98CB965DD1}Prefabs/Props/Military/Sandbags/Sandbag_01_short_burlap_OTF.et" } - m_RequiredPayment { - ADM_PaymentMethodCurrency "{5F02C18DB3FC5B15}" { + m_BuyPayment { + ADM_PaymentMethodCurrency "{618C86A56FC1D8E4}" { m_Quantity 100 } } @@ -117,8 +113,8 @@ GenericEntity : "{46F077BDA1AF95B2}PrefabsEditable/Auto/Props/Industrial/E_Barre m_Merchandise ADM_MerchandiseItem "{5F02C18DC2F0005E}" { m_sPrefab "{76EAFE0AC39BD0D0}Prefabs/Props/Military/Sandbags/Sandbag_01_short_high_burlap_OTF.et" } - m_RequiredPayment { - ADM_PaymentMethodCurrency "{5F02C18DC93A4061}" { + m_BuyPayment { + ADM_PaymentMethodCurrency "{618C86A574B615E7}" { m_Quantity 200 } } @@ -127,8 +123,8 @@ GenericEntity : "{46F077BDA1AF95B2}PrefabsEditable/Auto/Props/Industrial/E_Barre m_Merchandise ADM_MerchandiseItem "{5F02C18DD8696412}" { m_sPrefab "{12031AAFA5ABAE90}Prefabs/Props/Military/Sandbags/Sandbag_01_wall_burlap_OTF.et" } - m_RequiredPayment { - ADM_PaymentMethodCurrency "{5F02C18DE5213E8A}" { + m_BuyPayment { + ADM_PaymentMethodCurrency "{618C86A57C0DA000}" { m_Quantity 600 } } @@ -137,8 +133,8 @@ GenericEntity : "{46F077BDA1AF95B2}PrefabsEditable/Auto/Props/Industrial/E_Barre m_Merchandise ADM_MerchandiseItem "{5F02C18DEFA2FE95}" { m_sPrefab "{B002BB8542E3AF4B}Prefabs/Props/Military/Sandbags/Sandbag_01_wall_solid_burlap_OTF.et" } - m_RequiredPayment { - ADM_PaymentMethodCurrency "{5F02C18DEACFDB3F}" { + m_BuyPayment { + ADM_PaymentMethodCurrency "{618C86A484B05891}" { m_Quantity 600 } } @@ -147,8 +143,8 @@ GenericEntity : "{46F077BDA1AF95B2}PrefabsEditable/Auto/Props/Industrial/E_Barre m_Merchandise ADM_MerchandiseItem "{5F02C18DFEB1933A}" { m_sPrefab "{CFF68BE998CE1DAA}Prefabs/Props/Military/Sandbags/Sandbag_01_end_burlap_OTF.et" } - m_RequiredPayment { - ADM_PaymentMethodCurrency "{5F02C18D053BEE5B}" { + m_BuyPayment { + ADM_PaymentMethodCurrency "{618C86A48CAC9CD9}" { m_Quantity 75 } } @@ -157,8 +153,8 @@ GenericEntity : "{46F077BDA1AF95B2}PrefabsEditable/Auto/Props/Industrial/E_Barre m_Merchandise ADM_MerchandiseItem "{5F02C18D020BED79}" { m_sPrefab "{E0D033BD39DC9A8A}Prefabs/Props/Military/Sandbags/Sandbag_01_end_high_burlap_OTF.et" } - m_RequiredPayment { - ADM_PaymentMethodCurrency "{5F02C18D0FC724ED}" { + m_BuyPayment { + ADM_PaymentMethodCurrency "{618C86A495EF8F90}" { m_Quantity 150 } } @@ -167,8 +163,8 @@ GenericEntity : "{46F077BDA1AF95B2}PrefabsEditable/Auto/Props/Industrial/E_Barre m_Merchandise ADM_MerchandiseItem "{5F02C18D1338C5F0}" { m_sPrefab "{10FA5620AC3DE19E}Prefabs/Props/Military/Sandbags/Sandbag_01_long_burlap_OTF.et" } - m_RequiredPayment { - ADM_PaymentMethodCurrency "{5F02C18D1C7137C5}" { + m_BuyPayment { + ADM_PaymentMethodCurrency "{618C86A492248FEE}" { m_Quantity 200 } } @@ -177,8 +173,8 @@ GenericEntity : "{46F077BDA1AF95B2}PrefabsEditable/Auto/Props/Industrial/E_Barre m_Merchandise ADM_MerchandiseItem "{5F02C18D25D11EB9}" { m_sPrefab "{06697B47F099B5E2}Prefabs/Props/Military/Sandbags/Sandbag_01_long_high_burlap_OTF.et" } - m_RequiredPayment { - ADM_PaymentMethodCurrency "{5F02C18D217E98DE}" { + m_BuyPayment { + ADM_PaymentMethodCurrency "{618C86A4A57FC013}" { m_Quantity 400 } } @@ -187,8 +183,8 @@ GenericEntity : "{46F077BDA1AF95B2}PrefabsEditable/Auto/Props/Industrial/E_Barre m_Merchandise ADM_MerchandiseItem "{5F0ABB10B6FC94C7}" { m_sPrefab "{A7AF84C6C58BA3E8}Prefabs/Weapons/MachineGuns/RPK74/MG_RPK74.et" } - m_RequiredPayment { - ADM_PaymentMethodCurrency "{5F0ABB10BB3AFFC3}" { + m_BuyPayment { + ADM_PaymentMethodCurrency "{618C86A4AE96FC9A}" { m_Quantity 350 } } @@ -197,8 +193,8 @@ GenericEntity : "{46F077BDA1AF95B2}PrefabsEditable/Auto/Props/Industrial/E_Barre m_Merchandise ADM_MerchandiseItem "{5F0ABB10CDA1C47D}" { m_sPrefab "{7A82FE978603F137}Prefabs/Weapons/Launchers/RPG7/Launcher_RPG7.et" } - m_RequiredPayment { - ADM_PaymentMethodCurrency "{5F0ABB10D7318A2F}" { + m_BuyPayment { + ADM_PaymentMethodCurrency "{618C86A4B7B698D3}" { m_Quantity 400 } } @@ -207,8 +203,8 @@ GenericEntity : "{46F077BDA1AF95B2}PrefabsEditable/Auto/Props/Industrial/E_Barre m_Merchandise ADM_MerchandiseItem "{5F0ABB10D8561F5C}" { m_sPrefab "{32E12D322E107F1C}Prefabs/Weapons/Ammo/Ammo_Rocket_PG7VM.et" } - m_RequiredPayment { - ADM_PaymentMethodCurrency "{5F0ABB10F58EB1AD}" { + m_BuyPayment { + ADM_PaymentMethodCurrency "{618C86A4C5145FC6}" { m_Quantity 200 } } @@ -217,8 +213,8 @@ GenericEntity : "{46F077BDA1AF95B2}PrefabsEditable/Auto/Props/Industrial/E_Barre m_Merchandise ADM_MerchandiseItem "{5F0ABB101D8E1418}" { m_sPrefab "{D78C667F59829717}Prefabs/Weapons/Magazines/Magazine_545x39_RPK_45rnd_4Ball_1Tracer.et" } - m_RequiredPayment { - ADM_PaymentMethodCurrency "{5F0ABB1038A80641}" { + m_BuyPayment { + ADM_PaymentMethodCurrency "{618C86A4D4630B16}" { m_Quantity 15 } } @@ -227,8 +223,8 @@ GenericEntity : "{46F077BDA1AF95B2}PrefabsEditable/Auto/Props/Industrial/E_Barre m_Merchandise ADM_MerchandiseItem "{5F0ABB1042935F0A}" { m_sPrefab "{BC74DAC891D48540}Prefabs/Weapons/Magazines/Magazine_545x39_RPK_45rnd_Ball.et" } - m_RequiredPayment { - ADM_PaymentMethodCurrency "{5F0ABB1054F18FBE}" { + m_BuyPayment { + ADM_PaymentMethodCurrency "{618C86A4D2A75101}" { m_Quantity 15 } } @@ -237,8 +233,8 @@ GenericEntity : "{46F077BDA1AF95B2}PrefabsEditable/Auto/Props/Industrial/E_Barre m_Merchandise ADM_MerchandiseItem "{5F0ABB105CC62910}" { m_sPrefab "{5897D01F41DB5D2D}Prefabs/Weapons/Magazines/Magazine_545x39_RPK_45rnd_Tracer.et" } - m_RequiredPayment { - ADM_PaymentMethodCurrency "{5F0ABB1064873D57}" { + m_BuyPayment { + ADM_PaymentMethodCurrency "{618C86A4D9F95EEA}" { m_Quantity 15 } } @@ -247,8 +243,8 @@ GenericEntity : "{46F077BDA1AF95B2}PrefabsEditable/Auto/Props/Industrial/E_Barre m_Merchandise ADM_MerchandiseItem "{5F0ABB29010C2C49}" { m_sPrefab "{41A9C55B61F375F0}Prefabs/Items/Equipment/Backpacks/Backpack_Kolobok.et" } - m_RequiredPayment { - ADM_PaymentMethodCurrency "{5F0ABB290CDC188B}" { + m_BuyPayment { + ADM_PaymentMethodCurrency "{618C86A4E2571286}" { m_Quantity 10 } } @@ -368,14 +364,6 @@ GenericEntity : "{46F077BDA1AF95B2}PrefabsEditable/Auto/Props/Industrial/E_Barre "main" } } - GRAD_CheckBalanceUserAction "{5F0C7C86A3C12EA5}" { - ParentContextList { - "main" - } - UIInfo UIInfo "{5F0C7C86AE8C4096}" { - Name "Check Balance" - } - } } } } diff --git a/Scripts/Game/Components/GRAD_ItemPlacementComponent.c b/Scripts/Game/Components/GRAD_ItemPlacementComponent.c index 80fb364..a3b657b 100644 --- a/Scripts/Game/Components/GRAD_ItemPlacementComponent.c +++ b/Scripts/Game/Components/GRAD_ItemPlacementComponent.c @@ -1,203 +1,207 @@ -//------------------------------------------------------------------------------------------------ -modded class SCR_ItemPlacementComponent : ScriptComponent -{ - // This modification bypasses the placing animation and adds item rotation in preview - - float m_fPlacementRotation = 0; - GRAD_PlacementOverrideComponent m_PlacementOverrideComponent; - bool m_bPlacementOverrideEnabled = false; - IEntity weaponEntity; - - //------------------------------------------------------------------------------------------------ - override protected void StartPlaceItem() - { - if (!m_bCanPlace) - return; - - IEntity controlledEntity = GetGame().GetPlayerController().GetControlledEntity(); - if (!controlledEntity) - return; - - ChimeraCharacter character = ChimeraCharacter.Cast(controlledEntity); - if (!character) - return; - - CharacterControllerComponent characterController = character.GetCharacterController(); - if (!characterController) - return; - - characterController.SetDisableWeaponControls(true); - characterController.SetDisableMovementControls(true); - - if (characterController.IsUsingItem()) - return; - - vector mat[4]; - Math3D.MatrixCopy(m_vCurrentMat, mat); - PointInfo ptWS = new PointInfo(); - mat[2] = (mat[3] - character.GetOrigin()).Normalized(); - mat[1] = vector.Up; - mat[0] = Vector(mat[2][2], mat[2][1], -mat[2][0]); - ptWS.Set(null, "", mat); - - /* ======================================== */ - // modded: disable placing animation - /* - if (m_bPlacementOverrideEnabled) - { - ItemUseParameters animParams; // added by mod - OnPlacingEnded(m_EquippedItem, true, animParams); // added by mod - DisablePreview(); - } - else - { - CharacterAnimationComponent animationComponent = character.GetAnimationComponent(); - int itemActionId = animationComponent.BindCommand("CMD_Item_Action"); - if (characterController.TryUseItemOverrideParams(m_EquippedItem, false, false, itemActionId, 1, 0, 15.0, 1, 0.0, false, ptWS)) - { - characterController.m_OnItemUseEndedInvoker.Insert(OnPlacingEnded); - DisablePreview(); - } - } - */ - /* ======================================== */ - - characterController.GetAnimationComponent().GetCommandHandler().AlignNewTurns(); - - OrientToNormal(m_vCurrentMat[1]); - } - - //------------------------------------------------------------------------------------------------ - override void UseXYZPlacement(IEntity owner, float maxPlacementDistance, vector cameraMat[4]) - { - // Trace against terrain and entities to detect item placement position - TraceParam param = new TraceParam(); - param.Start = cameraMat[3]; - param.End = param.Start + cameraMat[2] * maxPlacementDistance; - param.Flags = TraceFlags.WORLD | TraceFlags.ENTS; - param.Exclude = SCR_PlayerController.GetLocalControlledEntity(); - param.LayerMask = EPhysicsLayerPresets.Projectile; - BaseWorld world = owner.GetWorld(); - float traceDistance = world.TraceMove(param, ExcludeWaterCallback); - m_PreviewEntity.GetTransform(m_vCurrentMat); - m_vCurrentMat[3] = param.Start + ((param.End - param.Start) * traceDistance); - vector up = param.TraceNorm; - - IEntity tracedEntity = param.TraceEnt; - - if (traceDistance == 1) // Assume we didn't hit anything and snap item on the ground - { - // Trace against terrain and entities to detect new placement position - TraceParam paramGround = new TraceParam(); - paramGround.Start = param.End + vector.Up; - paramGround.End = paramGround.Start - vector.Up * 20; - paramGround.Flags = TraceFlags.WORLD | TraceFlags.ENTS; - paramGround.Exclude = SCR_PlayerController.GetLocalControlledEntity(); - paramGround.LayerMask = EPhysicsLayerPresets.Projectile; - float traceGroundDistance = world.TraceMove(paramGround, ExcludeWaterCallback); - m_PreviewEntity.GetTransform(m_vCurrentMat); - m_vCurrentMat[3] = paramGround.Start + ((paramGround.End - paramGround.Start) * traceGroundDistance) + vector.Up * 0.01; // adding 1 cm to avoid collision with object under - - if (traceGroundDistance < 1) - up = paramGround.TraceNorm; - - tracedEntity = paramGround.TraceEnt; - } - - OrientToNormal(up); - - m_PreviewEntity.SetTransform(m_vCurrentMat); - - /* ======================================== */ - // modded: adding rotation to the preview - if (m_bPlacementOverrideEnabled) - { - vector angles = m_PreviewEntity.GetAngles(); - angles[1] = angles[1] + m_fPlacementRotation; - m_PreviewEntity.SetAngles(angles); - m_PreviewEntity.GetTransform(m_vCurrentMat); - } - /* ======================================== */ - - m_PreviewEntity.Update(); - - IEntity character = SCR_PlayerController.GetLocalControlledEntity(); - vector characterOrigin = character.GetOrigin(); - - if (Math.AbsFloat(m_vCurrentMat[3][1] - characterOrigin[1] > 0.4)) // Reject based on vertical distance from character - { - m_bCanPlace = false; - return; - } - - if (vector.Distance(m_vCurrentMat[3], characterOrigin) > maxPlacementDistance) // Reject based on distance from character (the maximum should be dictated by item settings) - { - m_bCanPlace = false; - return; - } - - m_bCanPlace = ValidatePlacement(up, tracedEntity, world, SCR_PlayerController.GetLocalControlledEntity()); - } - - - //------------------------------------------------------------------------------------------------ - override protected void DisablePreview() - { - InputManager inputManager = GetGame().GetInputManager(); - if (!inputManager) - return; - - if (m_bPlacementOverrideEnabled) - { - weaponEntity.SetFlags(weaponEntity.GetFlags() | EntityFlags.VISIBLE); - - inputManager.ActivateContext("RotatePreviewContext", 0); - inputManager.RemoveActionListener("RotateLeft", EActionTrigger.DOWN, RotateLeft); - inputManager.RemoveActionListener("RotateRight", EActionTrigger.DOWN, RotateRight); - } - - super.DisablePreview(); - } - - //------------------------------------------------------------------------------------------------ - override protected void EnablePreview(IEntity weapon) - { - m_PlacementOverrideComponent = GRAD_PlacementOverrideComponent.Cast(weapon.FindComponent(GRAD_PlacementOverrideComponent)); - - weaponEntity = weapon; - - if (m_PlacementOverrideComponent) - { - m_bPlacementOverrideEnabled = m_PlacementOverrideComponent.GetOverrideVanillaPlacement(); - } - - if (m_bPlacementOverrideEnabled) - { - weaponEntity.ClearFlags(EntityFlags.VISIBLE); - - //weaponEntity.SetScale(0.1); // doesn't work; perhaps because weapon is contineously transformed - - InputManager inputManager = GetGame().GetInputManager(); - if (!inputManager) - return; - - inputManager.AddActionListener("RotateLeft", EActionTrigger.DOWN, RotateLeft); - inputManager.AddActionListener("RotateRight", EActionTrigger.DOWN, RotateRight); - inputManager.ActivateContext("RotatePreviewContext", 3600000); - } - - super.EnablePreview(weapon); - } - - //------------------------------------------------------------------------------------------------ - protected void RotateLeft() - { - m_fPlacementRotation += 5; - } - - //------------------------------------------------------------------------------------------------ - protected void RotateRight() - { - m_fPlacementRotation -= 5; - } -}; +//------------------------------------------------------------------------------------------------ +modded class SCR_ItemPlacementComponent : ScriptComponent +{ + // This modification bypasses the placing animation and adds item rotation in preview + + float m_fPlacementRotation = 0; + GRAD_PlacementOverrideComponent m_PlacementOverrideComponent; + bool m_bPlacementOverrideEnabled = false; + IEntity weaponEntity; + + //------------------------------------------------------------------------------------------------ + override protected void StartPlaceItem() + { + if (!m_bCanPlace) + return; + + IEntity controlledEntity = GetGame().GetPlayerController().GetControlledEntity(); + if (!controlledEntity) + return; + + SCR_CharacterControllerComponent characterController = GetCharacterController(controlledEntity); + if (!characterController) + return; + + characterController.SetDisableWeaponControls(true); + characterController.SetDisableMovementControls(true); + + if (characterController.IsUsingItem()) + return; + + ChimeraCharacter character = ChimeraCharacter.Cast(controlledEntity); + CharacterAnimationComponent animationComponent = character.GetAnimationComponent(); + int itemActionId = animationComponent.BindCommand("CMD_Item_Action"); + vector mat[4]; + Math3D.MatrixCopy(m_vCurrentMat, mat); + PointInfo ptWS = new PointInfo(); + mat[2] = (mat[3] - character.GetOrigin()).Normalized(); + mat[1] = vector.Up; + mat[0] = Vector(mat[2][2], mat[2][1], -mat[2][0]); + ptWS.Set(null, "", mat); + + ItemUseParameters params = new ItemUseParameters(); + params.SetEntity(m_EquippedItem); + params.SetAllowMovementDuringAction(false); + params.SetKeepInHandAfterSuccess(false); + params.SetCommandID(itemActionId); + params.SetCommandIntArg(1); + params.SetMaxAnimLength(15.0); + params.SetAlignmentPoint(ptWS); + + /* ======================================== */ + // modded: disable placing animation + if (m_bPlacementOverrideEnabled) + { + ItemUseParameters animParams; // added by mod + OnPlacingEnded(m_EquippedItem, true, animParams); // added by mod + DisablePreview(); + } + else + { + if (characterController.TryUseItemOverrideParams(params)) + { + characterController.m_OnItemUseEndedInvoker.Insert(OnPlacingEnded); + DisablePreview(); + } + } + /* ======================================== */ + + characterController.GetAnimationComponent().GetCommandHandler().AlignNewTurns(); + + OrientToNormal(m_vCurrentMat[1]); + } + + //------------------------------------------------------------------------------------------------ + override void UseXYZPlacement(IEntity owner, float maxPlacementDistance, vector cameraMat[4]) + { + // Trace against terrain and entities to detect item placement position + TraceParam param = new TraceParam(); + param.Start = cameraMat[3]; + param.End = param.Start + cameraMat[2] * maxPlacementDistance; + param.Flags = TraceFlags.WORLD | TraceFlags.ENTS; + param.Exclude = SCR_PlayerController.GetLocalControlledEntity(); + param.LayerMask = EPhysicsLayerPresets.Projectile; + BaseWorld world = owner.GetWorld(); + float traceDistance = world.TraceMove(param, ExcludeWaterCallback); + m_PreviewEntity.GetTransform(m_vCurrentMat); + m_vCurrentMat[3] = param.Start + ((param.End - param.Start) * traceDistance); + vector up = param.TraceNorm; + + IEntity tracedEntity = param.TraceEnt; + + if (traceDistance == 1) // Assume we didn't hit anything and snap item on the ground + { + // Trace against terrain and entities to detect new placement position + TraceParam paramGround = new TraceParam(); + paramGround.Start = param.End + vector.Up; + paramGround.End = paramGround.Start - vector.Up * 20; + paramGround.Flags = TraceFlags.WORLD | TraceFlags.ENTS; + paramGround.Exclude = SCR_PlayerController.GetLocalControlledEntity(); + paramGround.LayerMask = EPhysicsLayerPresets.Projectile; + float traceGroundDistance = world.TraceMove(paramGround, ExcludeWaterCallback); + m_PreviewEntity.GetTransform(m_vCurrentMat); + m_vCurrentMat[3] = paramGround.Start + ((paramGround.End - paramGround.Start) * traceGroundDistance) + vector.Up * 0.01; // adding 1 cm to avoid collision with object under + + if (traceGroundDistance < 1) + up = paramGround.TraceNorm; + + tracedEntity = paramGround.TraceEnt; + } + + OrientToNormal(up); + + m_PreviewEntity.SetTransform(m_vCurrentMat); + + /* ======================================== */ + // modded: adding rotation to the preview + if (m_bPlacementOverrideEnabled) + { + vector angles = m_PreviewEntity.GetAngles(); + angles[1] = angles[1] + m_fPlacementRotation; + m_PreviewEntity.SetAngles(angles); + m_PreviewEntity.GetTransform(m_vCurrentMat); + } + /* ======================================== */ + + m_PreviewEntity.Update(); + + IEntity character = SCR_PlayerController.GetLocalControlledEntity(); + vector characterOrigin = character.GetOrigin(); + + if (Math.AbsFloat(m_vCurrentMat[3][1] - characterOrigin[1] > 0.4)) // Reject based on vertical distance from character + { + m_bCanPlace = false; + return; + } + + if (vector.Distance(m_vCurrentMat[3], characterOrigin) > maxPlacementDistance) // Reject based on distance from character (the maximum should be dictated by item settings) + { + m_bCanPlace = false; + return; + } + + m_bCanPlace = ValidatePlacement(up, tracedEntity, world, SCR_PlayerController.GetLocalControlledEntity()); + } + + + //------------------------------------------------------------------------------------------------ + override protected void DisablePreview() + { + InputManager inputManager = GetGame().GetInputManager(); + if (!inputManager) + return; + + if (m_bPlacementOverrideEnabled) + { + weaponEntity.SetFlags(weaponEntity.GetFlags() | EntityFlags.VISIBLE); + + inputManager.ActivateContext("RotatePreviewContext", 0); + inputManager.RemoveActionListener("RotateLeft", EActionTrigger.DOWN, RotateLeft); + inputManager.RemoveActionListener("RotateRight", EActionTrigger.DOWN, RotateRight); + } + + super.DisablePreview(); + } + + //------------------------------------------------------------------------------------------------ + override protected void EnablePreview(IEntity weapon) + { + m_PlacementOverrideComponent = GRAD_PlacementOverrideComponent.Cast(weapon.FindComponent(GRAD_PlacementOverrideComponent)); + + weaponEntity = weapon; + + if (m_PlacementOverrideComponent) + { + m_bPlacementOverrideEnabled = m_PlacementOverrideComponent.GetOverrideVanillaPlacement(); + } + + if (m_bPlacementOverrideEnabled) + { + weaponEntity.ClearFlags(EntityFlags.VISIBLE); + + //weaponEntity.SetScale(0.1); // doesn't work; perhaps because weapon is contineously transformed + + InputManager inputManager = GetGame().GetInputManager(); + if (!inputManager) + return; + + inputManager.AddActionListener("RotateLeft", EActionTrigger.DOWN, RotateLeft); + inputManager.AddActionListener("RotateRight", EActionTrigger.DOWN, RotateRight); + inputManager.ActivateContext("RotatePreviewContext", 3600000); + } + + super.EnablePreview(weapon); + } + + //------------------------------------------------------------------------------------------------ + protected void RotateLeft() + { + m_fPlacementRotation += 5; + } + + //------------------------------------------------------------------------------------------------ + protected void RotateRight() + { + m_fPlacementRotation -= 5; + } +}; diff --git a/Scripts/Game/Player/GRAD_PlayerController.c b/Scripts/Game/Player/GRAD_PlayerController.c index dc1c59b..9d5c375 100644 --- a/Scripts/Game/Player/GRAD_PlayerController.c +++ b/Scripts/Game/Player/GRAD_PlayerController.c @@ -1,449 +1,451 @@ -//------------------------------------------------------------------------------------------------ -modded class SCR_PlayerController : PlayerController -{ - [Attribute(defvalue: "{257513225CC1D5FB}UI/OTF/OTF_Overlay.layout")] - protected ResourceName m_sOverlay; - - [Attribute(defvalue: "{B764E0A789AF2F5F}UI/OTF/OTF_CountdownTimer.layout")] - protected ResourceName m_sCountdownTimer; - - protected ref Widget m_wOverlayDisplay; - protected ref Widget m_wCountdownDisplay; - protected ref Widget m_wTimerDisplay; - - protected bool m_bCoutdownRunning = false; - protected bool m_bTimerRunning = false; - - protected int m_iCountdownDuration = 0; - protected int m_iTimerDuration = 0; - - protected ref GRAD_MapMarkerUI m_MapMarkerUI; - - //------------------------------------------------------------------------------------------------ - override void EOnInit(IEntity owner) - { - InitMapMarkerUI(); - } - - //------------------------------------------------------------------------------------------------ - void InitMapMarkerUI() - { - if (!m_MapMarkerUI) - { - m_MapMarkerUI = new GRAD_MapMarkerUI(); - m_MapMarkerUI.Init(); - } - } - - //------------------------------------------------------------------------------------------------ - void DeleteFortificationsFromInventory() - { - Rpc(RpcDo_Owner_DeleteFortificationsFromInventory); - } - - //------------------------------------------------------------------------------------------------ - [RplRpc(RplChannel.Reliable, RplRcver.Owner)] - protected void RpcDo_Owner_DeleteFortificationsFromInventory() - { - // executed locally on players PS_VirtualMachine - - IEntity entity = GetControlledEntity(); - - SCR_InventoryStorageManagerComponent inventoryStorageManager = SCR_InventoryStorageManagerComponent.Cast(entity.FindComponent(SCR_InventoryStorageManagerComponent)); - - array items = {}; - inventoryStorageManager.GetItems(items); - - int count = 0; - foreach(IEntity item : items) - { - // fortification items are identified by having the placementOverrideComponent - // strictly this would also be true for the barrel and for the traffic cone - GRAD_PlacementOverrideComponent placementOverrideComponent = GRAD_PlacementOverrideComponent.Cast(item.FindComponent(GRAD_PlacementOverrideComponent)); - if (placementOverrideComponent) - { - delete item; - count++; - } - } - - Print(string.Format("OTF - %1 fortification items deleted from inventory", count), LogLevel.NORMAL); - } - - //------------------------------------------------------------------------------------------------ - void InsertMarker(SCR_MapMarkerBase marker) - { - Rpc(RpcDo_Owner_InsertMarker, marker); - } - - //------------------------------------------------------------------------------------------------ - [RplRpc(RplChannel.Reliable, RplRcver.Owner)] - protected void RpcDo_Owner_InsertMarker(SCR_MapMarkerBase marker) - { - // executed locally on players PS_VirtualMachine - - SetMarker(marker); - } - - //------------------------------------------------------------------------------------------------ - protected void SetMarker(SCR_MapMarkerBase marker) - { - SCR_MapMarkerManagerComponent mapMarkerManager = SCR_MapMarkerManagerComponent.Cast(GetGame().GetGameMode().FindComponent(SCR_MapMarkerManagerComponent)); - - SCR_MapMarkerBase newMarker = new SCR_MapMarkerBase(); - newMarker.SetType(marker.GetType()); - int worldPos[2]; - marker.GetWorldPos(worldPos); - newMarker.SetWorldPos(worldPos[0], worldPos[1]); - newMarker.SetMarkerConfigID(marker.GetMarkerConfigID()); - newMarker.SetCustomText(marker.GetCustomText()); - newMarker.SetColorEntry(marker.GetColorEntry()); - newMarker.SetIconEntry(marker.GetIconEntry()); - - mapMarkerManager.InsertStaticMarker(newMarker, true, true); - } - - //------------------------------------------------------------------------------------------------ - void ToggleMap(bool open) - { - SCR_PlayerController pc = SCR_PlayerController.Cast(GetGame().GetPlayerController()); - if (!pc) return; - - SCR_ChimeraCharacter ch = SCR_ChimeraCharacter.Cast(pc.GetControlledEntity()); - if (!ch) return; - - SCR_GadgetManagerComponent gadgetManager = SCR_GadgetManagerComponent.Cast(ch.FindComponent(SCR_GadgetManagerComponent)); - if (!gadgetManager) return; - - if (!gadgetManager.GetGadgetByType(EGadgetType.MAP)) return; - - IEntity mapEntity = gadgetManager.GetGadgetByType(EGadgetType.MAP); - - if (open) - gadgetManager.SetGadgetMode(mapEntity, EGadgetMode.IN_HAND, true); - else - gadgetManager.SetGadgetMode(mapEntity, EGadgetMode.IN_SLOT, false); - } - - //------------------------------------------------------------------------------------------------ - void AddCircleMarker(float startX, float startY, float endX, float endY) - { - Rpc(RpcDo_Owner_AddCircleMarker, startX, startY, endX, endY); - } - - //------------------------------------------------------------------------------------------------ - [RplRpc(RplChannel.Reliable, RplRcver.Owner)] - protected void RpcDo_Owner_AddCircleMarker(float startX, float startY, float endX, float endY) - { - m_MapMarkerUI.AddCircle(startX, startY, endX, endY); - } - - //------------------------------------------------------------------------------------------------ - void ShowHint(string message, string title, int duration, bool isSilent) - { - Rpc(RpcDo_Owner_ShowHint, message, title, duration, isSilent); - } - - //------------------------------------------------------------------------------------------------ - [RplRpc(RplChannel.Reliable, RplRcver.Owner)] - protected void RpcDo_Owner_ShowHint(string message, string title, int duration, bool isSilent) - { - // executed locally on players machine - - SCR_HintManagerComponent.GetInstance().ShowCustomHint(message, title, duration, isSilent); - } - - //------------------------------------------------------------------------------------------------ - void ShowOverlay(string message, int duration) - { - Rpc(RpcDo_Owner_ShowOverlay, message, duration); - } - - //------------------------------------------------------------------------------------------------ - [RplRpc(RplChannel.Reliable, RplRcver.Owner)] - protected void RpcDo_Owner_ShowOverlay(string message, int duration) - { - // executed locally on players machine - - // Disable countdown/timer if new overlay will be displayed - m_bCoutdownRunning = false; - m_bTimerRunning = false; - - // Remove previously displays - RemoveOverlay(); - RemoveCountdown(); - RemoveTimer(); - - m_wOverlayDisplay = GetGame().GetWorkspace().CreateWidgets(m_sOverlay); - - TextWidget textWidget = TextWidget.Cast(m_wOverlayDisplay.FindAnyWidget("Text0")); - - if (textWidget) - textWidget.SetText(message); - - SCR_UISoundEntity.SoundEvent(SCR_SoundEvent.TASK_CREATED); - - GetGame().GetCallqueue().CallLater(RemoveOverlay, duration * 1000, false); // x sec later - } - - //------------------------------------------------------------------------------------------------ - protected void RemoveOverlay() - { - if (m_wOverlayDisplay) - { - delete m_wOverlayDisplay; - } - } - - //------------------------------------------------------------------------------------------------ - void ShowCountdown(int duration) - { - Rpc(RpcDo_Owner_ShowCountdown, duration); - } - - //------------------------------------------------------------------------------------------------ - [RplRpc(RplChannel.Reliable, RplRcver.Owner)] - protected void RpcDo_Owner_ShowCountdown(int duration) - { - // executed locally on players machine - - // Disable countdown/timer if new overlay will be displayed - m_bCoutdownRunning = false; - m_bTimerRunning = false; - - // Remove previously displays - RemoveOverlay(); - RemoveCountdown(); - RemoveTimer(); - - m_wCountdownDisplay = GetGame().GetWorkspace().CreateWidgets(m_sCountdownTimer); - - m_bCoutdownRunning = true; - - m_iCountdownDuration = duration; - - UpdateCountdown(); - - // kill every previously running process - GetGame().GetCallqueue().Remove(UpdateCountdown); - GetGame().GetCallqueue().Remove(UpdateTimer); - - GetGame().GetCallqueue().CallLater(UpdateCountdown, 1000, true); // every second - } - - //------------------------------------------------------------------------------------------------ - protected void UpdateCountdown() - { - if (!m_bCoutdownRunning) - { - GetGame().GetCallqueue().Remove(UpdateCountdown); - return; - } - - int minutes = m_iCountdownDuration / 60; - int seconds = m_iCountdownDuration - (minutes * 60); - - string minutesStr; - string secondsStr; - - if (minutes < 10) - minutesStr = string.Format("0%1", minutes); - else - minutesStr = string.Format("%1", minutes); - - if (seconds < 10) - secondsStr = string.Format("0%1", seconds); - else - secondsStr = string.Format("%1", seconds); - - if (!m_wCountdownDisplay) - return; - - TextWidget textWidget = TextWidget.Cast(m_wCountdownDisplay.FindAnyWidget("Text0")); - - if (textWidget) - textWidget.SetText(string.Format("%1:%2", minutesStr, secondsStr)); - - if (m_iCountdownDuration == 0) - { - GetGame().GetCallqueue().Remove(UpdateCountdown); - - m_bCoutdownRunning = false; - - if (textWidget) - { - textWidget.SetColor(new Color(1.0, 0.0, 0.0, 1.0)); - SCR_UISoundEntity.SoundEvent(SCR_SoundEvent.SOUND_SIREN); - } - } - else - m_iCountdownDuration--; - } - - //------------------------------------------------------------------------------------------------ - protected void RemoveCountdown() - { - if (m_wCountdownDisplay) - { - delete m_wCountdownDisplay; - } - } - - //------------------------------------------------------------------------------------------------ - void ShowTimer() - { - Rpc(RpcDo_Owner_ShowTimer); - } - - //------------------------------------------------------------------------------------------------ - [RplRpc(RplChannel.Reliable, RplRcver.Owner)] - protected void RpcDo_Owner_ShowTimer() - { - // executed locally on players machine - - // Disable countdown/timer if new overlay will be displayed - m_bCoutdownRunning = false; - m_bTimerRunning = false; - - // Remove previously displays - RemoveOverlay(); - RemoveCountdown(); - RemoveTimer(); - - m_wTimerDisplay = GetGame().GetWorkspace().CreateWidgets(m_sCountdownTimer); - - m_bTimerRunning = true; - - m_iTimerDuration = 0; - - UpdateTimer(); - - // kill every previously running process - GetGame().GetCallqueue().Remove(UpdateTimer); - GetGame().GetCallqueue().Remove(UpdateCountdown); - - GetGame().GetCallqueue().CallLater(UpdateTimer, 1000, true); // every second - } - - //------------------------------------------------------------------------------------------------ - protected void UpdateTimer() - { - if (!m_bTimerRunning) - { - GetGame().GetCallqueue().Remove(UpdateTimer); - return; - } - - int minutes = m_iTimerDuration / 60; - int seconds = m_iTimerDuration - (minutes * 60); - - string minutesStr; - string secondsStr; - - if (minutes < 10) - minutesStr = string.Format("0%1", minutes); - else - minutesStr = string.Format("%1", minutes); - - if (seconds < 10) - secondsStr = string.Format("0%1", seconds); - else - secondsStr = string.Format("%1", seconds); - - if (!m_wTimerDisplay) - return; - - TextWidget textWidget = TextWidget.Cast(m_wTimerDisplay.FindAnyWidget("Text0")); - - if (textWidget) - textWidget.SetText(string.Format("%1:%2", minutesStr, secondsStr)); - - m_iTimerDuration++; - } - - //------------------------------------------------------------------------------------------------ - protected void RemoveTimer() - { - if (m_wTimerDisplay) - { - delete m_wTimerDisplay; - } - } - - //------------------------------------------------------------------------------------------------ - int GetTimerDuration() - { - return m_iTimerDuration; - } - - //------------------------------------------------------------------------------------------------ - void TeleportPlayer(vector pos) - { - Rpc(RpcDo_Owner_TeleportPlayer, pos); - } - - //------------------------------------------------------------------------------------------------ - [RplRpc(RplChannel.Reliable, RplRcver.Owner)] - protected void RpcDo_Owner_TeleportPlayer(vector pos) - { - // executed locally on players machine - - if(SCR_Global.TeleportLocalPlayer(pos, SCR_EPlayerTeleportedReason.DEFAULT)) - Print(string.Format("OTF - Player with ID %1 successfully teleported to position %2 - Deprecated", GetPlayerId(), pos), LogLevel.NORMAL); - else - Print(string.Format("OTF - Player with ID %1 NOT successfully teleported to position %2 - Deprecated", GetPlayerId(), pos), LogLevel.WARNING); - } - - //------------------------------------------------------------------------------------------------ - void TeleportPlayerToMapPos(int playerId, int mapPos[2]) - { - Rpc(Rpc_Do_Owner_TeleportPlayerToMapPos, playerId, mapPos); - } - - //------------------------------------------------------------------------------------------------ - [RplRpc(RplChannel.Reliable, RplRcver.Owner)] - protected void Rpc_Do_Owner_TeleportPlayerToMapPos(int playerId, int mapPos[2]) - { - // executed locally on players machine - - IEntity playerEntity = GetGame().GetPlayerManager().GetPlayerControlledEntity(playerId); - - if (!playerEntity) - { - Print(string.Format("OTF - Player entity missing; skipping teleport"), LogLevel.WARNING); - return; - } - - Print(string.Format("OTF - Player with ID %1 has position %2", playerId, playerEntity.GetOrigin()), LogLevel.NORMAL); - - bool teleportSuccessful = false; - - GRAD_OnTheFlyManager otfManager = GRAD_OnTheFlyManager.GetInstance(); - - vector newWorldPos; - - int teleportAttemptsCounter = 0; - - while (!teleportSuccessful) - { - if (teleportAttemptsCounter >= 5) - { - ShowHint("Teleport not successful. Contact your Game Master for manual teleport.", "On The Fly", 10, false); - Print(string.Format("OTF - Player with ID %1 NOT successfully teleported to position %2", GetPlayerId(), newWorldPos), LogLevel.NORMAL); - break; - } - - mapPos[0] = mapPos[0] + Math.RandomFloat(-30, 30); - mapPos[1] = mapPos[1] + Math.RandomFloat(-30, 30); - - newWorldPos = otfManager.MapPosToWorldPos(mapPos); - - teleportSuccessful = SCR_Global.TeleportLocalPlayer(newWorldPos, SCR_EPlayerTeleportedReason.DEFAULT); - - if (teleportSuccessful) - Print(string.Format("OTF - Player with ID %1 successfully teleported to position %2", GetPlayerId(), newWorldPos), LogLevel.NORMAL); - - teleportAttemptsCounter++; - } - } -}; +//------------------------------------------------------------------------------------------------ +modded class SCR_PlayerController : PlayerController +{ + [Attribute(defvalue: "{257513225CC1D5FB}UI/OTF/OTF_Overlay.layout")] + protected ResourceName m_sOverlay; + + [Attribute(defvalue: "{B764E0A789AF2F5F}UI/OTF/OTF_CountdownTimer.layout")] + protected ResourceName m_sCountdownTimer; + + protected ref Widget m_wOverlayDisplay; + protected ref Widget m_wCountdownDisplay; + protected ref Widget m_wTimerDisplay; + + protected bool m_bCoutdownRunning = false; + protected bool m_bTimerRunning = false; + + protected int m_iCountdownDuration = 0; + protected int m_iTimerDuration = 0; + + protected ref GRAD_MapMarkerUI m_MapMarkerUI; + + //------------------------------------------------------------------------------------------------ + override void EOnInit(IEntity owner) + { + super.EOnInit(owner); + + InitMapMarkerUI(); + } + + //------------------------------------------------------------------------------------------------ + void InitMapMarkerUI() + { + if (!m_MapMarkerUI) + { + m_MapMarkerUI = new GRAD_MapMarkerUI(); + m_MapMarkerUI.Init(); + } + } + + //------------------------------------------------------------------------------------------------ + void DeleteFortificationsFromInventory() + { + Rpc(RpcDo_Owner_DeleteFortificationsFromInventory); + } + + //------------------------------------------------------------------------------------------------ + [RplRpc(RplChannel.Reliable, RplRcver.Owner)] + protected void RpcDo_Owner_DeleteFortificationsFromInventory() + { + // executed locally on players PS_VirtualMachine + + IEntity entity = GetControlledEntity(); + + SCR_InventoryStorageManagerComponent inventoryStorageManager = SCR_InventoryStorageManagerComponent.Cast(entity.FindComponent(SCR_InventoryStorageManagerComponent)); + + array items = {}; + inventoryStorageManager.GetItems(items); + + int count = 0; + foreach(IEntity item : items) + { + // fortification items are identified by having the placementOverrideComponent + // strictly this would also be true for the barrel and for the traffic cone + GRAD_PlacementOverrideComponent placementOverrideComponent = GRAD_PlacementOverrideComponent.Cast(item.FindComponent(GRAD_PlacementOverrideComponent)); + if (placementOverrideComponent) + { + delete item; + count++; + } + } + + Print(string.Format("OTF - %1 fortification items deleted from inventory", count), LogLevel.NORMAL); + } + + //------------------------------------------------------------------------------------------------ + void InsertMarker(SCR_MapMarkerBase marker) + { + Rpc(RpcDo_Owner_InsertMarker, marker); + } + + //------------------------------------------------------------------------------------------------ + [RplRpc(RplChannel.Reliable, RplRcver.Owner)] + protected void RpcDo_Owner_InsertMarker(SCR_MapMarkerBase marker) + { + // executed locally on players PS_VirtualMachine + + SetMarker(marker); + } + + //------------------------------------------------------------------------------------------------ + protected void SetMarker(SCR_MapMarkerBase marker) + { + SCR_MapMarkerManagerComponent mapMarkerManager = SCR_MapMarkerManagerComponent.Cast(GetGame().GetGameMode().FindComponent(SCR_MapMarkerManagerComponent)); + + SCR_MapMarkerBase newMarker = new SCR_MapMarkerBase(); + newMarker.SetType(marker.GetType()); + int worldPos[2]; + marker.GetWorldPos(worldPos); + newMarker.SetWorldPos(worldPos[0], worldPos[1]); + newMarker.SetMarkerConfigID(marker.GetMarkerConfigID()); + newMarker.SetCustomText(marker.GetCustomText()); + newMarker.SetColorEntry(marker.GetColorEntry()); + newMarker.SetIconEntry(marker.GetIconEntry()); + + mapMarkerManager.InsertStaticMarker(newMarker, true); + } + + //------------------------------------------------------------------------------------------------ + void ToggleMap(bool open) + { + SCR_PlayerController pc = SCR_PlayerController.Cast(GetGame().GetPlayerController()); + if (!pc) return; + + SCR_ChimeraCharacter ch = SCR_ChimeraCharacter.Cast(pc.GetControlledEntity()); + if (!ch) return; + + SCR_GadgetManagerComponent gadgetManager = SCR_GadgetManagerComponent.Cast(ch.FindComponent(SCR_GadgetManagerComponent)); + if (!gadgetManager) return; + + if (!gadgetManager.GetGadgetByType(EGadgetType.MAP)) return; + + IEntity mapEntity = gadgetManager.GetGadgetByType(EGadgetType.MAP); + + if (open) + gadgetManager.SetGadgetMode(mapEntity, EGadgetMode.IN_HAND, true); + else + gadgetManager.SetGadgetMode(mapEntity, EGadgetMode.IN_SLOT, false); + } + + //------------------------------------------------------------------------------------------------ + void AddCircleMarker(float startX, float startY, float endX, float endY) + { + Rpc(RpcDo_Owner_AddCircleMarker, startX, startY, endX, endY); + } + + //------------------------------------------------------------------------------------------------ + [RplRpc(RplChannel.Reliable, RplRcver.Owner)] + protected void RpcDo_Owner_AddCircleMarker(float startX, float startY, float endX, float endY) + { + m_MapMarkerUI.AddCircle(startX, startY, endX, endY); + } + + //------------------------------------------------------------------------------------------------ + void ShowHint(string message, string title, int duration, bool isSilent) + { + Rpc(RpcDo_Owner_ShowHint, message, title, duration, isSilent); + } + + //------------------------------------------------------------------------------------------------ + [RplRpc(RplChannel.Reliable, RplRcver.Owner)] + protected void RpcDo_Owner_ShowHint(string message, string title, int duration, bool isSilent) + { + // executed locally on players machine + + SCR_HintManagerComponent.GetInstance().ShowCustomHint(message, title, duration, isSilent); + } + + //------------------------------------------------------------------------------------------------ + void ShowOverlay(string message, int duration) + { + Rpc(RpcDo_Owner_ShowOverlay, message, duration); + } + + //------------------------------------------------------------------------------------------------ + [RplRpc(RplChannel.Reliable, RplRcver.Owner)] + protected void RpcDo_Owner_ShowOverlay(string message, int duration) + { + // executed locally on players machine + + // Disable countdown/timer if new overlay will be displayed + m_bCoutdownRunning = false; + m_bTimerRunning = false; + + // Remove previously displays + RemoveOverlay(); + RemoveCountdown(); + RemoveTimer(); + + m_wOverlayDisplay = GetGame().GetWorkspace().CreateWidgets(m_sOverlay); + + TextWidget textWidget = TextWidget.Cast(m_wOverlayDisplay.FindAnyWidget("Text0")); + + if (textWidget) + textWidget.SetText(message); + + SCR_UISoundEntity.SoundEvent(SCR_SoundEvent.TASK_CREATED); + + GetGame().GetCallqueue().CallLater(RemoveOverlay, duration * 1000, false); // x sec later + } + + //------------------------------------------------------------------------------------------------ + protected void RemoveOverlay() + { + if (m_wOverlayDisplay) + { + delete m_wOverlayDisplay; + } + } + + //------------------------------------------------------------------------------------------------ + void ShowCountdown(int duration) + { + Rpc(RpcDo_Owner_ShowCountdown, duration); + } + + //------------------------------------------------------------------------------------------------ + [RplRpc(RplChannel.Reliable, RplRcver.Owner)] + protected void RpcDo_Owner_ShowCountdown(int duration) + { + // executed locally on players machine + + // Disable countdown/timer if new overlay will be displayed + m_bCoutdownRunning = false; + m_bTimerRunning = false; + + // Remove previously displays + RemoveOverlay(); + RemoveCountdown(); + RemoveTimer(); + + m_wCountdownDisplay = GetGame().GetWorkspace().CreateWidgets(m_sCountdownTimer); + + m_bCoutdownRunning = true; + + m_iCountdownDuration = duration; + + UpdateCountdown(); + + // kill every previously running process + GetGame().GetCallqueue().Remove(UpdateCountdown); + GetGame().GetCallqueue().Remove(UpdateTimer); + + GetGame().GetCallqueue().CallLater(UpdateCountdown, 1000, true); // every second + } + + //------------------------------------------------------------------------------------------------ + protected void UpdateCountdown() + { + if (!m_bCoutdownRunning) + { + GetGame().GetCallqueue().Remove(UpdateCountdown); + return; + } + + int minutes = m_iCountdownDuration / 60; + int seconds = m_iCountdownDuration - (minutes * 60); + + string minutesStr; + string secondsStr; + + if (minutes < 10) + minutesStr = string.Format("0%1", minutes); + else + minutesStr = string.Format("%1", minutes); + + if (seconds < 10) + secondsStr = string.Format("0%1", seconds); + else + secondsStr = string.Format("%1", seconds); + + if (!m_wCountdownDisplay) + return; + + TextWidget textWidget = TextWidget.Cast(m_wCountdownDisplay.FindAnyWidget("Text0")); + + if (textWidget) + textWidget.SetText(string.Format("%1:%2", minutesStr, secondsStr)); + + if (m_iCountdownDuration == 0) + { + GetGame().GetCallqueue().Remove(UpdateCountdown); + + m_bCoutdownRunning = false; + + if (textWidget) + { + textWidget.SetColor(new Color(1.0, 0.0, 0.0, 1.0)); + SCR_UISoundEntity.SoundEvent(SCR_SoundEvent.SOUND_SIREN); + } + } + else + m_iCountdownDuration--; + } + + //------------------------------------------------------------------------------------------------ + protected void RemoveCountdown() + { + if (m_wCountdownDisplay) + { + delete m_wCountdownDisplay; + } + } + + //------------------------------------------------------------------------------------------------ + void ShowTimer() + { + Rpc(RpcDo_Owner_ShowTimer); + } + + //------------------------------------------------------------------------------------------------ + [RplRpc(RplChannel.Reliable, RplRcver.Owner)] + protected void RpcDo_Owner_ShowTimer() + { + // executed locally on players machine + + // Disable countdown/timer if new overlay will be displayed + m_bCoutdownRunning = false; + m_bTimerRunning = false; + + // Remove previously displays + RemoveOverlay(); + RemoveCountdown(); + RemoveTimer(); + + m_wTimerDisplay = GetGame().GetWorkspace().CreateWidgets(m_sCountdownTimer); + + m_bTimerRunning = true; + + m_iTimerDuration = 0; + + UpdateTimer(); + + // kill every previously running process + GetGame().GetCallqueue().Remove(UpdateTimer); + GetGame().GetCallqueue().Remove(UpdateCountdown); + + GetGame().GetCallqueue().CallLater(UpdateTimer, 1000, true); // every second + } + + //------------------------------------------------------------------------------------------------ + protected void UpdateTimer() + { + if (!m_bTimerRunning) + { + GetGame().GetCallqueue().Remove(UpdateTimer); + return; + } + + int minutes = m_iTimerDuration / 60; + int seconds = m_iTimerDuration - (minutes * 60); + + string minutesStr; + string secondsStr; + + if (minutes < 10) + minutesStr = string.Format("0%1", minutes); + else + minutesStr = string.Format("%1", minutes); + + if (seconds < 10) + secondsStr = string.Format("0%1", seconds); + else + secondsStr = string.Format("%1", seconds); + + if (!m_wTimerDisplay) + return; + + TextWidget textWidget = TextWidget.Cast(m_wTimerDisplay.FindAnyWidget("Text0")); + + if (textWidget) + textWidget.SetText(string.Format("%1:%2", minutesStr, secondsStr)); + + m_iTimerDuration++; + } + + //------------------------------------------------------------------------------------------------ + protected void RemoveTimer() + { + if (m_wTimerDisplay) + { + delete m_wTimerDisplay; + } + } + + //------------------------------------------------------------------------------------------------ + int GetTimerDuration() + { + return m_iTimerDuration; + } + + //------------------------------------------------------------------------------------------------ + void TeleportPlayer(vector pos) + { + Rpc(RpcDo_Owner_TeleportPlayer, pos); + } + + //------------------------------------------------------------------------------------------------ + [RplRpc(RplChannel.Reliable, RplRcver.Owner)] + protected void RpcDo_Owner_TeleportPlayer(vector pos) + { + // executed locally on players machine + + if(SCR_Global.TeleportLocalPlayer(pos, SCR_EPlayerTeleportedReason.DEFAULT)) + Print(string.Format("OTF - Player with ID %1 successfully teleported to position %2 - Deprecated", GetPlayerId(), pos), LogLevel.NORMAL); + else + Print(string.Format("OTF - Player with ID %1 NOT successfully teleported to position %2 - Deprecated", GetPlayerId(), pos), LogLevel.WARNING); + } + + //------------------------------------------------------------------------------------------------ + void TeleportPlayerToMapPos(int playerId, int mapPos[2]) + { + Rpc(Rpc_Do_Owner_TeleportPlayerToMapPos, playerId, mapPos); + } + + //------------------------------------------------------------------------------------------------ + [RplRpc(RplChannel.Reliable, RplRcver.Owner)] + protected void Rpc_Do_Owner_TeleportPlayerToMapPos(int playerId, int mapPos[2]) + { + // executed locally on players machine + + IEntity playerEntity = GetGame().GetPlayerManager().GetPlayerControlledEntity(playerId); + + if (!playerEntity) + { + Print(string.Format("OTF - Player entity missing; skipping teleport"), LogLevel.WARNING); + return; + } + + Print(string.Format("OTF - Player with ID %1 has position %2", playerId, playerEntity.GetOrigin()), LogLevel.NORMAL); + + bool teleportSuccessful = false; + + GRAD_OnTheFlyManager otfManager = GRAD_OnTheFlyManager.GetInstance(); + + vector newWorldPos; + + int teleportAttemptsCounter = 0; + + while (!teleportSuccessful) + { + if (teleportAttemptsCounter >= 5) + { + ShowHint("Teleport not successful. Contact your Game Master for manual teleport.", "On The Fly", 10, false); + Print(string.Format("OTF - Player with ID %1 NOT successfully teleported to position %2", GetPlayerId(), newWorldPos), LogLevel.NORMAL); + break; + } + + mapPos[0] = mapPos[0] + Math.RandomFloat(-30, 30); + mapPos[1] = mapPos[1] + Math.RandomFloat(-30, 30); + + newWorldPos = otfManager.MapPosToWorldPos(mapPos); + + teleportSuccessful = SCR_Global.TeleportLocalPlayer(newWorldPos, SCR_EPlayerTeleportedReason.DEFAULT); + + if (teleportSuccessful) + Print(string.Format("OTF - Player with ID %1 successfully teleported to position %2", GetPlayerId(), newWorldPos), LogLevel.NORMAL); + + teleportAttemptsCounter++; + } + } +}; diff --git a/Scripts/Game/UserActions/GRAD_OpforShopAction.c b/Scripts/Game/UserActions/GRAD_OpforShopAction.c index f781166..2df38e6 100644 --- a/Scripts/Game/UserActions/GRAD_OpforShopAction.c +++ b/Scripts/Game/UserActions/GRAD_OpforShopAction.c @@ -4,6 +4,9 @@ class GRAD_OpforShopAction : ADM_ShopAction //------------------------------------------------------------------------------------------------ override bool CanBeShownScript(IEntity user) { + if (!super.CanBeShownScript(user)) + return false; + GRAD_OnTheFlyManager otfManager = GRAD_OnTheFlyManager.GetInstance(); if(!otfManager) @@ -24,7 +27,7 @@ class GRAD_OpforShopAction : ADM_ShopAction //------------------------------------------------------------------------------------------------ override bool CanBePerformedScript(IEntity user) { - if ( !super.CanBePerformedScript( user ) ) + if (!super.CanBePerformedScript(user)) return false; GRAD_OnTheFlyManager otfManager = GRAD_OnTheFlyManager.GetInstance(); diff --git a/Worlds/OTF_Eden_Layers/gm_manager.layer b/Worlds/OTF_Eden_Layers/gm_manager.layer index 901c779..d6abcd4 100644 --- a/Worlds/OTF_Eden_Layers/gm_manager.layer +++ b/Worlds/OTF_Eden_Layers/gm_manager.layer @@ -25,7 +25,7 @@ TagManager : "{2FA9E172CAB1857A}Prefabs/MP/Managers/TagManager.et" { PS_GameModeCoop PS_GameMode_Lobby1 : "{9C2001FE7A2F2281}Prefabs/MP/Modes/PS_GameMode_Lobby.et" { coords 6628.146 157.608 6465.25 m_bMarkersOnlyOnBriefing 0 - m_bKillRedundantUnits 1 + m_bRemoveRedundantUnits 1 m_iFreezeTime 0 { SCR_FactionManager "5EF5512A533A11FE" {