diff --git a/TO_MERGE/cse/sys_equipment/CfgAmmo.h b/TO_MERGE/cse/sys_equipment/CfgAmmo.h new file mode 100644 index 0000000000..f73b099245 --- /dev/null +++ b/TO_MERGE/cse/sys_equipment/CfgAmmo.h @@ -0,0 +1,159 @@ +#define FUSEE_TIME_TO_LIVE 600 +#define FUSEE_FLARE_SIZE 2 +#define FUSEE_INTENSITY 3000 + +#define FLARE_TIME_TO_LIVE 60 +#define FLARE_SIZE 10 +#define FLARE_INTENSITY 4000 + +class cfgAmmo { + class F_20mm_White; + class F_20mm_Red: F_20mm_White {}; + class F_20mm_Yellow: F_20mm_White {}; + class F_20mm_Green: F_20mm_White {}; + + class CSE_FuseeWhite: F_20mm_White { + intensity = FUSEE_INTENSITY; + flareSize = FUSEE_FLARE_SIZE; + timeToLive = FUSEE_TIME_TO_LIVE; + airFriction = -0.0005; + thrust = 210; + thrustTime = 1.5; + }; + class CSE_FuseeRed: F_20mm_Red { + intensity = FUSEE_INTENSITY; + flareSize = FUSEE_FLARE_SIZE; + timeToLive = FUSEE_TIME_TO_LIVE; + airFriction = -0.0005; + thrust = 210; + thrustTime = 1.5; + }; + class CSE_FuseeYellow: F_20mm_Yellow { + intensity = FUSEE_INTENSITY; + flareSize = FUSEE_FLARE_SIZE; + timeToLive = FUSEE_TIME_TO_LIVE; + airFriction = -0.0005; + thrust = 210; + thrustTime = 1.5; + }; + class CSE_FuseeGreen: F_20mm_Green { + intensity = FUSEE_INTENSITY; + flareSize = FUSEE_FLARE_SIZE; + timeToLive = FUSEE_TIME_TO_LIVE; + airFriction = -0.0005; + thrust = 210; + thrustTime = 1.5; + }; + + + class CSE_FlareWhite: F_20mm_White { + intensity = FLARE_INTENSITY; + flareSize = FLARE_SIZE; + timeToLive = FLARE_TIME_TO_LIVE; + airFriction = -0.0005; + thrust = 210; + thrustTime = 1.5; + }; + class CSE_FlareRed: F_20mm_Red { + intensity = FLARE_INTENSITY; + flareSize = FLARE_SIZE; + timeToLive = FLARE_TIME_TO_LIVE; + airFriction = -0.0005; + thrust = 210; + thrustTime = 1.5; + }; + class CSE_FlareYellow: F_20mm_Yellow { + intensity = FLARE_INTENSITY; + flareSize = FLARE_SIZE; + timeToLive = FLARE_TIME_TO_LIVE; + airFriction = -0.0005; + thrust = 210; + thrustTime = 1.5; + }; + class CSE_FlareGreen: F_20mm_Green { + intensity = FLARE_INTENSITY; + flareSize = FLARE_SIZE; + timeToLive = FLARE_TIME_TO_LIVE; + airFriction = -0.0005; + thrust = 210; + thrustTime = 1.5; + }; +}; + + +class CfgMagazines { + class HandGrenade; + class CSE_Flare_Base: HandGrenade { + value = 2; + nameSoundWeapon = "smokeshell"; + nameSound = "smokeshell"; + mass = 4; + initSpeed = 22; + }; + class CSE_FlareWhite: CSE_Flare_Base { + ammo = "CSE_FlareWhite"; + displayname = $STR_CSE_FLARE_WHITE; + descriptionshort = $STR_CSE_FLARE_WHITE; + displayNameShort = $STR_CSE_FLARE_WHITE; + model = "\A3\weapons_f\ammo\flare_white"; + picture = "\A3\Weapons_F\Data\UI\gear_flare_white_ca.paa"; + }; + class CSE_FlareRed: CSE_Flare_Base { + ammo = "CSE_FlareRed"; + displayname = $STR_CSE_FLARE_RED; + descriptionshort = $STR_CSE_FLARE_RED; + displayNameShort = $STR_CSE_FLARE_RED; + model = "\A3\weapons_f\ammo\flare_red"; + picture = "\A3\Weapons_F\Data\UI\gear_flare_red_ca.paa"; + }; + class CSE_FlareYellow: CSE_Flare_Base { + ammo = "CSE_FlareYellow"; + displayname = $STR_CSE_FLARE_YELLOW; + descriptionshort = $STR_CSE_FLARE_YELLOW; + displayNameShort = $STR_CSE_FLARE_YELLOW; + model = "\A3\weapons_f\ammo\flare_yellow"; + picture = "\A3\Weapons_F\Data\UI\gear_flare_yellow_ca.paa"; + }; + class CSE_FlareGreen: CSE_Flare_Base { + ammo = "CSE_FlareGreen"; + displayname = $STR_CSE_FLARE_GREEN; + descriptionshort = $STR_CSE_FLARE_GREEN; + displayNameShort = $STR_CSE_FLARE_GREEN; + model = "\A3\weapons_f\ammo\flare_green"; + picture = "\A3\Weapons_F\Data\UI\gear_flare_green_ca.paa"; + }; + + + class CSE_RoadFlareWhite: CSE_Flare_Base { + ammo = "CSE_FuseeWhite"; + displayname = $STR_CSE_ROAD_FLARE_WHITE; + descriptionshort = $STR_CSE_ROAD_FLARE_WHITE; + displayNameShort = $STR_CSE_ROAD_FLARE_WHITE; + model = "\A3\weapons_f\ammo\flare_white"; + picture = "\A3\Weapons_F\Data\UI\gear_flare_white_ca.paa"; + }; + class CSE_RoadFlareRed: CSE_Flare_Base { + ammo = "CSE_FuseeRed"; + displayname = $STR_CSE_ROAD_FLARE_RED; + descriptionshort = $STR_CSE_ROAD_FLARE_RED; + displayNameShort = $STR_CSE_ROAD_FLARE_RED; + model = "\A3\weapons_f\ammo\flare_red"; + picture = "\A3\Weapons_F\Data\UI\gear_flare_red_ca.paa"; + }; + class CSE_RoadFlareYellow: CSE_Flare_Base { + ammo = "CSE_FuseeYellow"; + displayname = $STR_CSE_ROAD_FLARE_YELLOW; + descriptionshort = $STR_CSE_ROAD_FLARE_YELLOW; + displayNameShort = $STR_CSE_ROAD_FLARE_YELLOW; + model = "\A3\weapons_f\ammo\flare_yellow"; + picture = "\A3\Weapons_F\Data\UI\gear_flare_yellow_ca.paa"; + }; + class CSE_RoadFlareGreen: CSE_Flare_Base { + ammo = "CSE_FuseeGreen"; + displayname = $STR_CSE_ROAD_FLARE_GREEN; + descriptionshort = $STR_CSE_ROAD_FLARE_GREEN; + displayNameShort = $STR_CSE_ROAD_FLARE_GREEN; + model = "\A3\weapons_f\ammo\flare_green"; + picture = "\A3\Weapons_F\Data\UI\gear_flare_green_ca.paa"; + }; +}; \ No newline at end of file diff --git a/TO_MERGE/cse/sys_equipment/CfgFactionClasses.h b/TO_MERGE/cse/sys_equipment/CfgFactionClasses.h new file mode 100644 index 0000000000..3eed8715b8 --- /dev/null +++ b/TO_MERGE/cse/sys_equipment/CfgFactionClasses.h @@ -0,0 +1,7 @@ +class CfgFactionClasses +{ + class NO_CATEGORY; + class cse_equipment: NO_CATEGORY { + displayName = "CSE Equipment"; + }; +}; \ No newline at end of file diff --git a/TO_MERGE/cse/sys_equipment/CfgFunctions.h b/TO_MERGE/cse/sys_equipment/CfgFunctions.h new file mode 100644 index 0000000000..0112eaf16b --- /dev/null +++ b/TO_MERGE/cse/sys_equipment/CfgFunctions.h @@ -0,0 +1,49 @@ +class CfgFunctions { + class CSE { + class Equipment { + file = "cse\cse_sys_equipment\functions"; + class hasAttachableItem_EQ { recompile = 1; }; + class attachItem_EQ { recompile = 1; }; + class detachItem_EQ { recompile = 1; }; + class isAttachableItem_EQ { recompile = 1; }; + class hasItemAttached_EQ { recompile = 1; }; + class getAllEquipmentOptions_EQ { recompile = 1; }; + class registerNewEquipmentOption_EQ { recompile = 1; }; + class areEquipmentOptionsAvailable_EQ { recompile = 1; }; + class dropFlare_EQ { recompile = 1; }; + class moduleFlare_EQ { recompile = 1; }; + class hasFlare_EQ { recompile = 1; }; + class isFlare_EQ { recompile = 1; }; + class putWeaponOnBack_EQ { recompile = 1; }; + class getPercentageAmmoMagazine_EQ { recompile = 1; }; + class hideUnitInfoAmmo_EQ { recompile = 1; }; + }; + class WeaponRest { + file = "cse\cse_sys_equipment\weaponresting\functions"; + class keyPressed_WR { recompile = 1; }; + class canRestWeapon_WR { recompile = 1; }; + class canDeployBipod_WR { recompile = 1; }; + class restWeapon_WR { recompile = 1; }; + class unrestWeapon_WR { recompile = 1; }; + class deployWeapon_WR { recompile = 1; }; + class undeployWeapon_WR { recompile = 1; }; + class actionReleaseWeapon_WR { recompile = 1; }; + class hasBipod_WR { recompile = 1; }; + }; + class WeaponSafety { + file = "cse\cse_sys_equipment\weaponsafety\functions"; + class safetyOff_ws { recompile = 1; }; + class safetyOn_ws { recompile = 1; }; + }; + class nightVisionModule { + file = "cse\cse_sys_equipment\nvg\functions"; + class adjustBrightness_NVG { recompile = 1; }; + }; + + class MagazineRepack { + file = "cse\cse_sys_equipment\magazineRepack\functions"; + class repackMagazines { recompile = 1; }; + class repackMagazinesAll { recompile = 1; }; + }; + }; +}; diff --git a/TO_MERGE/cse/sys_equipment/CfgMovesBasic.h b/TO_MERGE/cse/sys_equipment/CfgMovesBasic.h new file mode 100644 index 0000000000..af719e15fc --- /dev/null +++ b/TO_MERGE/cse/sys_equipment/CfgMovesBasic.h @@ -0,0 +1,277 @@ +// Adpated from: https://github.com/Taosenai/tmr/blob/master/tmr_autorest/config.cpp + +#define CSE_DEPLOYED_TURNSPEED 0.1 + +class CfgMovesBasic { + class Default; + + class Actions { + class RifleStandActions; + class RifleStandActions_cse_deployed : RifleStandActions { + stop = "AmovPercMstpSrasWrflDnon_cse_deployed"; + default = "AmovPercMstpSrasWrflDnon_cse_deployed"; + turnL = "AmovPercMstpSrasWrflDnon_cse_deployed"; + turnR = "AmovPercMstpSrasWrflDnon_cse_deployed"; + turnSpeed = CSE_DEPLOYED_TURNSPEED; + limitFast = 1; + }; + + class RifleAdjustLStandActions; + class RifleAdjustLStandActions_cse_deployed : RifleAdjustLStandActions { + stop = "AadjPercMstpSrasWrflDleft_cse_deployed"; + default = "AadjPercMstpSrasWrflDleft_cse_deployed"; + AdjustL = "AadjPercMstpSrasWrflDleft_cse_deployed"; + turnL = "AadjPercMstpSrasWrflDleft_cse_deployed"; + turnR = "AadjPercMstpSrasWrflDleft_cse_deployed"; + turnSpeed = CSE_DEPLOYED_TURNSPEED; + limitFast = 1; + }; + + class RifleAdjustRStandActions; + class RifleAdjustRStandActions_cse_deployed : RifleAdjustRStandActions { + stop = "AadjPercMstpSrasWrflDright_cse_deployed"; + default = "AadjPercMstpSrasWrflDright_cse_deployed"; + AdjustRight = "AadjPercMstpSrasWrflDright_cse_deployed"; + turnL = "AadjPercMstpSrasWrflDright_cse_deployed"; + turnR = "AadjPercMstpSrasWrflDright_cse_deployed"; + turnSpeed = CSE_DEPLOYED_TURNSPEED; + limitFast = 1; + }; + + class RifleAdjustFStandActions; + class RifleAdjustFStandActions_cse_deployed : RifleAdjustFStandActions { + stop = "AadjPercMstpSrasWrflDup_cse_deployed"; + default = "AadjPercMstpSrasWrflDup_cse_deployed"; + AdjustF = "AadjPercMstpSrasWrflDup_cse_deployed"; + turnL = "AadjPercMstpSrasWrflDup_cse_deployed"; + turnR = "AadjPercMstpSrasWrflDup_cse_deployed"; + turnSpeed = CSE_DEPLOYED_TURNSPEED; + limitFast = 1; + }; + + class RifleAdjustBStandActions; + class RifleAdjustBStandActions_cse_deployed : RifleAdjustBStandActions { + stop = "AadjPercMstpSrasWrflDdown_cse_deployed"; + default = "AadjPercMstpSrasWrflDdown_cse_deployed"; + AdjustB = "AadjPercMstpSrasWrflDdown_cse_deployed"; + turnR = "AadjPercMstpSrasWrflDdown_cse_deployed"; + turnL = "AadjPercMstpSrasWrflDdown_cse_deployed"; + turnSpeed = CSE_DEPLOYED_TURNSPEED; + limitFast = 1; + }; + + class RifleAdjustLKneelActions; + class RifleAdjustLKneelActions_cse_deployed : RifleAdjustLKneelActions { + stop = "AadjPknlMstpSrasWrflDleft_cse_deployed"; + default = "AadjPknlMstpSrasWrflDleft_cse_deployed"; + turnL = "AadjPknlMstpSrasWrflDleft_cse_deployed"; + turnR = "AadjPknlMstpSrasWrflDleft_cse_deployed"; + turnSpeed = CSE_DEPLOYED_TURNSPEED; + limitFast = 1; + }; + + class RifleAdjustRKneelActions; + class RifleAdjustRKneelActions_cse_deployed : RifleAdjustRKneelActions { + stop = "AadjPknlMstpSrasWrflDright_cse_deployed"; + default = "AadjPknlMstpSrasWrflDright_cse_deployed"; + turnL = "AadjPknlMstpSrasWrflDright_cse_deployed"; + turnR = "AadjPknlMstpSrasWrflDright_cse_deployed"; + turnSpeed = CSE_DEPLOYED_TURNSPEED; + limitFast = 1; + }; + + class RifleAdjustFKneelActions; + class RifleAdjustFKneelActions_cse_deployed : RifleAdjustFKneelActions { + stop = "AadjPknlMstpSrasWrflDup_cse_deployed"; + default = "AadjPknlMstpSrasWrflDup_cse_deployed"; + turnL = "AadjPknlMstpSrasWrflDup_cse_deployed"; + turnR = "AadjPknlMstpSrasWrflDup_cse_deployed"; + turnSpeed = CSE_DEPLOYED_TURNSPEED; + limitFast = 1; + }; + + class RifleAdjustBKneelActions; + class RifleAdjustBKneelActions_cse_deployed : RifleAdjustBKneelActions { + stop = "AadjPknlMstpSrasWrflDdown_cse_deployed"; + default = "AadjPknlMstpSrasWrflDdown_cse_deployed"; + turnL = "AadjPknlMstpSrasWrflDdown_cse_deployed"; + turnR = "AadjPknlMstpSrasWrflDdown_cse_deployed"; + turnSpeed = CSE_DEPLOYED_TURNSPEED; + limitFast = 1; + }; + + class RifleKneelActions; + class RifleKneelActions_cse_deployed : RifleKneelActions { + stop = "AmovPknlMstpSrasWrflDnon_cse_deployed"; + default = "AmovPknlMstpSrasWrflDnon_cse_deployed"; + crouch = "AmovPknlMstpSrasWrflDnon_cse_deployed"; + turnL = "AmovPknlMstpSrasWrflDnon_cse_deployed"; + turnR = "AmovPknlMstpSrasWrflDnon_cse_deployed"; + turnSpeed = CSE_DEPLOYED_TURNSPEED; + limitFast = 1; + }; + + class RifleProneActions; + class RifleProneActions_cse_deployed : RifleProneActions { + stop = "AmovPpneMstpSrasWrflDnon_cse_deployed"; + default = "AmovPpneMstpSrasWrflDnon_cse_deployed"; + turnL = "AmovPpneMstpSrasWrflDnon_cse_deployed"; + turnR = "AmovPpneMstpSrasWrflDnon_cse_deployed"; + turnSpeed = CSE_DEPLOYED_TURNSPEED; + limitFast = 1; + }; + + class RifleAdjustFProneActions; + class RifleAdjustFProneActions_cse_deployed : RifleAdjustFProneActions { + stop = "aadjppnemstpsraswrfldup_cse_deployed"; + default = "aadjppnemstpsraswrfldup_cse_deployed"; + turnL = "aadjppnemstpsraswrfldup_cse_deployed"; + turnR = "aadjppnemstpsraswrfldup_cse_deployed"; + turnSpeed = CSE_DEPLOYED_TURNSPEED; + limitFast = 1; + }; + + class RifleStandActions_cse_rested : RifleStandActions { + stop = "AmovPercMstpSrasWrflDnon_cse_rested"; + default = "AmovPercMstpSrasWrflDnon_cse_rested"; + turnL = "AmovPercMstpSrasWrflDnon_cse_rested"; + turnR = "AmovPercMstpSrasWrflDnon_cse_rested"; + turnSpeed = CSE_DEPLOYED_TURNSPEED; + limitFast = 1; + }; + + class RifleAdjustLStandActions_cse_rested : RifleAdjustLStandActions { + stop = "AadjPercMstpSrasWrflDleft_cse_rested"; + default = "AadjPercMstpSrasWrflDleft_cse_rested"; + AdjustL = "AadjPercMstpSrasWrflDleft_cse_rested"; + turnL = "AadjPercMstpSrasWrflDleft_cse_rested"; + turnR = "AadjPercMstpSrasWrflDleft_cse_rested"; + turnSpeed = CSE_DEPLOYED_TURNSPEED; + limitFast = 1; + }; + + class RifleAdjustRStandActions_cse_rested : RifleAdjustRStandActions { + stop = "AadjPercMstpSrasWrflDright_cse_rested"; + default = "AadjPercMstpSrasWrflDright_cse_rested"; + AdjustRight = "AadjPercMstpSrasWrflDright_cse_rested"; + turnL = "AadjPercMstpSrasWrflDright_cse_rested"; + turnR = "AadjPercMstpSrasWrflDright_cse_rested"; + turnSpeed = CSE_DEPLOYED_TURNSPEED; + limitFast = 1; + }; + + class RifleAdjustFStandActions_cse_rested : RifleAdjustFStandActions { + stop = "AadjPercMstpSrasWrflDup_cse_rested"; + default = "AadjPercMstpSrasWrflDup_cse_rested"; + AdjustF = "AadjPercMstpSrasWrflDup_cse_rested"; + turnL = "AadjPercMstpSrasWrflDup_cse_rested"; + turnR = "AadjPercMstpSrasWrflDup_cse_rested"; + turnSpeed = CSE_DEPLOYED_TURNSPEED; + limitFast = 1; + }; + + class RifleAdjustBStandActions_cse_rested : RifleAdjustBStandActions { + stop = "AadjPercMstpSrasWrflDdown_cse_rested"; + default = "AadjPercMstpSrasWrflDdown_cse_rested"; + AdjustB = "AadjPercMstpSrasWrflDdown_cse_rested"; + turnR = "AadjPercMstpSrasWrflDdown_cse_rested"; + turnL = "AadjPercMstpSrasWrflDdown_cse_rested"; + turnSpeed = CSE_DEPLOYED_TURNSPEED; + limitFast = 1; + }; + + class RifleAdjustLKneelActions_cse_rested : RifleAdjustLKneelActions { + stop = "AadjPknlMstpSrasWrflDleft_cse_rested"; + default = "AadjPknlMstpSrasWrflDleft_cse_rested"; + turnL = "AadjPknlMstpSrasWrflDleft_cse_rested"; + turnR = "AadjPknlMstpSrasWrflDleft_cse_rested"; + turnSpeed = CSE_DEPLOYED_TURNSPEED; + limitFast = 1; + }; + + class RifleAdjustRKneelActions_cse_rested : RifleAdjustRKneelActions { + stop = "AadjPknlMstpSrasWrflDright_cse_rested"; + default = "AadjPknlMstpSrasWrflDright_cse_rested"; + turnL = "AadjPknlMstpSrasWrflDright_cse_rested"; + turnR = "AadjPknlMstpSrasWrflDright_cse_rested"; + turnSpeed = CSE_DEPLOYED_TURNSPEED; + limitFast = 1; + }; + + class RifleAdjustFKneelActions_cse_rested : RifleAdjustFKneelActions { + stop = "AadjPknlMstpSrasWrflDup_cse_rested"; + default = "AadjPknlMstpSrasWrflDup_cse_rested"; + turnL = "AadjPknlMstpSrasWrflDup_cse_rested"; + turnR = "AadjPknlMstpSrasWrflDup_cse_rested"; + turnSpeed = CSE_DEPLOYED_TURNSPEED; + limitFast = 1; + }; + + class RifleAdjustBKneelActions_cse_rested : RifleAdjustBKneelActions { + stop = "AadjPknlMstpSrasWrflDdown_cse_rested"; + default = "AadjPknlMstpSrasWrflDdown_cse_rested"; + turnL = "AadjPknlMstpSrasWrflDdown_cse_rested"; + turnR = "AadjPknlMstpSrasWrflDdown_cse_rested"; + turnSpeed = CSE_DEPLOYED_TURNSPEED; + limitFast = 1; + }; + + class RifleKneelActions_cse_rested : RifleKneelActions { + stop = "AmovPknlMstpSrasWrflDnon_cse_rested"; + default = "AmovPknlMstpSrasWrflDnon_cse_rested"; + crouch = "AmovPknlMstpSrasWrflDnon_cse_rested"; + turnL = "AmovPknlMstpSrasWrflDnon_cse_rested"; + turnR = "AmovPknlMstpSrasWrflDnon_cse_rested"; + turnSpeed = CSE_DEPLOYED_TURNSPEED; + limitFast = 1; + }; + + class RifleProneActions_cse_rested : RifleProneActions { + stop = "AmovPpneMstpSrasWrflDnon_cse_rested"; + default = "AmovPpneMstpSrasWrflDnon_cse_rested"; + turnL = "AmovPpneMstpSrasWrflDnon_cse_rested"; + turnR = "AmovPpneMstpSrasWrflDnon_cse_rested"; + turnSpeed = CSE_DEPLOYED_TURNSPEED; + limitFast = 1; + }; + + class RifleAdjustLProneActions; + class RifleAdjustLProneActions_cse_rested : RifleAdjustLProneActions { + stop = "aadjppnemstpsraswrfldleft_cse_rested"; + default = "aadjppnemstpsraswrfldleft_cse_rested"; + turnL = "aadjppnemstpsraswrfldleft_cse_rested"; + turnR = "aadjppnemstpsraswrfldleft_cse_rested"; + turnSpeed = CSE_DEPLOYED_TURNSPEED; + limitFast = 1; + }; + + class RifleAdjustRProneActions; + class RifleAdjustRProneActions_cse_rested : RifleAdjustRProneActions { + stop = "aadjppnemstpsraswrfldright_cse_rested"; + default = "aadjppnemstpsraswrfldright_cse_rested"; + turnL = "aadjppnemstpsraswrfldright_cse_rested"; + turnR = "aadjppnemstpsraswrfldright_cse_rested"; + turnSpeed = CSE_DEPLOYED_TURNSPEED; + limitFast = 1; + }; + + class RifleAdjustBProneActions; + class RifleAdjustBProneActions_cse_rested : RifleAdjustBProneActions { + stop = "aadjppnemstpsraswrflddown_cse_rested"; + default = "aadjppnemstpsraswrflddown_cse_rested"; + turnL = "aadjppnemstpsraswrflddown_cse_rested"; + turnR = "aadjppnemstpsraswrflddown_cse_rested"; + turnSpeed = CSE_DEPLOYED_TURNSPEED; + limitFast = 1; + }; + + class RifleAdjustFProneActions_cse_rested : RifleAdjustFProneActions { + stop = "aadjppnemstpsraswrfldup_cse_rested"; + default = "aadjppnemstpsraswrfldup_cse_rested"; + turnL = "aadjppnemstpsraswrfldup_cse_rested"; + turnR = "aadjppnemstpsraswrfldup_cse_rested"; + turnSpeed = CSE_DEPLOYED_TURNSPEED; + limitFast = 1; + }; + }; +}; diff --git a/TO_MERGE/cse/sys_equipment/CfgMovesMaleSdr.h b/TO_MERGE/cse/sys_equipment/CfgMovesMaleSdr.h new file mode 100644 index 0000000000..207622724a --- /dev/null +++ b/TO_MERGE/cse/sys_equipment/CfgMovesMaleSdr.h @@ -0,0 +1,403 @@ +// Adpated from: https://github.com/Taosenai/tmr/blob/master/tmr_autorest/config.cpp + +#define CSE_SWAY_DEPLOYED 0.06 +#define CSE_SWAY_DEPLOYED_PRONE 0.03 +#define CSE_SWAY_RESTED 0.30 +#define CSE_SWAY_RESTED_PRONE 0.10 + +class CfgMovesMaleSdr : CfgMovesBasic { + class States { + class AmovPercMstpSrasWrflDnon; + class AmovPercMstpSrasWrflDnon_cse_deployed : AmovPercMstpSrasWrflDnon { + aimPrecision = CSE_SWAY_DEPLOYED; + actions = "RifleStandActions_cse_deployed"; + aiming = "aimingLying"; + speed = 0.01; + onLandEnd = true; + onLandBeg = true; + + ConnectTo[] = {"AmovPercMstpSrasWrflDnon_cse_deployed", 0.02}; + ConnectFrom[] = {"AmovPercMstpSrasWrflDnon_cse_deployed", 0.02}; + InterpolateFrom[] = {"AmovPercMstpSrasWrflDnon", 0.02}; + InterpolateTo[] = {"AmovPercMstpSrasWrflDnon", 0.02}; + }; + + class aadjpercmstpsraswrfldup; + class aadjpercmstpsraswrfldup_cse_deployed : aadjpercmstpsraswrfldup { + aimPrecision = CSE_SWAY_DEPLOYED; + actions = "RifleAdjustFStandActions_cse_deployed"; + aiming = "aimingLying"; + speed = 0.01; + onLandEnd = true; + onLandBeg = true; + + ConnectTo[] = {"aadjpercmstpsraswrfldup_cse_deployed", 0.02}; + ConnectFrom[] = {"aadjpercmstpsraswrfldup_cse_deployed", 0.02}; + InterpolateFrom[] = {"aadjpercmstpsraswrfldup", 0.02}; + InterpolateTo[] = {"aadjpercmstpsraswrfldup", 0.02}; + }; + + class aadjpercmstpsraswrflddown; + class aadjpercmstpsraswrflddown_cse_deployed : aadjpercmstpsraswrflddown { + aimPrecision = CSE_SWAY_DEPLOYED; + actions = "RifleAdjustBStandActions_cse_deployed"; + aiming = "aimingLying"; + speed = 0.01; + onLandEnd = true; + onLandBeg = true; + + ConnectTo[] = {"aadjpercmstpsraswrflddown_cse_deployed", 0.02}; + ConnectFrom[] = {"aadjpercmstpsraswrflddown_cse_deployed", 0.02}; + InterpolateFrom[] = {"aadjpercmstpsraswrflddown", 0.02}; + InterpolateTo[] = {"aadjpercmstpsraswrflddown", 0.02}; + }; + + class aadjpercmstpsraswrfldright; + class aadjpercmstpsraswrfldright_cse_deployed : aadjpercmstpsraswrfldright { + aimPrecision = CSE_SWAY_DEPLOYED; + actions = "RifleAdjustRStandActions_cse_deployed"; + aiming = "aimingLying"; + speed = 0.01; + onLandEnd = true; + onLandBeg = true; + + ConnectTo[] = {"aadjpercmstpsraswrfldright_cse_deployed", 0.02}; + ConnectFrom[] = {"aadjpercmstpsraswrfldright_cse_deployed", 0.02}; + InterpolateFrom[] = {"aadjpercmstpsraswrfldright", 0.02}; + InterpolateTo[] = {"aadjpercmstpsraswrfldright", 0.02}; + }; + + class aadjpercmstpsraswrfldleft; + class aadjpercmstpsraswrfldleft_cse_deployed : aadjpercmstpsraswrfldleft { + aimPrecision = CSE_SWAY_DEPLOYED; + actions = "RifleAdjustLStandActions_cse_deployed"; + aiming = "aimingLying"; + speed = 0.01; + onLandEnd = true; + onLandBeg = true; + + ConnectTo[] = {"aadjpercmstpsraswrfldleft_cse_deployed", 0.02}; + ConnectFrom[] = {"aadjpercmstpsraswrfldleft_cse_deployed", 0.02}; + InterpolateFrom[] = {"aadjpercmstpsraswrfldleft", 0.02}; + InterpolateTo[] = {"aadjpercmstpsraswrfldleft", 0.02}; + }; + + class aadjpknlmstpsraswrfldup; + class aadjpknlmstpsraswrfldup_cse_deployed : aadjpknlmstpsraswrfldup { + aimPrecision = CSE_SWAY_DEPLOYED; + actions = "RifleAdjustFKneelActions_cse_deployed"; + aiming = "aimingLying"; + speed = 0.01; + onLandEnd = true; + onLandBeg = true; + + ConnectTo[] = {"aadjpknlmstpsraswrfldup_cse_deployed", 0.02}; + ConnectFrom[] = {"aadjpknlmstpsraswrfldup_cse_deployed", 0.02}; + InterpolateFrom[] = {"aadjpknlmstpsraswrfldup", 0.02}; + InterpolateTo[] = {"aadjpknlmstpsraswrfldup", 0.02}; + }; + + class amovpknlmstpsraswrfldnon; + class amovpknlmstpsraswrfldnon_cse_deployed : amovpknlmstpsraswrfldnon { + aimPrecision = CSE_SWAY_DEPLOYED; + actions = "RifleKneelActions_cse_deployed"; + aiming = "aimingLying"; + speed = 0.01; + onLandEnd = true; + onLandBeg = true; + + ConnectTo[] = {"amovpknlmstpsraswrfldnon_cse_deployed", 0.02}; + ConnectFrom[] = {"amovpknlmstpsraswrfldnon_cse_deployed", 0.02}; + InterpolateFrom[] = {"amovpknlmstpsraswrfldnon", 0.02}; + InterpolateTo[] = {"amovpknlmstpsraswrfldnon", 0.02}; + }; + + class aadjpknlmstpsraswrflddown; + class aadjpknlmstpsraswrflddown_cse_deployed : aadjpknlmstpsraswrflddown { + aimPrecision = CSE_SWAY_DEPLOYED; + actions = "RifleAdjustBKneelActions_cse_deployed"; + aiming = "aimingLying"; + speed = 0.01; + onLandEnd = true; + onLandBeg = true; + + ConnectTo[] = {"aadjpknlmstpsraswrflddown_cse_deployed", 0.02}; + ConnectFrom[] = {"aadjpknlmstpsraswrflddown_cse_deployed", 0.02}; + InterpolateFrom[] = {"aadjpknlmstpsraswrflddown", 0.02}; + InterpolateTo[] = {"aadjpknlmstpsraswrflddown", 0.02}; + }; + + class aadjpknlmstpsraswrfldleft; + class aadjpknlmstpsraswrfldleft_cse_deployed : aadjpknlmstpsraswrfldleft { + aimPrecision = CSE_SWAY_DEPLOYED; + actions = "RifleAdjustLKneelActions_cse_deployed"; + aiming = "aimingLying"; + speed = 0.01; + onLandEnd = true; + onLandBeg = true; + + ConnectTo[] = {"aadjpknlmstpsraswrfldleft_cse_deployed", 0.02}; + ConnectFrom[] = {"aadjpknlmstpsraswrfldleft_cse_deployed", 0.02}; + InterpolateFrom[] = {"aadjpknlmstpsraswrfldleft", 0.02}; + InterpolateTo[] = {"aadjpknlmstpsraswrfldleft", 0.02}; + }; + + class aadjpknlmstpsraswrfldright; + class aadjpknlmstpsraswrfldright_cse_deployed : aadjpknlmstpsraswrfldright { + aimPrecision = CSE_SWAY_DEPLOYED; + actions = "RifleAdjustRKneelActions_cse_deployed"; + aiming = "aimingLying"; + speed = 0.01; + onLandEnd = true; + onLandBeg = true; + + ConnectTo[] = {"aadjpknlmstpsraswrfldright_cse_deployed", 0.02}; + ConnectFrom[] = {"aadjpknlmstpsraswrfldright_cse_deployed", 0.02}; + InterpolateFrom[] = {"aadjpknlmstpsraswrfldright", 0.02}; + InterpolateTo[] = {"aadjpknlmstpsraswrfldright", 0.02}; + }; + + class aadjppnemstpsraswrfldup; + class aadjppnemstpsraswrfldup_cse_deployed : aadjppnemstpsraswrfldup { + aimPrecision = CSE_SWAY_DEPLOYED_PRONE; + actions = "RifleAdjustFProneActions_cse_deployed"; + aiming = "aimingLying"; + speed = 0.01; + onLandEnd = true; + onLandBeg = true; + + ConnectTo[] = {"aadjppnemstpsraswrfldup_cse_deployed", 0.02}; + ConnectFrom[] = {"aadjppnemstpsraswrfldup_cse_deployed", 0.02}; + InterpolateFrom[] = {"aadjppnemstpsraswrfldup", 0.02}; + InterpolateTo[] = {"aadjppnemstpsraswrfldup", 0.02}; + }; + + class amovppnemstpsraswrfldnon; + class amovppnemstpsraswrfldnon_cse_deployed : amovppnemstpsraswrfldnon { + aimPrecision = CSE_SWAY_DEPLOYED_PRONE; + actions = "RifleProneActions_cse_deployed"; + aiming = "aimingLying"; + speed = 0.01; + onLandEnd = true; + onLandBeg = true; + + ConnectTo[] = {"amovppnemstpsraswrfldnon_cse_deployed", 0.02}; + ConnectFrom[] = {"amovppnemstpsraswrfldnon_cse_deployed", 0.02}; + InterpolateFrom[] = {"amovppnemstpsraswrfldnon", 0.02}; + InterpolateTo[] = {"amovppnemstpsraswrfldnon", 0.02}; + }; + + class AmovPercMstpSrasWrflDnon_cse_rested : AmovPercMstpSrasWrflDnon { + aimPrecision = CSE_SWAY_RESTED; + actions = "RifleStandActions_cse_rested"; + aiming = "aimingLying"; + speed = 0.01; + onLandEnd = true; + onLandBeg = true; + + ConnectTo[] = {"AmovPercMstpSrasWrflDnon_cse_rested", 0.02}; + ConnectFrom[] = {"AmovPercMstpSrasWrflDnon_cse_rested", 0.02}; + InterpolateFrom[] = {"AmovPercMstpSrasWrflDnon", 0.02}; + InterpolateTo[] = {"AmovPercMstpSrasWrflDnon", 0.02}; + }; + + class aadjpercmstpsraswrfldup_cse_rested : aadjpercmstpsraswrfldup { + aimPrecision = CSE_SWAY_RESTED; + actions = "RifleAdjustFStandActions_cse_rested"; + aiming = "aimingLying"; + speed = 0.01; + onLandEnd = true; + onLandBeg = true; + + ConnectTo[] = {"aadjpercmstpsraswrfldup_cse_rested", 0.02}; + ConnectFrom[] = {"aadjpercmstpsraswrfldup_cse_rested", 0.02}; + InterpolateFrom[] = {"aadjpercmstpsraswrfldup", 0.02}; + InterpolateTo[] = {"aadjpercmstpsraswrfldup", 0.02}; + }; + + class aadjpercmstpsraswrflddown_cse_rested : aadjpercmstpsraswrflddown { + aimPrecision = CSE_SWAY_RESTED; + actions = "RifleAdjustBStandActions_cse_rested"; + aiming = "aimingLying"; + speed = 0.01; + onLandEnd = true; + onLandBeg = true; + + ConnectTo[] = {"aadjpercmstpsraswrflddown_cse_rested", 0.02}; + ConnectFrom[] = {"aadjpercmstpsraswrflddown_cse_rested", 0.02}; + InterpolateFrom[] = {"aadjpercmstpsraswrflddown", 0.02}; + InterpolateTo[] = {"aadjpercmstpsraswrflddown", 0.02}; + }; + + class aadjpercmstpsraswrfldright_cse_rested : aadjpercmstpsraswrfldright { + aimPrecision = CSE_SWAY_RESTED; + actions = "RifleAdjustRStandActions_cse_rested"; + aiming = "aimingLying"; + speed = 0.01; + onLandEnd = true; + onLandBeg = true; + + ConnectTo[] = {"aadjpercmstpsraswrfldright_cse_rested", 0.02}; + ConnectFrom[] = {"aadjpercmstpsraswrfldright_cse_rested", 0.02}; + InterpolateFrom[] = {"aadjpercmstpsraswrfldright", 0.02}; + InterpolateTo[] = {"aadjpercmstpsraswrfldright", 0.02}; + }; + + class aadjpercmstpsraswrfldleft_cse_rested : aadjpercmstpsraswrfldleft { + aimPrecision = CSE_SWAY_RESTED; + actions = "RifleAdjustLStandActions_cse_rested"; + aiming = "aimingLying"; + speed = 0.01; + onLandEnd = true; + onLandBeg = true; + + ConnectTo[] = {"aadjpercmstpsraswrfldleft_cse_rested", 0.02}; + ConnectFrom[] = {"aadjpercmstpsraswrfldleft_cse_rested", 0.02}; + InterpolateFrom[] = {"aadjpercmstpsraswrfldleft", 0.02}; + InterpolateTo[] = {"aadjpercmstpsraswrfldleft", 0.02}; + }; + + class aadjpknlmstpsraswrfldup_cse_rested : aadjpknlmstpsraswrfldup { + aimPrecision = CSE_SWAY_RESTED; + actions = "RifleAdjustFKneelActions_cse_rested"; + aiming = "aimingLying"; + speed = 0.01; + onLandEnd = true; + onLandBeg = true; + + ConnectTo[] = {"aadjpknlmstpsraswrfldup_cse_rested", 0.02}; + ConnectFrom[] = {"aadjpknlmstpsraswrfldup_cse_rested", 0.02}; + InterpolateFrom[] = {"aadjpknlmstpsraswrfldup", 0.02}; + InterpolateTo[] = {"aadjpknlmstpsraswrfldup", 0.02}; + }; + + class amovpknlmstpsraswrfldnon_cse_rested : amovpknlmstpsraswrfldnon { + aimPrecision = CSE_SWAY_RESTED; + actions = "RifleKneelActions_cse_rested"; + aiming = "aimingLying"; + speed = 0.01; + onLandEnd = true; + onLandBeg = true; + + ConnectTo[] = {"amovpknlmstpsraswrfldnon_cse_rested", 0.02}; + ConnectFrom[] = {"amovpknlmstpsraswrfldnon_cse_rested", 0.02}; + InterpolateFrom[] = {"amovpknlmstpsraswrfldnon", 0.02}; + InterpolateTo[] = {"amovpknlmstpsraswrfldnon", 0.02}; + }; + + class aadjpknlmstpsraswrflddown_cse_rested : aadjpknlmstpsraswrflddown { + aimPrecision = CSE_SWAY_RESTED; + actions = "RifleAdjustBKneelActions_cse_rested"; + aiming = "aimingLying"; + speed = 0.01; + onLandEnd = true; + onLandBeg = true; + + ConnectTo[] = {"aadjpknlmstpsraswrflddown_cse_rested", 0.02}; + ConnectFrom[] = {"aadjpknlmstpsraswrflddown_cse_rested", 0.02}; + InterpolateFrom[] = {"aadjpknlmstpsraswrflddown", 0.02}; + InterpolateTo[] = {"aadjpknlmstpsraswrflddown", 0.02}; + }; + + class aadjpknlmstpsraswrfldleft_cse_rested : aadjpknlmstpsraswrfldleft { + aimPrecision = CSE_SWAY_RESTED; + actions = "RifleAdjustLKneelActions_cse_rested"; + aiming = "aimingLying"; + speed = 0.01; + onLandEnd = true; + onLandBeg = true; + + ConnectTo[] = {"aadjpknlmstpsraswrfldleft_cse_rested", 0.02}; + ConnectFrom[] = {"aadjpknlmstpsraswrfldleft_cse_rested", 0.02}; + InterpolateFrom[] = {"aadjpknlmstpsraswrfldleft", 0.02}; + InterpolateTo[] = {"aadjpknlmstpsraswrfldleft", 0.02}; + }; + + class aadjpknlmstpsraswrfldright_cse_rested : aadjpknlmstpsraswrfldright { + aimPrecision = CSE_SWAY_RESTED; + actions = "RifleAdjustRKneelActions_cse_rested"; + aiming = "aimingLying"; + speed = 0.01; + onLandEnd = true; + onLandBeg = true; + + ConnectTo[] = {"aadjpknlmstpsraswrfldright_cse_rested", 0.02}; + ConnectFrom[] = {"aadjpknlmstpsraswrfldright_cse_rested", 0.02}; + InterpolateFrom[] = {"aadjpknlmstpsraswrfldright", 0.02}; + InterpolateTo[] = {"aadjpknlmstpsraswrfldright", 0.02}; + }; + + class aadjppnemstpsraswrfldup_cse_rested : aadjppnemstpsraswrfldup { + aimPrecision = CSE_SWAY_RESTED_PRONE; + actions = "RifleAdjustFProneActions_cse_rested"; + aiming = "aimingLying"; + speed = 0.01; + onLandEnd = true; + onLandBeg = true; + + ConnectTo[] = {"aadjppnemstpsraswrfldup_cse_rested", 0.02}; + ConnectFrom[] = {"aadjppnemstpsraswrfldup_cse_rested", 0.02}; + InterpolateFrom[] = {"aadjppnemstpsraswrfldup", 0.02}; + InterpolateTo[] = {"aadjppnemstpsraswrfldup", 0.02}; + }; + + class aadjppnemstpsraswrfldleft; + class aadjppnemstpsraswrfldleft_cse_rested : aadjppnemstpsraswrfldleft { + aimPrecision = CSE_SWAY_RESTED_PRONE; + actions = "RifleAdjustLProneActions_cse_rested"; + aiming = "aimingLying"; + speed = 0.01; + onLandEnd = true; + onLandBeg = true; + + ConnectTo[] = {"aadjppnemstpsraswrfldleft_cse_rested", 0.02}; + ConnectFrom[] = {"aadjppnemstpsraswrfldleft_cse_rested", 0.02}; + InterpolateFrom[] = {"aadjppnemstpsraswrfldleft", 0.02}; + InterpolateTo[] = {"aadjppnemstpsraswrfldleft", 0.02}; + }; + + class aadjppnemstpsraswrfldright; + class aadjppnemstpsraswrfldright_cse_rested : aadjppnemstpsraswrfldright { + aimPrecision = CSE_SWAY_RESTED_PRONE; + actions = "RifleAdjustRProneActions_cse_rested"; + aiming = "aimingLying"; + speed = 0.01; + onLandEnd = true; + onLandBeg = true; + + ConnectTo[] = {"aadjppnemstpsraswrfldright_cse_rested", 0.02}; + ConnectFrom[] = {"aadjppnemstpsraswrfldright_cse_rested", 0.02}; + InterpolateFrom[] = {"aadjppnemstpsraswrfldright", 0.02}; + InterpolateTo[] = {"aadjppnemstpsraswrfldright", 0.02}; + }; + + class aadjppnemstpsraswrflddown; + class aadjppnemstpsraswrflddown_cse_rested : aadjppnemstpsraswrflddown { + aimPrecision = CSE_SWAY_RESTED_PRONE; + actions = "RifleAdjustBProneActions_cse_rested"; + aiming = "aimingLying"; + speed = 0.01; + onLandEnd = true; + onLandBeg = true; + + ConnectTo[] = {"aadjppnemstpsraswrflddown_cse_rested", 0.02}; + ConnectFrom[] = {"aadjppnemstpsraswrflddown_cse_rested", 0.02}; + InterpolateFrom[] = {"aadjppnemstpsraswrflddown", 0.02}; + InterpolateTo[] = {"aadjppnemstpsraswrflddown", 0.02}; + }; + + class amovppnemstpsraswrfldnon_cse_rested : amovppnemstpsraswrfldnon { + aimPrecision = CSE_SWAY_RESTED_PRONE; + actions = "RifleProneActions_cse_rested"; + aiming = "aimingLying"; + speed = 0.01; + onLandEnd = true; + onLandBeg = true; + + ConnectTo[] = {"amovppnemstpsraswrfldnon_cse_rested", 0.02}; + ConnectFrom[] = {"amovppnemstpsraswrfldnon_cse_rested", 0.02}; + InterpolateFrom[] = {"amovppnemstpsraswrfldnon", 0.02}; + InterpolateTo[] = {"amovppnemstpsraswrfldnon", 0.02}; + }; + }; +}; \ No newline at end of file diff --git a/TO_MERGE/cse/sys_equipment/CfgSounds.h b/TO_MERGE/cse/sys_equipment/CfgSounds.h new file mode 100644 index 0000000000..87c417cc0e --- /dev/null +++ b/TO_MERGE/cse/sys_equipment/CfgSounds.h @@ -0,0 +1,28 @@ +class CfgSounds +{ + class cse_magrepack_finished + { + name="cse_magrepack_finished"; + sound[]={"\cse\cse_sys_equipment\magazineRepack\sound\magrepack_finished.wav",1,1}; + titles[]={}; + }; + class cse_magrepack_single + { + name="cse_magrepack_single"; + sound[]={"\cse\cse_sys_equipment\magazineRepack\sound\magrepack_single.wav",1,1}; + titles[]={}; + }; + + class cse_weaponrest_rest + { + name="cse_weaponrest_rest"; + sound[]={"\cse\cse_sys_equipment\weaponresting\sound\weaponrest_rest.wav",1,1}; + titles[]={}; + }; + class cse_weaponrest_unrest + { + name="cse_weaponrest_unrest"; + sound[]={"\cse\cse_sys_equipment\weaponresting\sound\weaponrest_unrest.wav",1,1}; + titles[]={}; + }; +}; \ No newline at end of file diff --git a/TO_MERGE/cse/sys_equipment/CfgVehicles.h b/TO_MERGE/cse/sys_equipment/CfgVehicles.h new file mode 100644 index 0000000000..f37c4dd6e9 --- /dev/null +++ b/TO_MERGE/cse/sys_equipment/CfgVehicles.h @@ -0,0 +1,224 @@ +class CfgVehicles +{ + class Land_HelipadEmpty_F; + class cse_LogicDummy: Land_HelipadEmpty_F + { + scope = 1; + slx_xeh_disabled = 1; + class EventHandlers { + init = "(_this select 0) enableSimulation false"; + }; + }; + + class Logic; + class Module_F: Logic { + class ArgumentsBaseUnits { + }; + }; + + class cse_sys_equipment: Module_F { + scope = 2; + displayName = "Equipment Options [CSE]"; + icon = "\cse\cse_main\data\cse_basic_module.paa"; + category = "cse_equipment"; + function = "cse_fnc_initalizeModule_F"; + functionPriority = 1; + isGlobal = 1; + isTriggerActivated = 0; + class Arguments { + class magazineRepack { + displayName = "Magazine Repack"; + description = "Lets players repack their magazines in the field"; + typeName = "BOOL"; + defaultValue = true; + }; + class attachableItems { + displayName = "Attachable Items"; + description = "Allows for attaching chemlights, IR strobes and the like"; + typeName = "BOOL"; + defaultValue = true; + }; + class weaponResting { + displayName = "Weapon Resting"; + description = "Allow players to rest their weapons and deploy bipods."; + typeName = "BOOL"; + defaultValue = true; + }; + class weaponSafety { + displayName = "Weapon Safety"; + description = "Allow players to put their weapons on safe."; + typeName = "BOOL"; + defaultValue = true; + }; + class adjustableNVG { + displayName = "NVG Adjustments"; + description = "Allow players to adjust their NVG brightness"; + typeName = "BOOL"; + defaultValue = true; + }; + class allowWeaponSelect { + displayName = "Weapon selection"; + description = "Allow players to select weapons through keybindings"; + typeName = "BOOL"; + defaultValue = true; + }; + class allowAmmoChecking { + displayName = "Ammo Checking"; + description = "Allow players to check their Ammunition"; + typeName = "BOOL"; + defaultValue = true; + }; + class hideAmmoValues { + displayName = "Hide Ammo"; + description = "Hide the Ammunition counter for players"; + typeName = "NUMBER"; + defaultValue = 0; + class values { + class enable { + name = "Yes"; + value = 1; + }; + class disable { + name = "No"; + value = 0; + default = 1; + }; + }; + }; + }; + class ModuleDescription { + description = "Various actions/equipment settings."; + sync[] = {}; + }; + }; + + // BACKWARDS COMPATABILITY MODULES PRESSENCE + class cse_sys_magazineRepack: Module_F { + scope = 1; // hidden for backwards compatability + displayName = "Magazine Repack [CSE]"; + icon = "\cse\cse_main\data\cse_basic_module.paa"; + category = "cse_equipment"; + function = "cse_fnc_initalizeModule_F"; + functionPriority = 1; + isGlobal = 1; + isTriggerActivated = 0; + class Arguments { + }; + class ModuleDescription { + description = "Lets players repack their magazines in the field"; + sync[] = {}; + }; + }; + class cse_sys_attachableItems: Module_F { + scope = 1; // hidden for backwards compatability + displayName = "Attachable Items [CSE]"; + icon = "\cse\cse_main\data\cse_basic_module.paa"; + category = "cse_equipment"; + function = "cse_fnc_initalizeModule_F"; + functionPriority = 1; + isGlobal = 1; + isTriggerActivated = 0; + class Arguments { + }; + class ModuleDescription { + description = "Allows for attaching chemlights, IR strobes and the like"; + sync[] = {}; + }; + }; + + class cse_sys_weaponrest: Module_F { + scope = 1; // hidden for backwards compatability + displayName = "Weapon Resting [CSE]"; + icon = "\cse\cse_main\data\cse_rifle_module.paa"; + category = "cse_equipment"; + function = "cse_fnc_initalizeModule_F"; + functionPriority = 1; + isGlobal = 1; + isTriggerActivated = 0; + class Arguments + { + + }; + }; + + class cse_sys_weaponsafety: Module_F { + scope = 1; // hidden for backwards compatability + displayName = "Weapon Safety [CSE]"; + icon = "\cse\cse_main\data\cse_rifle_module.paa"; + category = "cse_equipment"; + function = "cse_fnc_initalizeModule_F"; + functionPriority = 1; + isGlobal = 1; + isTriggerActivated = 0; + class Arguments + { + + }; + }; + + class cse_sys_nightvision: Module_F { + scope = 1; // hidden for backwards compatability + displayName = "Night Vision [CSE]"; + icon = "\cse\cse_main\data\cse_nvg_module.paa"; + category = "cse_equipment"; + function = "cse_fnc_initalizeModule_F"; + functionPriority = 1; + isGlobal = 1; + isTriggerActivated = 0; + class Arguments { + }; + }; + // END BACKWARDS COMPATABILITY + + + // curator modules + class cse_moduleGroundFlare_White: Module_F { + scope = 1; + scopeCurator = 2; + displayName = "White Flare (Ground)"; + icon = "\a3\Modules_F_Curator\Data\iconFlare_ca.paa"; + category = "Effects"; + function = "cse_fnc_moduleFlare_EQ"; + functionPriority = 1; + isGlobal = 1; + isTriggerActivated = 0; + author = "Combat Space Enhancement"; + ammo = "CSE_FlareWhite"; + class Arguments { + }; + class ModuleDescription { + description = "Places a white flare on the ground"; + sync[] = {}; + }; + }; + class cse_moduleGroundFlare_Red: cse_moduleGroundFlare_White { + displayName = "Red Flare (Ground)"; + ammo = "CSE_FlareRed"; + class Arguments { + }; + class ModuleDescription { + description = "Places a red flare on the ground"; + sync[] = {}; + }; + }; + class cse_moduleGroundFlare_Yellow: cse_moduleGroundFlare_White { + displayName = "Yellow Flare (Ground)"; + ammo = "CSE_FlareYellow"; + class Arguments { + }; + class ModuleDescription { + description = "Places a yellow flare on the ground"; + sync[] = {}; + }; + }; + class cse_moduleGroundFlare_Green: cse_moduleGroundFlare_White { + displayName = "Green Flare (Ground)"; + ammo = "CSE_FlareGreen"; + class Arguments { + }; + class ModuleDescription { + description = "Places a green flare on the ground"; + sync[] = {}; + }; + }; +}; \ No newline at end of file diff --git a/TO_MERGE/cse/sys_equipment/CfgWeapons.h b/TO_MERGE/cse/sys_equipment/CfgWeapons.h new file mode 100644 index 0000000000..2aa1cb1840 --- /dev/null +++ b/TO_MERGE/cse/sys_equipment/CfgWeapons.h @@ -0,0 +1,56 @@ +class CfgWeapons { + class GrenadeLauncher; + class Throw: GrenadeLauncher { + muzzles[] += {"CSE_FlareWhiteMuzzle", "CSE_FlareRedMuzzle", "CSE_FlareGreenMuzzle", "CSE_FlareYellowMuzzle", "CSE_RoadFlareWhiteMuzzle", "CSE_RoadFlareRedMuzzle", "CSE_RoadFlareGreenMuzzle", "CSE_RoadFlareYellowMuzzle"}; + class ThrowMuzzle; + class CSE_FlareWhiteMuzzle: ThrowMuzzle { + magazines[] = {"CSE_FlareWhite"}; + }; + class CSE_FlareRedMuzzle: ThrowMuzzle { + magazines[] = {"CSE_FlareRed"}; + }; + class CSE_FlareGreenMuzzle: ThrowMuzzle { + magazines[] = {"CSE_FlareGreen"}; + }; + class CSE_FlareYellowMuzzle: ThrowMuzzle { + magazines[] = {"CSE_FlareYellow"}; + }; + + class CSE_RoadFlareWhiteMuzzle: ThrowMuzzle { + magazines[] = {"CSE_RoadFlareWhite"}; + }; + class CSE_RoadFlareRedMuzzle: ThrowMuzzle { + magazines[] = {"CSE_RoadFlareRed"}; + }; + class CSE_RoadFlareGreenMuzzle: ThrowMuzzle { + magazines[] = {"CSE_RoadFlareGreen"}; + }; + class CSE_RoadFlareYellowMuzzle: ThrowMuzzle { + magazines[] = {"CSE_RoadFlareYellow"}; + }; + }; + + class Rifle_Base_F; + class Rifle_Long_Base_F; + class arifle_MX_Base_F; + class arifle_MX_SW_F: arifle_MX_Base_F + { + cse_bipod = 1; + }; + class LMG_Mk200_F: Rifle_Base_F + { + cse_bipod = 1; + }; + class LMG_Zafir_F: Rifle_Base_F + { + cse_bipod = 1; + }; + class LRR_base_F: Rifle_Long_Base_F + { + cse_bipod = 1; + }; + class GM6_base_F: Rifle_Long_Base_F + { + cse_bipod = 1; + }; +}; \ No newline at end of file diff --git a/TO_MERGE/cse/sys_equipment/Combat_Space_Enhancement.h b/TO_MERGE/cse/sys_equipment/Combat_Space_Enhancement.h new file mode 100644 index 0000000000..e1ae338102 --- /dev/null +++ b/TO_MERGE/cse/sys_equipment/Combat_Space_Enhancement.h @@ -0,0 +1,87 @@ +#define MENU_KEYBINDING 1 +#define ACTION_KEYBINDING 2 +#define CLIENT_SETTING 3 + +class Combat_Space_Enhancement { + class EventHandlers { + class PostInit_EventHandlers { + class cse_sys_equipment { + // init = " call compile preprocessFile 'cse\cse_sys_equipment\init_sys_equipment.sqf';"; + }; + }; + }; + class cfgModules { + class cse_sys_equipment { + init = "call compile preprocessFile 'cse\cse_sys_equipment\init_sys_equipment.sqf';"; + name = "Equipment Module"; + class EventHandlers { + class AllVehicles { + GetOut = "if (CSE_HIDE_AMMO_COUNTERS_EQ> 0) then { if (_this select 2 == player) then {0 = [] spawn { waituntil {vehicle player == player}; [true] call cse_fnc_hidEUnitInfoAmmo_EQ;};};};"; + }; + }; + }; + + // BACKWARDS COMPATABILITY MODULES + // Have to stay put, as cse_sys_equipment will make use of them. + // The modules themselves will be hidden. + class cse_sys_magazineRepack { + init = "call compile preprocessFile 'cse\cse_sys_equipment\scripts\register_magazine_repack_actions.sqf';"; + name = "Magazine Repack"; + disableConfigExecution = 1; + }; + class cse_sys_attachableItems { + init = "call compile preprocessFile 'cse\cse_sys_equipment\scripts\register_attachable_items_actions.sqf';"; + name = "Attachable Items"; + disableConfigExecution = 1; + }; + + class cse_sys_weaponrest { + init = "call compile preprocessFile 'cse\cse_sys_equipment\weaponresting\init_sys_weaponrest.sqf';"; + name = "Weapon Resting & Bipods"; + disableConfigExecution = 1; + class Configurations { + class cse_sys_weaponRestAction { + type = ACTION_KEYBINDING; + title = $STR_DEPLOY_WEAPON_REST_TTTLE; + description = $STR_DEPLOY_WEAPON_REST_DESC; + value[] = {56,1,2,2}; + onPressed = "[] call cse_fnc_keyPressed_WR;"; + }; + class cse_sys_weaponUnrestAction { + type = ACTION_KEYBINDING; + title = $STR_DEPLOY_WEAPON_UNREST_TTTLE; + description = $STR_DEPLOY_WEAPON_UNREST_DESC; + value[] = {0,0,0,0}; + onPressed = "[] call cse_fnc_actionReleaseWeapon_WR;"; + }; + }; + }; + class cse_sys_weaponsafety { + init = "call compile preprocessFile 'cse\cse_sys_equipment\weaponsafety\init_sys_weaponsafety.sqf';"; + name = "Weapon Safety"; + disableConfigExecution = 1; + }; + class cse_sys_nightvision { + init = "call compile preprocessFile 'cse\cse_sys_equipment\nvg\init_sys_nightvision.sqf';"; + name = "Night Vision"; + disableConfigExecution = 1; + class Configurations { + class cse_sys_nvgAdjustBrightness_UP { + type = ACTION_KEYBINDING; + title = $STR_INCREASE_NVG_BIRGHTNESS_TITLE; + description = $STR_INCREASE_NVG_BIRGHTNESS_DESC; + value[] = {201,0,0,1}; + onPressed = "[player,0.1] call cse_fnc_adjustBrightness_NVG;"; + }; + class cse_sys_nvgAdjustBrightness_DOWN { + type = ACTION_KEYBINDING; + title = $STR_DECREASE_NVG_BIRGHTNESS_TITLE; + description = $STR_DECREASE_NVG_BIRGHTNESS_DESC; + value[] = {209,0,0,1}; + onPressed = "[player,-0.1] call cse_fnc_adjustBrightness_NVG;"; + }; + }; + }; + + }; +}; \ No newline at end of file diff --git a/TO_MERGE/cse/sys_equipment/UI.h b/TO_MERGE/cse/sys_equipment/UI.h new file mode 100644 index 0000000000..11255d108c --- /dev/null +++ b/TO_MERGE/cse/sys_equipment/UI.h @@ -0,0 +1 @@ +#include "ui\rscTitles.h" \ No newline at end of file diff --git a/TO_MERGE/cse/sys_equipment/config.cpp b/TO_MERGE/cse/sys_equipment/config.cpp new file mode 100644 index 0000000000..106d0e6b37 --- /dev/null +++ b/TO_MERGE/cse/sys_equipment/config.cpp @@ -0,0 +1,59 @@ +class CfgPatches { + class cse_sys_equipment { + units[] = {"cse_moduleGroundFlare_White", "cse_moduleGroundFlare_Red","cse_moduleGroundFlare_Green","cse_moduleGroundFlare_Yellow"}; + weapons[] = {}; + requiredVersion = 0.1; + requiredAddons[] = {"A3_Modules_F", "A3_UI_F", "cse_main", "cse_gui", "cse_f_eh"}; + version = "0.10.0_rc"; + author[] = {"Combat Space Enhancement"}; + website = "csemod.com"; + }; + class cse_sys_magazineRepack { + units[] = {}; + weapons[] = {}; + requiredVersion = 1.0; + requiredAddons[] = {"cse_f_eh","cse_main"}; + versionDesc = "CSE Magazine Repack"; + version = "0.10.0_rc"; + author[] = {"Combat Space Enhancement"}; + authorUrl = "http://csemod.com"; + }; + class cse_sys_weaponrest { + units[] = {}; + weapons[] = {}; + requiredVersion = 1.0; + requiredAddons[] = {"cse_f_eh","cse_main", "A3_Weapons_F", "A3_Weapons_F_Rifles_MX"}; + versionDesc = "CSE Weapon Resting"; + version = "0.10.0_rc"; + author[] = {"Combat Space Enhancement", "Tupolov", "Glowbal"}; + authorUrl = "http://csemod.com"; + }; + class cse_sys_nightvision { + units[] = {}; + weapons[] = {}; + requiredVersion = 1.0; + requiredAddons[] = {"cse_f_eh","cse_main"}; + versionDesc = "CSE Night Vision"; + version = "0.10.0_rc"; + author[] = {"Combat Space Enhancement"}; + authorUrl = "http://csemod.com"; + }; +}; + +class CfgAddons { + class PreloadAddons { + class cse_sys_equipment { + list[] = {"cse_sys_equipment", "cse_sys_magazineRepack", "cse_sys_weaponrest", "cse_sys_nightvision"}; + }; + }; +}; +#include "Combat_Space_Enhancement.h" +#include "CfgFactionClasses.h" +#include "CfgVehicles.h" +#include "CfgFunctions.h" +#include "CfgSounds.h" +#include "CfgAmmo.h" +#include "CfgWeapons.h" +#include "CfgMovesBasic.h" +#include "CfgMovesMaleSdr.h" +#include "UI.h" \ No newline at end of file diff --git a/TO_MERGE/cse/sys_equipment/functions/fn_areEquipmentOptionsAvailable_EQ.sqf b/TO_MERGE/cse/sys_equipment/functions/fn_areEquipmentOptionsAvailable_EQ.sqf new file mode 100644 index 0000000000..4a805582ce --- /dev/null +++ b/TO_MERGE/cse/sys_equipment/functions/fn_areEquipmentOptionsAvailable_EQ.sqf @@ -0,0 +1,19 @@ +/** + * fn_areEquipmentOptionsAvailable_EQ.sqf + * @Descr: N/A + * @Author: Glowbal + * + * @Arguments: [] + * @Return: + * @PublicAPI: false + */ + +private ["_return","_equipOpt"]; +_return = false; +_equipOpt = ([] call cse_fnc_getAllEquipmentOptions_EQ); +{ + if (_this call (_x select 1)) exitwith { + _return = true; + }; +}foreach _equipOpt; +_return \ No newline at end of file diff --git a/TO_MERGE/cse/sys_equipment/functions/fn_attachItem_EQ.sqf b/TO_MERGE/cse/sys_equipment/functions/fn_attachItem_EQ.sqf new file mode 100644 index 0000000000..570bc37d33 --- /dev/null +++ b/TO_MERGE/cse/sys_equipment/functions/fn_attachItem_EQ.sqf @@ -0,0 +1,55 @@ +/** + * fn_attachItem_EQ.sqf + * @Descr: Attach an item of given classname. + * @Author: Glowbal + * + * @Arguments: [unit OBJECT, item STRING (Classname of magazine item)] + * @Return: nil + * @PublicAPI: true + */ + +private ["_unit","_chemlight","_isStrobeLight", "_light"]; +_unit = [_this, 0, objNull, [objNull]] call BIS_fnc_Param; +_item = [_this, 1, "", [""]] call BIS_fnc_Param; + +[format["Attach item: %1",_this]] call cse_fnc_debug; + +if (!isNull(_unit getvariable ["cse_attachedItem_EQ",objNull])) exitwith {}; +if !([_unit,_item] call cse_fnc_hasMagazine) exitwith{}; +if !([_item] call cse_fnc_isAttachableItem_EQ) exitwith{}; + +_unit setvariable ["cse_attachedItemClassName_EQ", _item]; + +_isStrobeLight = switch (_item) do { + case "B_IR_Grenade": {true}; + case "I_IR_Grenade": {true}; + case "O_IR_Grenade": {true}; + default {false}; +}; +if (_isStrobeLight) then { + _light = (toString [(toArray _item) select 0] + "_IRStrobe") createVehicle (getPos _unit); +} else { + _light = _item createVehicle (getPos _unit); +}; + +if (!isNull _light) then { + [_unit,_item] call cse_fnc_useMagazine; + _light attachTo [_unit,[0.1,-0.1,-0.1],"head"]; + _unit setvariable["cse_attachedItem_EQ",_light,true]; +}; + + + +[_unit, _light] spawn { + _unit = _this select 0; + _light = _this select 1; + while {((alive _light) && !isNull(_unit getvariable ["cse_attachedItem_EQ",objNull]) && alive _unit)} do { + if (vehicle _unit != _unit) then { + _positionInWorld = _unit modelToWorld (_unit selectionPosition "head"); + _vehPos = (vehicle _unit) worldToModel _positionInWorld; + _light attachTo [(vehicle _unit),_vehPos]; + } else { + _light attachTo [_unit,[0.1,-0.1,-0.1],"head"]; + }; + }; +}; diff --git a/TO_MERGE/cse/sys_equipment/functions/fn_detachItem_EQ.sqf b/TO_MERGE/cse/sys_equipment/functions/fn_detachItem_EQ.sqf new file mode 100644 index 0000000000..e962f9b2ea --- /dev/null +++ b/TO_MERGE/cse/sys_equipment/functions/fn_detachItem_EQ.sqf @@ -0,0 +1,49 @@ +/** + * fn_detachItem_EQ.sqf + * @Descr: Detach current attached item and add it back to the magazines list of the unit. + * @Author: Glowbal + * + * @Arguments: [unit OBJECT] + * @Return: BOOL True if succesful. + * @PublicAPI: true + */ + +private ["_unit","_chemlight","_isStrobeLight", "_light","_item", "_originalCount"]; +_unit = [_this, 0, objNull, [objNull]] call BIS_fnc_Param; + +_item = _unit getvariable ["cse_attachedItem_EQ",objNull]; +_unit setvariable["cse_attachedItem_EQ",nil,true]; + +if (isNull _item) exitwith {true}; +_isStrobeLight = switch (typeOf _item) do { + case "B_IRStrobe": {true}; + case "I_IRStrobe": {true}; + case "O_IRStrobe": {true}; + default {false}; +}; +if (_isStrobeLight) then { + _light = switch (typeOf _item) do { + case "B_IRStrobe": {"B_IR_Grenade"}; + case "I_IRStrobe": {"I_IR_Grenade"}; + case "O_IRStrobe": {"O_IR_Grenade"}; + }; +} else { + _light = typeOf _item; +}; +[format ["Detaching %1 %2", _unit, _light]] call cse_fnc_debug; + _originalCount = ({_x == _light} count magazines _unit); + +_unit addMagazine [_light, 1]; +if ((_originalCount + 1) < ({_x == _light} count magazines _unit)) then { + _unit removeMagazine _light; +}; +detach _item; + +if (_isStrobeLight) then { + _item setPos [-10000,-10000,-10000]; + + // sleeping to ensure the IR strobe effect is properly gone before we delete the source. + sleep 5; +}; +deleteVehicle _item; +true; \ No newline at end of file diff --git a/TO_MERGE/cse/sys_equipment/functions/fn_dropFlare_EQ.sqf b/TO_MERGE/cse/sys_equipment/functions/fn_dropFlare_EQ.sqf new file mode 100644 index 0000000000..b7e94e91f0 --- /dev/null +++ b/TO_MERGE/cse/sys_equipment/functions/fn_dropFlare_EQ.sqf @@ -0,0 +1,32 @@ +/** + * fn_dropFlare_EQ.sqf + * @Descr: Drop a flare object + * @Author: Glowbal + * + * @Arguments: [unit OBJECT, flare STRING (Classname of the flare or fusee)] + * @Return: OBJECT The created flare. Objnull if failure. + * @PublicAPI: true + */ + +private ["_unit", "_item", "_flareObj"]; +_unit = [_this, 0, objNull, [objNull]] call BIS_fnc_Param; +_item = [_this, 1, "", [""]] call BIS_fnc_Param; + +_continue = switch (_item) do { + case "CSE_FlareWhite": {true}; + case "CSE_FlareRed": {true}; + case "CSE_FlareGreen": {true}; + case "CSE_FlareYellow": {true}; + case "CSE_RoadFlareWhite": {true}; + case "CSE_RoadFlareRed": {true}; + case "CSE_RoadFlareGreen": {true}; + case "CSE_RoadFlareYellow": {true}; + default {false}; +}; +if (!_continue) exitwith {objNull}; +if (_unit isKindof "CAManBAse") then { + [_unit, _item] call cse_fnc_useMagazine; +}; +_flareObj = _item createVehicle getPos _unit; + +_flareObj \ No newline at end of file diff --git a/TO_MERGE/cse/sys_equipment/functions/fn_getAllEquipmentOptions_EQ.sqf b/TO_MERGE/cse/sys_equipment/functions/fn_getAllEquipmentOptions_EQ.sqf new file mode 100644 index 0000000000..ad4d42b68e --- /dev/null +++ b/TO_MERGE/cse/sys_equipment/functions/fn_getAllEquipmentOptions_EQ.sqf @@ -0,0 +1,22 @@ +/** + * fn_getAllEquipmentOptions_EQ.sqf + * @Descr: N/A + * @Author: Glowbal + * + * @Arguments: [] + * @Return: + * @PublicAPI: false + */ + +private["_return"]; +_return = []; +if (isnil "CSE_EQUIPMENT_OPTIONS_EQ") then { + CSE_EQUIPMENT_OPTIONS_EQ = _return; +}; +/* +{ + _return set [count _return, _x]; +}foreach CSE_EQUIPMENT_OPTIONS_EQ; +*/ +_return = + CSE_EQUIPMENT_OPTIONS_EQ; +_return \ No newline at end of file diff --git a/TO_MERGE/cse/sys_equipment/functions/fn_getPercentageAmmoMagazine_EQ.sqf b/TO_MERGE/cse/sys_equipment/functions/fn_getPercentageAmmoMagazine_EQ.sqf new file mode 100644 index 0000000000..46455c4066 --- /dev/null +++ b/TO_MERGE/cse/sys_equipment/functions/fn_getPercentageAmmoMagazine_EQ.sqf @@ -0,0 +1,27 @@ +/** + * fn_getPercentageAmmoMagazine_EQ.sqf + * @Descr: Get percentage of ammo in currentMagazine left. + * @Author: Glowbal + * + * @Arguments: [unit OBJECT] + * @Return: NUMBER A number between 100 and 0, with 100 being a full magazine and 0 being empty (No ammo left). + * @PublicAPI: true + */ + +private ["_unit", "_percentage", "_maxAmmoCount", "_currentAmmoCount"]; +_unit = _this select 0; +_percentage = 0; + +if (currentWeapon _unit != "") then { + { + if (_x select 4 == currentMuzzle _unit) exitWith { + _currentAmmoCount = _x select 1; + _maxAmmoCount = getNumber(configFile >> "CfgMagazines" >> (_x select 0) >> "count"); + if (_maxAmmoCount > 0) then { + _percentage = (_currentAmmoCount / _maxAmmoCount) * 100; + }; + }; + } forEach (magazinesAmmoFull _unit); +}; + +_percentage diff --git a/TO_MERGE/cse/sys_equipment/functions/fn_hasAttachableItem_EQ.sqf b/TO_MERGE/cse/sys_equipment/functions/fn_hasAttachableItem_EQ.sqf new file mode 100644 index 0000000000..a130e32ef6 --- /dev/null +++ b/TO_MERGE/cse/sys_equipment/functions/fn_hasAttachableItem_EQ.sqf @@ -0,0 +1,20 @@ +/** + * fn_hasAttachableItem_EQ.sqf + * @Descr: Check if unit has an attachable Item. + * @Author: Glowbal + * + * @Arguments: [unit OBJECT] + * @Return: BOOL + * @PublicAPI: true + */ + +private ["_unit","_return"]; +_unit = _this select 0; +_return = false; +{ + if ([_x] call cse_fnc_isAttachableItem_EQ) exitwith { + _return = true; + }; +}foreach (magazines _unit); + +_return \ No newline at end of file diff --git a/TO_MERGE/cse/sys_equipment/functions/fn_hasFlare_EQ.sqf b/TO_MERGE/cse/sys_equipment/functions/fn_hasFlare_EQ.sqf new file mode 100644 index 0000000000..f8579d2f97 --- /dev/null +++ b/TO_MERGE/cse/sys_equipment/functions/fn_hasFlare_EQ.sqf @@ -0,0 +1,19 @@ +/** + * fn_hasFlare_EQ.sqf + * @Descr: Check if given unit has a flare. + * @Author: Glowbal + * + * @Arguments: [unit OBJECT] + * @Return: BOOL + * @PublicAPI: true + */ + +private[ "_unit", "_return"]; +_unit = [_this, 0, objNull, [objNull]] call BIS_fnc_Param; +if !(_unit isKindof "CAManBase") exitwith {false}; +_return = false; +{ + if ([_x] call cse_fnc_isFlare_EQ) exitwith {_return = true;}; +}foreach (magazines _unit); + +_return \ No newline at end of file diff --git a/TO_MERGE/cse/sys_equipment/functions/fn_hasItemAttached_EQ.sqf b/TO_MERGE/cse/sys_equipment/functions/fn_hasItemAttached_EQ.sqf new file mode 100644 index 0000000000..2a32cd4d8a --- /dev/null +++ b/TO_MERGE/cse/sys_equipment/functions/fn_hasItemAttached_EQ.sqf @@ -0,0 +1,15 @@ +/** + * fn_hasItemAttached_EQ.sqf + * @Descr: Check if unit has an item attached + * @Author: Glowbal + * + * @Arguments: [unit OBJECT] + * @Return: BOOL + * @PublicAPI: true + */ + +private ["_unit", "_item"]; +_unit = _this select 0; +_item = _unit getvariable ["cse_attachedItem_EQ",objNull]; + +(!isNull _item); \ No newline at end of file diff --git a/TO_MERGE/cse/sys_equipment/functions/fn_hideUnitInfoAmmo_EQ.sqf b/TO_MERGE/cse/sys_equipment/functions/fn_hideUnitInfoAmmo_EQ.sqf new file mode 100644 index 0000000000..233709a562 --- /dev/null +++ b/TO_MERGE/cse/sys_equipment/functions/fn_hideUnitInfoAmmo_EQ.sqf @@ -0,0 +1,39 @@ +/** + * fn_hideUnitInfoAmmo_EQ.sqf + * @Descr: Hide the unitInfo ammo related parts. Credits Vladimir Hynek (BI Dev) for original code from BIS_fnc_showUnitInfo + * @Author: Glowbal + * + * @Arguments: [hide BOOL] + * @Return: nil + * @PublicAPI: true + */ + +private ["_hide"]; +_hide = [_this, 0, true, [true]] call BIS_fnc_param; +[format["Hiding unitAmmoInfo %1", _hide]] call cse_fnc_debug; +disableSerialization; +{ + if((ctrlIDD _x) == 300) then + { + private ["_unitInfoDisplay"]; + _unitInfoDisplay = _x; + + { + if (_x in [184, 185, 151]) then { + private ["_ctrl"]; + _ctrl = _unitInfoDisplay displayCtrl _x; + + if(_hide) then + { + _ctrl ctrlSetFade 1; + } + else + { + _ctrl ctrlSetFade 0; + }; + + _ctrl ctrlCommit 0; + }; + } foreach ([(configfile >> "RscInGameUI" >> "RscUnitInfo"), 0] call bis_fnc_displaycontrols); + }; +} foreach (uinamespace getvariable "IGUI_displays"); //RscUnitInfo can be present several times for some reason diff --git a/TO_MERGE/cse/sys_equipment/functions/fn_isAttachableItem_EQ.sqf b/TO_MERGE/cse/sys_equipment/functions/fn_isAttachableItem_EQ.sqf new file mode 100644 index 0000000000..74bb063199 --- /dev/null +++ b/TO_MERGE/cse/sys_equipment/functions/fn_isAttachableItem_EQ.sqf @@ -0,0 +1,23 @@ +/** + * fn_isAttachableItem_EQ.sqf + * @Descr: Check if item is an attachable Item. + * @Author: Glowbal + * + * @Arguments: [item STRING (Classname of item)] + * @Return: BOOL + * @PublicAPI: false + */ + +private ["_chemlight","_return"]; +_chemlight = _this select 0; +_return = switch (_chemlight) do { + case "Chemlight_blue": {true}; + case "Chemlight_red": {true}; + case "Chemlight_green": {true}; + case "Chemlight_yellow": {true}; + case "B_IR_Grenade": {true}; + case "I_IR_Grenade": {true}; + case "O_IR_Grenade": {true}; + default {false}; +}; +_return \ No newline at end of file diff --git a/TO_MERGE/cse/sys_equipment/functions/fn_isFlare_EQ.sqf b/TO_MERGE/cse/sys_equipment/functions/fn_isFlare_EQ.sqf new file mode 100644 index 0000000000..5445e191be --- /dev/null +++ b/TO_MERGE/cse/sys_equipment/functions/fn_isFlare_EQ.sqf @@ -0,0 +1,25 @@ +/** + * fn_isFlare_EQ.sqf + * @Descr: Check if given classname is a CSE Flare + * @Author: Glowbal + * + * @Arguments: [classname STRING (Magazine classname to check)] + * @Return: BOOL True if classname is a flare. + * @PublicAPI: true + */ + +private ["_classname", "_return"]; +_classname = [_this, 0, "", [""]] call BIS_fnc_Param; +_return = switch (_classname) do { + case "CSE_FlareWhite": {true}; + case "CSE_FlareRed": {true}; + case "CSE_FlareGreen": {true}; + case "CSE_FlareYellow": {true}; + case "CSE_RoadFlareWhite": {true}; + case "CSE_RoadFlareRed": {true}; + case "CSE_RoadFlareGreen": {true}; + case "CSE_RoadFlareYellow": {true}; + default {false}; +}; + +_return \ No newline at end of file diff --git a/TO_MERGE/cse/sys_equipment/functions/fn_moduleFlare_EQ.sqf b/TO_MERGE/cse/sys_equipment/functions/fn_moduleFlare_EQ.sqf new file mode 100644 index 0000000000..82a43966ee --- /dev/null +++ b/TO_MERGE/cse/sys_equipment/functions/fn_moduleFlare_EQ.sqf @@ -0,0 +1,39 @@ +/** + * fn_moduleFlare_EQ.sqf + * @Descr: N/A + * @Author: Glowbal + * + * @Arguments: [] + * @Return: + * @PublicAPI: false + */ + +private ["_logic", "_className", "_cfg", "_ammo", "_flare"]; +_logic = [_this,0,objNull,[objNull]] call BIS_fnc_param; + +if (!isNull _logic) then { + _className = typeOf _logic; + _cfg = (ConfigFile >> "CfgVehicles" >> _className); + _ammo = getText(_cfg >> "ammo"); + if (_ammo != "") then { + _flare = [_logic, _ammo] call cse_fnc_dropFlare_EQ; + if (isnull _flare) then { + deleteVehicle _logic; + deleteVehicle _flare; + } else { + _logic setvariable ["cse_droppedFlare", _flare]; + + { + if !(_x getvariable ["CSE_CURATOR_ADDITIONAL_EQ", false]) then { + _x setvariable ["CSE_CURATOR_ADDITIONAL_EQ", true]; + _X addEventHandler["CuratorObjectDeleted", { + _obj = _this select 1; + if !(isNull (_obj getvariable ["cse_droppedFlare", objNull])) then { + deleteVehicle (_obj getvariable ["cse_droppedFlare", objNull]); + }; + }]; + }; + }foreach objectCurators _logic; + }; + }; +}; \ No newline at end of file diff --git a/TO_MERGE/cse/sys_equipment/functions/fn_putWeaponOnBack_EQ.sqf b/TO_MERGE/cse/sys_equipment/functions/fn_putWeaponOnBack_EQ.sqf new file mode 100644 index 0000000000..63d1af890b --- /dev/null +++ b/TO_MERGE/cse/sys_equipment/functions/fn_putWeaponOnBack_EQ.sqf @@ -0,0 +1,17 @@ +/** + * fn_putWeaponOnBack_EQ.sqf + * @Descr: Put unit weapon on the back. + * @Author: Glowbal + * + * @Arguments: [unit OBJECT] + * @Return: void + * @PublicAPI: true + */ + +#define MUZZLE_INDEX 100 + +private ["_unit"]; +_unit = _this select 0; +_unit action ["SwitchWeapon", _unit, _unit, MUZZLE_INDEX]; + +nil; \ No newline at end of file diff --git a/TO_MERGE/cse/sys_equipment/functions/fn_registerNewEquipmentOption_EQ.sqf b/TO_MERGE/cse/sys_equipment/functions/fn_registerNewEquipmentOption_EQ.sqf new file mode 100644 index 0000000000..8754bbdc24 --- /dev/null +++ b/TO_MERGE/cse/sys_equipment/functions/fn_registerNewEquipmentOption_EQ.sqf @@ -0,0 +1,30 @@ +/** + * fn_registerNewEquipmentOption_EQ.sqf + * @Descr: N/A + * @Author: Glowbal + * + * @Arguments: [] + * @Return: + * @PublicAPI: false + */ + +private ["_name","_condition","_code"]; +_name = _this select 0; +_condition = _this select 1; +_code = _this select 2; + +if (typeName _name != typeName "" || typeName _condition != typeName {} || typeName _code != typeName{}) exitwith {}; + +if (isnil "CSE_REGISTERING_EQUIPMENT_OPTION") then { + CSE_REGISTERING_EQUIPMENT_OPTION = false; +}; +sleep (random(0.5)); +waituntil {!CSE_REGISTERING_EQUIPMENT_OPTION}; +CSE_REGISTERING_EQUIPMENT_OPTION = true; + +if (isnil "CSE_EQUIPMENT_OPTIONS_EQ") then { + CSE_EQUIPMENT_OPTIONS_EQ = []; +}; +CSE_EQUIPMENT_OPTIONS_EQ pushback [_name,_condition,_code]; + +CSE_REGISTERING_EQUIPMENT_OPTION = false; \ No newline at end of file diff --git a/TO_MERGE/cse/sys_equipment/init_sys_equipment.sqf b/TO_MERGE/cse/sys_equipment/init_sys_equipment.sqf new file mode 100644 index 0000000000..a5687141eb --- /dev/null +++ b/TO_MERGE/cse/sys_equipment/init_sys_equipment.sqf @@ -0,0 +1,88 @@ +/* + NAME: init + USAGE: + AUTHOR: Glowbal + RETURN: void + +*/ + +waituntil{!isnil "cse_gui"}; +cse_equip_module = true; +_allowMagazineRepack = true; +_haveAttachableItems = true; +_allowWeaponRest = false; +_allowWeaponSafety = false; +_nvgBrightness = false; +_allowSelectWeaponKeybindings = false; +_allowCheckAmmoKeybindings = false; +CSE_HIDE_AMMO_COUNTERS_EQ = 0; + +_args = _this; +{ + _value = _x select 1; + if (!isnil "_value") then { + _name = _x select 0; + if (_name == "magazineRepack") exitwith { + _allowMagazineRepack = _value; + }; + if (_name == "attachableItems") exitwith { + _haveAttachableItems = _value; + }; + if (_name == "weaponResting") exitwith { + _allowWeaponRest = _value; + }; + if (_name == "weaponSafety") exitwith { + _allowWeaponSafety = _value; + }; + if (_name == "adjustableNVG") exitwith { + _nvgBrightness = _value; + }; + if (_name == "allowWeaponSelect") exitwith { + _allowSelectWeaponKeybindings = _value; + }; + if (_name == "allowAmmoChecking") exitwith { + _allowCheckAmmoKeybindings = _value; + }; + if (_name == "hideAmmoValues") exitwith { + CSE_HIDE_AMMO_COUNTERS_EQ = _value; + }; + }; +}foreach _args; + +if (_allowSelectWeaponKeybindings) then { + #include "scripts\select_weapon_keybindings.sqf" +}; + +if (_allowCheckAmmoKeybindings) then { + #include "scripts\check_ammo_keybindings.sqf" +}; + +if (_haveAttachableItems) then { + #include "scripts\register_attachable_items_actions.sqf" +}; + +if (_allowMagazineRepack) then { + #include "scripts\register_magazine_repack_actions.sqf" +}; + +if (_allowWeaponSafety) then { + ["cse_sys_weaponsafety", []] call cse_fnc_enableModule_f; +}; + +if (_allowWeaponRest) then { + ["cse_sys_weaponrest", []] call cse_fnc_enableModule_f; +}; + +if (_nvgBrightness) then { + ["cse_sys_nightvision", []] call cse_fnc_enableModule_f; +}; + +[format["EQUIP - EQUIPMENT module initialised"],2] call cse_fnc_debug; + +if (CSE_HIDE_AMMO_COUNTERS_EQ > 0) then { + waituntil {!isnil "cse_gui"}; + sleep 0.5; + if (vehicle player == player) then { + [true] call cse_fnc_hideUnitInfoAmmo_EQ; + }; +}; \ No newline at end of file diff --git a/TO_MERGE/cse/sys_equipment/magazineRepack/functions/fn_repackMagazines.sqf b/TO_MERGE/cse/sys_equipment/magazineRepack/functions/fn_repackMagazines.sqf new file mode 100644 index 0000000000..24224a01c7 --- /dev/null +++ b/TO_MERGE/cse/sys_equipment/magazineRepack/functions/fn_repackMagazines.sqf @@ -0,0 +1,105 @@ +/** + * fn_repackMagazines.sqf + * @Descr: Repacks all magazines of given type for a unit + * @Author: Ruthberg + * + * @Arguments: [unit OBJECT, classname STRING] + * @Return: + * @PublicAPI: true + */ + +#define MAGAZINE_ACCESS_DELAY 3.0 +#define AMMO_REPACK_DELAY 2.0 + +private ["_unit", "_className", "_magazineCapacity", "_magazines", "_repackableAmmoCount", "_repackableMagazinesCount", "_repackableMagazinesAmmoCounts", "_magazineClassName", "_magazineAmmoCount", "_amountOfFillableMagazines", "_workLoad", "_totalRepackTime", "_firstIndex", "_lastIndex", "_startTime", "_greatestAmmoCount", "_smallestAmmoCount"]; +_unit = [_this, 0, objNull, [objNull]] call BIS_fnc_param; +_className = [_this, 1, "", [""]] call bis_fnc_param; + +if (isNull _unit || _className == "") exitwith {}; +if (vehicle _unit != _unit && {driver (vehicle _unit) == _unit || commander (vehicle _unit) == _unit || gunner (vehicle _unit) == _unit}) exitWith {}; + +if (vehicle _unit == _unit && currentWeapon _unit != "" && !(weaponLowered _unit) && (stance player != "PRONE")) then { + _unit action ["WeaponOnBack", _unit]; + waitUntil { weaponLowered _unit }; // probably evil +}; + +_magazineCapacity = getNumber(configFile >> "CfgMagazines" >> _className >> "count"); + +_magazines = magazinesAmmo _unit; +_repackableAmmoCount = 0; +_repackableMagazinesCount = 0; +_repackableMagazinesAmmoCounts = []; +{ + _magazineClassName = (_x select 0); + _magazineAmmoCount = (_x select 1); + if (_magazineClassName == _className && _magazineAmmoCount < _magazineCapacity) then { + // sums the amount of remaining ammo in all used magazines + _repackableAmmoCount = _repackableAmmoCount + _magazineAmmoCount; + _repackableMagazinesCount = _repackableMagazinesCount + 1; + _repackableMagazinesAmmoCounts pushBack _magazineAmmoCount; + }; +} forEach _magazines; + +if (_repackableMagazinesCount < 2) exitWith {}; + +[getText(configFile >> "CfgMagazines" >> _className >> "displayName"), ["Starting magazine repack"], 0] call cse_fnc_gui_displayInformation; + +_amountOfFillableMagazines = floor(_repackableAmmoCount / _magazineCapacity); + +_repackableMagazinesAmmoCounts = [_repackableMagazinesAmmoCounts, false] call cse_fnc_insertionSort; + +_workLoad = 0; // amount of ammo that needs to be repacked +for "_i" from 0 to _amountOfFillableMagazines - 1 do { + _workLoad = _workLoad + (_magazineCapacity - (_repackableMagazinesAmmoCounts select _i)); +}; + +CSE_ORIGINAL_POSITION_MAG_REPACK_EQ = getPos _unit; +CSE_CONDITION_MAG_REPACK_EQ = {((vehicle player != player && driver (vehicle player) != player && commander (vehicle player) != player && gunner (vehicle player) != player) || (((getPos player) distance CSE_ORIGINAL_POSITION_MAG_REPACK_EQ) < 1 && (weaponLowered player) || (stance player == "PRONE")))}; +CSE_RUNNING_MAG_REPACK_EQ = true; +_totalRepackTime = MAGAZINE_ACCESS_DELAY * (count _repackableMagazinesAmmoCounts) + AMMO_REPACK_DELAY * _workLoad; +_totalRepackTime spawn { + CSE_RUNNING_MAG_REPACK_EQ = [_this, CSE_CONDITION_MAG_REPACK_EQ] call cse_fnc_gui_loadingBar; +}; + +_startTime = diag_tickTime; waitUntil {diag_tickTime - _startTime > MAGAZINE_ACCESS_DELAY}; +_firstIndex = 0; +_lastIndex = _repackableMagazinesCount - 1; +while {CSE_RUNNING_MAG_REPACK_EQ && _lastIndex > _firstIndex} do { + _greatestAmmoCount = _repackableMagazinesAmmoCounts select _firstIndex; + _smallestAmmoCount = _repackableMagazinesAmmoCounts select _lastIndex; + + _startTime = diag_tickTime; waitUntil {diag_tickTime - _startTime > AMMO_REPACK_DELAY / 2.0}; + if (!CSE_RUNNING_MAG_REPACK_EQ) exitWith {}; + playSound "cse_magrepack_single"; + _repackableMagazinesAmmoCounts set [_lastIndex, _smallestAmmoCount - 1]; + _startTime = diag_tickTime; waitUntil {diag_tickTime - _startTime > AMMO_REPACK_DELAY / 2.0}; + if (!CSE_RUNNING_MAG_REPACK_EQ) exitWith {}; + playSound "cse_magrepack_finished"; + _repackableMagazinesAmmoCounts set [_firstIndex, _greatestAmmoCount + 1]; + + // Skip full magazines + if (_repackableMagazinesAmmoCounts select _firstIndex == _magazineCapacity) then { + _startTime = diag_tickTime; waitUntil {diag_tickTime - _startTime > MAGAZINE_ACCESS_DELAY}; + _firstIndex = _firstIndex + 1; + [getText(configFile >> "CfgMagazines" >> _className >> "displayName"), [format["Finished repacking (%1/%2) magazines", _firstIndex, _amountOfFillableMagazines]], 0] call cse_fnc_gui_displayInformation; + }; + // Skip empty magazines + if (_repackableMagazinesAmmoCounts select _lastIndex == 0) then { + _startTime = diag_tickTime; waitUntil {diag_tickTime - _startTime > MAGAZINE_ACCESS_DELAY}; + _lastIndex = _lastIndex - 1; + }; +}; + +// Apply changes +for "_i" from 1 to _repackableMagazinesCount do { + _unit removeMagazine _className; +}; +for "_i" from 0 to _lastIndex do { + _unit addMagazine [_className, _repackableMagazinesAmmoCounts select _i]; +}; + +if (_firstIndex >= _lastIndex) then { + [getText(configFile >> "CfgMagazines" >> _className >> "displayName"), ["Completed magazine repack"], 0] call cse_fnc_gui_displayInformation; +} else { + [getText(configFile >> "CfgMagazines" >> _className >> "displayName"), ["Aborted magazine repack"], 0] call cse_fnc_gui_displayInformation; +}; diff --git a/TO_MERGE/cse/sys_equipment/magazineRepack/functions/fn_repackMagazinesAll.sqf b/TO_MERGE/cse/sys_equipment/magazineRepack/functions/fn_repackMagazinesAll.sqf new file mode 100644 index 0000000000..5de419f683 --- /dev/null +++ b/TO_MERGE/cse/sys_equipment/magazineRepack/functions/fn_repackMagazinesAll.sqf @@ -0,0 +1,20 @@ +/** + * fn_repackMagazinesAll.sqf + * @Descr: Repacks all magazines of a unit + * @Author: Glowbal, Ruthberg + * + * @Arguments: [unit OBJECT] + * @Return: nil + * @PublicAPI: true + */ + +private ["_unit", "_passedMags"]; +_unit = _this select 0; + +_passedMags = []; +{ + if (!((_x select 0) in _passedMags)) then { + _passedMags pushback (_x select 0); + [_unit, (_x select 0)] call cse_fnc_repackMagazines; + }; +} forEach (magazinesAmmo _unit); diff --git a/TO_MERGE/cse/sys_equipment/magazineRepack/sound/magrepack_finished.wav b/TO_MERGE/cse/sys_equipment/magazineRepack/sound/magrepack_finished.wav new file mode 100644 index 0000000000..ab73615a55 Binary files /dev/null and b/TO_MERGE/cse/sys_equipment/magazineRepack/sound/magrepack_finished.wav differ diff --git a/TO_MERGE/cse/sys_equipment/magazineRepack/sound/magrepack_single.wav b/TO_MERGE/cse/sys_equipment/magazineRepack/sound/magrepack_single.wav new file mode 100644 index 0000000000..5d94e215fd Binary files /dev/null and b/TO_MERGE/cse/sys_equipment/magazineRepack/sound/magrepack_single.wav differ diff --git a/TO_MERGE/cse/sys_equipment/nvg/functions/fn_adjustBrightness_NVG.sqf b/TO_MERGE/cse/sys_equipment/nvg/functions/fn_adjustBrightness_NVG.sqf new file mode 100644 index 0000000000..f75fd52c9f --- /dev/null +++ b/TO_MERGE/cse/sys_equipment/nvg/functions/fn_adjustBrightness_NVG.sqf @@ -0,0 +1,32 @@ +/** + * fn_adjustBrightness_NVG.sqf + * @Descr: N/A + * @Author: Glowbal + * + * @Arguments: [] + * @Return: + * @PublicAPI: false + */ + +private ["_unit","_increase","_currentBrightness","_newBrightness"]; +_unit = [_this,0,ObjNull,[ObjNUll]] call BIS_fnc_Param; +_increase = [_this, 1, 0,[0]] call BIS_fnc_Param; +_currentBrightness = _unit getVariable ["cse_sys_nightvision_brightness", 1]; + +_newBrightness = _currentBrightness + _increase; +if (_newBrightness < -0.1) then { + _newBrightness = -0.1; +} else { + if (_newBrightness > 2) then { + _newBrightness = 2; + }; +}; +_unit setVariable ["cse_sys_nightvision_brightness", _newBrightness]; + +if (_newBrightness != _currentBrightness) then { + if (_increase > 0) then { + hintSilent "Increased NVG Brightness"; + } else { + hintSilent "decreased NVG Brightness"; + }; +}; \ No newline at end of file diff --git a/TO_MERGE/cse/sys_equipment/nvg/init_sys_nightvision.sqf b/TO_MERGE/cse/sys_equipment/nvg/init_sys_nightvision.sqf new file mode 100644 index 0000000000..9df0185f27 --- /dev/null +++ b/TO_MERGE/cse/sys_equipment/nvg/init_sys_nightvision.sqf @@ -0,0 +1,51 @@ +#define PP_EFFECT_GRAIN_INTENSITVE 0.25 // 0 to 1 +#define PP_EFFECT_GRAIN_SHARPNESS 1 // 0 to 20 +#define PP_EFFECT_GRAIN_SIZE 2.5 // 1 to 8 +#define PP_EFFECT_GRAIN_INTENSITY_X0 0.2 // float, No range +#define PP_EFFECT_GRAIN_INTENSITY_X1 0.2 // float, No range +#define PP_EFFECT_GRAIN_MONOCHROMATIC false // bool + + +if (!hasInterface) exitwith {}; +CSE_SYS_NVG_GRAIN_EFFECT_DISPLAY = false; +// need to add some key handlers + + waituntil{!isnil "cse_gui" && !isnil "cse_main"}; + ["Enabling CSE NVG systems",2] call cse_fnc_debug; + _ppEffect_NVGAdjustBrightness = ppEffectCreate ["ColorCorrections", 1587]; + _ppEffect_NVGAdjustBrightness ppEffectForceInNVG true; + _ppEffect_NVGAdjustBrightness ppEffectAdjust [1, 1, 0, [0, 0, 0, 0], [0, 0, 0, 1], [0, 0, 0, 1]]; + _ppEffect_NVGAdjustBrightness ppEffectCommit 0; + + + _ppEffect_NVGAdjustEffect = ppEffectCreate ["FilmGrain", 2451]; + _ppEffect_NVGAdjustEffect ppEffectForceInNVG true; + _ppEffect_NVGAdjustEffect ppEffectAdjust [PP_EFFECT_GRAIN_INTENSITVE, PP_EFFECT_GRAIN_SHARPNESS, PP_EFFECT_GRAIN_SIZE, PP_EFFECT_GRAIN_INTENSITY_X0, PP_EFFECT_GRAIN_INTENSITY_X1, PP_EFFECT_GRAIN_MONOCHROMATIC]; + _ppEffect_NVGAdjustEffect ppEffectCommit 0; + + + // Refactor this + ["cse_sys_nightvision", [_ppEffect_NVGAdjustBrightness, _ppEffect_NVGAdjustEffect], { + _ppEffect_NVGAdjustBrightness = _this select 0; + _ppEffect_NVGAdjustEffect = _this select 1; + + if (((currentVisionMode player == 1) || (currentVisionMode (vehicle player) == 1))&& !isNull(findDisplay 46)) then { + _ppEffect_NVGAdjustBrightness ppEffectEnable true; + _newBrightness = player getvariable ["cse_sys_nightvision_brightness", 1]; + _ppEffect_NVGAdjustBrightness ppEffectAdjust [1, _newBrightness, 0, [0, 0, 0, 0], [0, 0, 0, 1], [0, 0, 0, 1]]; + _ppEffect_NVGAdjustBrightness ppEffectCommit 0; + if (CSE_SYS_NVG_GRAIN_EFFECT_DISPLAY) then { + _ppEffect_NVGAdjustEffect ppEffectEnable true; + }; + } else { + _ppEffect_NVGAdjustBrightness ppEffectEnable false; + _ppEffect_NVGAdjustEffect ppEffectEnable false; + }; + + }] call cse_fnc_addTaskToPool_f; + +["cse_sys_nightvision_grain_effect_display", ["Enable", "Disable"], (["cse_sys_nightvision_grain_effect_display", 0] call cse_fnc_getClientSideOptionFromProfile_F), { + CSE_SYS_NVG_GRAIN_EFFECT_DISPLAY = (_this select 1) == 0; +}] call cse_fnc_addClientSideOptions_f; + +["cse_sys_nightvision_grain_effect_display","option","Use Grain effect","Use grain effect for nightvision"] call cse_fnc_settingsDefineDetails_F; diff --git a/TO_MERGE/cse/sys_equipment/scripts/check_ammo_keybindings.sqf b/TO_MERGE/cse/sys_equipment/scripts/check_ammo_keybindings.sqf new file mode 100644 index 0000000000..86483ca444 --- /dev/null +++ b/TO_MERGE/cse/sys_equipment/scripts/check_ammo_keybindings.sqf @@ -0,0 +1,17 @@ +["check_current_magazine_count_eq", (["check_current_magazine_count_eq","action",[0,0,0,0]] call cse_fnc_getKeyBindingFromProfile_F), { + private ["_percentage", "_text"]; + + if (currentWeapon player != "" && currentMagazine player != "") then { + _percentage = [player] call cse_fnc_getPercentageAmmoMagazine_EQ; + _text = switch true do { + case (_percentage >= 75) : { "Heavy weight" }; + case (_percentage >= 35) : { "Medium weight" }; + case (_percentage >= 15) : { "Light weight" }; + case (_percentage >= 0 ) : { "Very light weight" }; + default { "Unknown" }; + }; + ["Magazine weight", [_text], 0] call cse_fnc_gui_displayInformation; + }; + +}] call cse_fnc_addKeyBindingForAction_F; +["check_current_magazine_count_eq","action","Check Ammo","Check your current ammo count"] call cse_fnc_settingsDefineDetails_F; \ No newline at end of file diff --git a/TO_MERGE/cse/sys_equipment/scripts/register_attachable_items_actions.sqf b/TO_MERGE/cse/sys_equipment/scripts/register_attachable_items_actions.sqf new file mode 100644 index 0000000000..c94f70758e --- /dev/null +++ b/TO_MERGE/cse/sys_equipment/scripts/register_attachable_items_actions.sqf @@ -0,0 +1,45 @@ +if (isDedicated) exitwith{}; +CSE_ICON_PATH = "cse\cse_gui\radialmenu\data\icons\"; + +cse_attachMagazinesDisplaySubMenu = { + [_this] call cse_fnc_Debug; + private ["_subMenus","_passedMags","_magsAmmo"]; + _subMenus = []; + _passedMags = []; + _magsAmmo = magazinesAmmo player; + if ([player] call cse_fnc_hasItemAttached_EQ) then { + _subMenus set [ count _subMenus, + call compile format['["Detach", getText(configFile >> "CfgMagazines" >> "%1" >> "picture"), + { + closeDialog 0; + [player,"%1",20] spawn cse_fnc_detachItem_EQ; + }, true, "Detach " + getText(configFile >> "CfgMagazines" >> "%1" >> "displayName") + ]', player getvariable ["cse_attachedItemClassName_EQ", ""]] + ]; + } else { + { + if (!((_x select 0) in _passedMags)) then { + _passedMags set [ count _passedMags, (_x select 0)]; + if ([_x select 0] call cse_fnc_isAttachableItem_EQ) then + { + _subMenus set [ count _subMenus, + call compile format['[getText(configFile >> "CfgMagazines" >> "%1" >> "displayName"), getText(configFile >> "CfgMagazines" >> "%1" >> "picture"), + { + closeDialog 0; + [player, "%1"] call cse_fnc_attachItem_EQ; + }, true, "Attach " + getText(configFile >> "CfgMagazines" >> "%1" >> "displayName") + ]',(_x select 0)] + ]; + }; + }; + }foreach _magsAmmo; + }; + + [ _this select 3, _subMenus, _this select 1, CSE_SELECTED_RADIAL_OPTION_N_GUI, true] call cse_fnc_openRadialSecondRing_GUI; +}; + + +_entries = [ + ["Attach", {(([player] call cse_fnc_hasItemAttached_EQ) || [player] call cse_fnc_hasAttachableItem_EQ)}, CSE_ICON_PATH + "icon_magazines.paa", cse_attachMagazinesDisplaySubMenu, "Attach Item(s)"] +]; +["ActionMenu","equipment", _entries ] call cse_fnc_addMultipleEntriesToRadialCategory_F; \ No newline at end of file diff --git a/TO_MERGE/cse/sys_equipment/scripts/register_magazine_repack_actions.sqf b/TO_MERGE/cse/sys_equipment/scripts/register_magazine_repack_actions.sqf new file mode 100644 index 0000000000..73b2d8ef09 --- /dev/null +++ b/TO_MERGE/cse/sys_equipment/scripts/register_magazine_repack_actions.sqf @@ -0,0 +1,59 @@ +if (isDedicated) exitwith{}; +CSE_ICON_PATH = "cse\cse_gui\radialmenu\data\icons\"; + +cse_fnc_repackableMagazineTypes = { + private ["_magazines", "_repackableMagazines", "_repackableMagazineTypes", "_className", "_magazineAmmoCount", "_magazineCapacity", "_repackableMagazinesOfTypeX", "_result"]; + _magazines = magazinesAmmo player; + _result = []; + _repackableMagazines = []; + _repackableMagazineTypes = []; + { + _className = _x select 0; + _magazineAmmoCount = _x select 1; + _magazineCapacity = getNumber(configFile >> "CfgMagazines" >> _className >> "count"); + if (_magazineCapacity - _magazineAmmoCount > 0) then { + _repackableMagazines pushBack _x; + if (!(_className in _repackableMagazineTypes)) then { + _repackableMagazineTypes pushBack _className; + }; + }; + } forEach _magazines; + + { + _magazineType = _x; + _repackableMagazinesOfTypeX = {_magazineType == (_x select 0)} count _repackableMagazines; + if (_repackableMagazinesOfTypeX > 1) then { + _result pushBack _magazineType; + }; + } forEach _repackableMagazineTypes; + + _result +}; + +cse_repackMagazinesDisplaySubMenu = { + [_this] call cse_fnc_Debug; + + private ["_subMenus", "_repackableMagazineTypes"]; + _subMenus = []; + _repackableMagazineTypes = call cse_fnc_repackableMagazineTypes; + + { + _subMenus pushBack + call compile format['[getText(configFile >> "CfgMagazines" >> "%1" >> "displayName"), getText(configFile >> "CfgMagazines" >> "%1" >> "picture"), + { + closeDialog 0; + [player,"%1",20] spawn cse_fnc_repackMagazines; + }, true, "Repack " + getText(configFile >> "CfgMagazines" >> "%1" >> "displayName") + ]', _x]; + } forEach _repackableMagazineTypes; + + [_this select 3, _subMenus, _this select 1, CSE_SELECTED_RADIAL_OPTION_N_GUI, true] call cse_fnc_openRadialSecondRing_GUI; +}; + + +_entries = [ + ["Repack", {count (call cse_fnc_repackableMagazineTypes) > 0}, CSE_ICON_PATH + "icon_magazines.paa", cse_repackMagazinesDisplaySubMenu, "Show magazines that can be repacked"] +]; +["ActionMenu","equipment", _entries ] call cse_fnc_addMultipleEntriesToRadialCategory_F; + + diff --git a/TO_MERGE/cse/sys_equipment/scripts/select_weapon_keybindings.sqf b/TO_MERGE/cse/sys_equipment/scripts/select_weapon_keybindings.sqf new file mode 100644 index 0000000000..2cb89a7c38 --- /dev/null +++ b/TO_MERGE/cse/sys_equipment/scripts/select_weapon_keybindings.sqf @@ -0,0 +1,28 @@ + +["place_Weapon_onBack", (["place_Weapon_onBack","action",[0,0,0,0]] call cse_fnc_getKeyBindingFromProfile_F), { + if (currentWeapon player != "") then { + [player] call cse_fnc_putWeaponOnBack_EQ; + }; +}] call cse_fnc_addKeyBindingForAction_F; +["place_Weapon_onBack","action","Weapon on Back","Place rifle on back or holster pistol"] call cse_fnc_settingsDefineDetails_F; + +["select_primairy_weapon", (["select_primairy_weapon","action",[0,0,0,0]] call cse_fnc_getKeyBindingFromProfile_F), { + if (primaryWeapon player != "") then { + player selectWeapon primaryWeapon player; + }; +}] call cse_fnc_addKeyBindingForAction_F; +["select_primairy_weapon","action","Select Primairy weapon","Select your primary weapon."] call cse_fnc_settingsDefineDetails_F; + +["select_secondairy_weapon", (["select_secondairy_weapon","action",[0,0,0,0]] call cse_fnc_getKeyBindingFromProfile_F), { + if (secondaryWeapon player != "") then { + player selectWeapon secondaryWeapon player; + }; +}] call cse_fnc_addKeyBindingForAction_F; +["select_secondairy_weapon","action","Select Secondairy Weapon","Select your secondairy weapon."] call cse_fnc_settingsDefineDetails_F; + +["select_handgun_weapon", (["select_handgun_weapon","action",[0,0,0,0]] call cse_fnc_getKeyBindingFromProfile_F), { + if (handgunWeapon player != "") then { + player selectWeapon handgunWeapon player; + }; +}] call cse_fnc_addKeyBindingForAction_F; +["select_handgun_weapon","action","Select handgun","Select your pistol."] call cse_fnc_settingsDefineDetails_F; diff --git a/TO_MERGE/cse/sys_equipment/stringtable.xml b/TO_MERGE/cse/sys_equipment/stringtable.xml new file mode 100644 index 0000000000..dd082b5b55 --- /dev/null +++ b/TO_MERGE/cse/sys_equipment/stringtable.xml @@ -0,0 +1,91 @@ + + + + + + + White Flare + Bengala Blanca + + + Red Flare + Bengala Roja + + + Yellow Flare + Bengala Amarilla + + + Green Flare + Bengala Verde + + + + + White Road Flare + Bengala de Carretera Blanca + + + Red Road Flare + Bengala de Carretera Roja + + + Yellow Road Flare + Bengala de Carretera Amarilla + + + Green Road Flare + Bengala de Carretera Verde + + + + + + + Rest Weapon/Deploy Bipod + Oprzyj broń / rozłóż dwójnóg + Apoyar Arma/Desplegar Bípode + + + Unrest Weapon/Undeploy Bipod + Levantar Arma/Plegar Bípode + + + Lets the player rest his weapon / deploy the bipod. This is part of the 'Weapon Rest [CSE]' module. + Pozwala graczowi oprzeć swoją broń / rozłożyć dwójnóg. Jest to część modułu 'Podpieranie broni [CSE]'. + Permite apoyar el arma / desplegar el bípode. Es parte del módulo "Weapon Rest [CSE]". + + + Lets the player unrest his weapon / undeploy the bipod. This is part of the 'Weapon Rest [CSE]' module. + Permite levantar el arma / plegar el bípode. Es parte del módulo "Weapon Rest [CSE]". + + + + + + + + + Increase NVG Brightness + Zwiększ czułość NVG + Aumentar el brillo de la Visión Nocturna + + + Allows the player to increase the NVG brightness. + Pozwala graczowi zwiększyć czułość noktowizji. + Permite al jugador aumentar el brillo de la Visión Nocturna + + + Decrease NVG Brightness + Zmniejsz czułość NVG + Disminuir el brillo de la Visión Nocturna + + + Allows the player to decrease the NVG brightness. + Pozwala graczowi zmniejszyć czułość noktowizji. + Permite al jugador disminuir el brillo de la Visión Nocturna + + + + + diff --git a/TO_MERGE/cse/sys_equipment/ui/rscTitles.h b/TO_MERGE/cse/sys_equipment/ui/rscTitles.h new file mode 100644 index 0000000000..77fe626e84 --- /dev/null +++ b/TO_MERGE/cse/sys_equipment/ui/rscTitles.h @@ -0,0 +1,51 @@ +class RscControlsGroup; +class RscText; +/* +class RscInGameUI +{ + class RscUnitInfo + { + class WeaponInfoControlsGroupLeft: RscControlsGroup + { + class controls + { + class CA_AmmoCount: RscText + { + sizeEx = 0; + }; + class CA_MagCount: RscText + { + sizeEx = 0; + }; + class GrenadeCount: RscText + { + sizeEx = 0; + }; + }; + }; + }; +};*/ +/* + class RscUnitInfo { + idd = 300; + class WeaponInfoControlsGroupLeft: RscControlsGroup + { + idc = 2302; + class controls + { + class CA_AmmoCount: RscText + { + idc = 184; + }; + class CA_MagCount: RscText + { + idc = 185; + }; + class CA_GrenadeCount: RscText + { + idc = 151; + }; + }; + }; + }; +*/ diff --git a/TO_MERGE/cse/sys_equipment/weaponresting/data/icons/icon_bipod.paa b/TO_MERGE/cse/sys_equipment/weaponresting/data/icons/icon_bipod.paa new file mode 100644 index 0000000000..c2b6a2fb3e Binary files /dev/null and b/TO_MERGE/cse/sys_equipment/weaponresting/data/icons/icon_bipod.paa differ diff --git a/TO_MERGE/cse/sys_equipment/weaponresting/functions/fn_actionReleaseWeapon_WR.sqf b/TO_MERGE/cse/sys_equipment/weaponresting/functions/fn_actionReleaseWeapon_WR.sqf new file mode 100644 index 0000000000..08fd122ee3 --- /dev/null +++ b/TO_MERGE/cse/sys_equipment/weaponresting/functions/fn_actionReleaseWeapon_WR.sqf @@ -0,0 +1,13 @@ +/** + * fn_actionReleaseWeapon_WR.sqf + * @Descr: Force unrest/undeploy of the weapon + * @Author: Ruthberg + * + * @Arguments: [] + * @Return: nil + * @PublicAPI: false + */ + + +player setVariable ["cse_isWeaponRested_WR", false, false]; +player setVariable ["cse_isWeaponDeployed_WR", false, false]; diff --git a/TO_MERGE/cse/sys_equipment/weaponresting/functions/fn_canDeployBipod_WR.sqf b/TO_MERGE/cse/sys_equipment/weaponresting/functions/fn_canDeployBipod_WR.sqf new file mode 100644 index 0000000000..06d5abf56e --- /dev/null +++ b/TO_MERGE/cse/sys_equipment/weaponresting/functions/fn_canDeployBipod_WR.sqf @@ -0,0 +1,46 @@ +/** + * fn_canDeployBipod_WR.sqf + * @Descr: Check if player can deploy a bipod. + * @Author: Glowbal, Ruthberg + * + * @Arguments: [] + * @Return: [BOOL, PositionASL] + * @PublicAPI: true + */ + + +#define LEFT_HAND_BIPOD_DISTANCE_LONG_RIFLE 0.3 +#define LEFT_HAND_BIPOD_DISTANCE_RIFLE 0.15 +#define BIPOD_HEIGHT 0.40 +#define ALLOWED_ANIMATION_STATES ["amovpercmstpsraswrfldnon","aadjpercmstpsraswrfldup","aadjpercmstpsraswrflddown","aadjpknlmstpsraswrfldup","amovpknlmstpsraswrfldnon","aadjpknlmstpsraswrflddown","aadjppnemstpsraswrfldup","amovppnemstpsraswrfldnon","aadjpknlmstpsraswrfldright","aadjpknlmstpsraswrfldleft","aadjpercmstpsraswrfldright","aadjpercmstpsraswrfldleft"] + +private ["_weapon", "_playerAnimationState", "_canDeployBipod", "_weaponDirection", "_leftHandPosition", "_leftHandBipodDistance", "_isLongRifle", "_azimut", "_elevation", "_bipodTop", "_bipodBottom"]; +_weapon = currentWeapon player; +_playerAnimationState = (([animationState player, "_"] call BIS_fnc_splitString) select 0); +_canDeployBipod = [false, [0, 0, 0]]; + +if ((call cse_fnc_hasBipod_WR) && _weapon == primaryWeapon player && !(weaponLowered player) && _playerAnimationState in ALLOWED_ANIMATION_STATES) then { + _weaponDirection = player weaponDirection _weapon; + + _leftHandPosition = ATLtoASL (player modelToWorld (player selectionPosition "LeftHand")); + + _leftHandBipodDistance = LEFT_HAND_BIPOD_DISTANCE_RIFLE; + _isLongRifle = [configFile >> "CfgWeapons" >> _weapon, "Rifle_Long_Base_F"] call cse_fnc_inheritsFrom; + if (_isLongRifle) then { + _leftHandBipodDistance = LEFT_HAND_BIPOD_DISTANCE_LONG_RIFLE; + }; + + _azimut = (_weaponDirection select 0) atan2 (_weaponDirection select 1); + _elevation = asin(_weaponDirection select 2); + + _bipodTop = _leftHandPosition vectorAdd (_weaponDirection vectorMultiply _leftHandBipodDistance); + _bipodBottom = _bipodTop vectorAdd [sin(_azimut) * sin(_elevation) * BIPOD_HEIGHT, cos(_azimut) * sin(_elevation) * BIPOD_HEIGHT, cos(_elevation) * -BIPOD_HEIGHT]; + + // Bipods can be deployed on ground or objects. + _canDeployBipod = [_bipodTop, _bipodBottom, 0.05] call cse_fnc_getFirstObjectIntersection; + if (_canDeployBipod select 0) exitWith {}; + _canDeployBipod = [_bipodTop, _bipodBottom, 0.05] call cse_fnc_getFirstTerrainIntersection; + if (_canDeployBipod select 0) exitWith {}; +}; + +_canDeployBipod diff --git a/TO_MERGE/cse/sys_equipment/weaponresting/functions/fn_canRestWeapon_WR.sqf b/TO_MERGE/cse/sys_equipment/weaponresting/functions/fn_canRestWeapon_WR.sqf new file mode 100644 index 0000000000..fa5c751d79 --- /dev/null +++ b/TO_MERGE/cse/sys_equipment/weaponresting/functions/fn_canRestWeapon_WR.sqf @@ -0,0 +1,60 @@ +/** + * fn_canRestWeapon_WR.sqf + * @Descr: Check if player can rest weapon. + * @Author: Glowbal, Ruthberg + * + * @Arguments: [] + * @Return: BOOL Can rest weapon. + * @PublicAPI: true + */ + + +#define ALLOWED_ANIMATION_STATES ["amovpercmstpsraswrfldnon","aadjpercmstpsraswrfldup","aadjpercmstpsraswrflddown","aadjpknlmstpsraswrfldup","amovpknlmstpsraswrfldnon","aadjpknlmstpsraswrflddown","aadjppnemstpsraswrfldup","amovppnemstpsraswrfldnon","aadjpknlmstpsraswrfldright","aadjpknlmstpsraswrfldleft","aadjpercmstpsraswrfldright","aadjpercmstpsraswrfldleft","aadjppnemstpsraswrfldright","aadjppnemstpsraswrfldleft","aadjppnemstpsraswrflddown"] +#define MAX_REST_DISTANCE_FORWARD 0.30 +#define MAX_REST_DISTANCE_LEFT 0.40 +#define MAX_REST_DISTANCE_RIGHT 0.30 +#define MAX_REST_DISTANCE_BOTTOM 0.50 +#define MAX_REST_ANGLE 45 + +private ["_weapon", "_canRestWeapon", "_playerAnimationState", "_weaponDirection", "_leftHandPosition", "_rightHandPosition"]; +_weapon = currentWeapon player; +_canRestWeapon = false; +_playerAnimationState = (([animationState player, "_"] call BIS_fnc_splitString) select 0); + +if (_weapon == primaryWeapon player && !(weaponLowered player) && _playerAnimationState in ALLOWED_ANIMATION_STATES) then { + _weaponDirection = player weaponDirection _weapon; + + _leftHandPosition = ATLtoASL (player modelToWorld (player selectionPosition "LeftHand")); + _rightHandPosition = ATLtoASL (player modelToWorld (player selectionPosition "RightHand")); + + // calculate direction for side checks. + _direction = (_weaponDirection select 0) atan2 (_weaponDirection select 1); + + // check left + if (lineIntersects [_rightHandPosition, _rightHandPosition vectorAdd [ + MAX_REST_DISTANCE_LEFT * sin ((_direction) - MAX_REST_ANGLE), + MAX_REST_DISTANCE_LEFT * cos ((_direction) - MAX_REST_ANGLE), + MAX_REST_DISTANCE_LEFT * 0.5 * (_weaponDirection select 2) + ]]) exitWith { _canRestWeapon = true }; + + // check right + if (lineIntersects [_rightHandPosition, _rightHandPosition vectorAdd [ + MAX_REST_DISTANCE_RIGHT * sin ((_direction) + MAX_REST_ANGLE), + MAX_REST_DISTANCE_RIGHT * cos ((_direction) + MAX_REST_ANGLE), + MAX_REST_DISTANCE_RIGHT * 0.5 * (_weaponDirection select 2) + ]]) exitWith { _canRestWeapon = true }; + + // check bottom (object) + if (lineIntersects [ + _rightHandPosition vectorDiff [0, 0, MAX_REST_DISTANCE_BOTTOM], + _leftHandPosition vectorDiff [0, 0, MAX_REST_DISTANCE_BOTTOM] vectorAdd (_weaponDirection vectorMultiply MAX_REST_DISTANCE_FORWARD)] + ) exitWith { _canRestWeapon = true }; + + // check bottom (ground) + if (terrainIntersectASL [ + _rightHandPosition vectorDiff [0, 0, MAX_REST_DISTANCE_BOTTOM], + _leftHandPosition vectorDiff [0, 0, MAX_REST_DISTANCE_BOTTOM] vectorAdd (_weaponDirection vectorMultiply MAX_REST_DISTANCE_FORWARD)] + ) exitWith { _canRestWeapon = true }; +}; + +_canRestWeapon diff --git a/TO_MERGE/cse/sys_equipment/weaponresting/functions/fn_deployWeapon_WR.sqf b/TO_MERGE/cse/sys_equipment/weaponresting/functions/fn_deployWeapon_WR.sqf new file mode 100644 index 0000000000..f33aab832b --- /dev/null +++ b/TO_MERGE/cse/sys_equipment/weaponresting/functions/fn_deployWeapon_WR.sqf @@ -0,0 +1,39 @@ +/** + * fn_deployWeapon_WR.sqf + * @Descr: N/A + * @Author: Ruthberg + * + * @Arguments: [pivotPosition PositionASL] + * @Return: nil + * @PublicAPI: false + */ + + +#define DEPLOYED_RECOIL 0.5 +#define CAM_SHAKE [1.0, 0.5, 6.0] + +private ["_pivotPosition", "_playerAnimationState"]; +_pivotPosition = _this; + +player setVariable ["cse_isWeaponDeployed_WR", true, false]; + +playSound "cse_weaponrest_rest"; +addCamShake CAM_SHAKE; +["cse_bipodDeployed", true, "cse\cse_sys_equipment\weaponresting\data\icons\icon_bipod.paa", [1,1,1,1]] call cse_fnc_gui_displayIcon; + +_playerAnimationState = animationState player; +player switchMove format["%1_cse_deployed", _playerAnimationState]; +player setUnitRecoilCoefficient DEPLOYED_RECOIL; + +// Watcher that undeploys if we rotate/move too much +[_pivotPosition] spawn { + private ["_pivotPosition", "_canDeployBipod"]; + _pivotPosition = _this select 0; + while {player getVariable ["cse_isWeaponDeployed_WR", false]} do { + _canDeployBipod = call cse_fnc_canDeployBipod_WR; + if !(_canDeployBipod select 0) exitWith {}; + if ((_canDeployBipod select 1) vectorDistance _pivotPosition > 0.30) exitWith {}; + sleep 0.1; + }; + call cse_fnc_undeployWeapon_WR; +}; diff --git a/TO_MERGE/cse/sys_equipment/weaponresting/functions/fn_hasBipod_WR.sqf b/TO_MERGE/cse/sys_equipment/weaponresting/functions/fn_hasBipod_WR.sqf new file mode 100644 index 0000000000..1244cad29e --- /dev/null +++ b/TO_MERGE/cse/sys_equipment/weaponresting/functions/fn_hasBipod_WR.sqf @@ -0,0 +1,17 @@ +/** + * fn_hasBipod_WR.sqf + * @Descr: Check if the current weapon has a bipod. + * @Author: Glowbal, Ruthberg + * + * @Arguments: [] + * @Return: BOOL weapon has bipod. + * @PublicAPI: true + */ + + +_cseBipod = getNumber(configFile >> "CfgWeapons" >> primaryWeapon player >> "cse_bipod") == 1; +_weaponModeBipod = ["bipod", currentWeaponMode player, false] call BIS_fnc_inString || ["bp", currentWeaponMode player, false] call BIS_fnc_inString; + +// TODO: Also check for asdg and kao bipods + +_cseBipod || _weaponModeBipod diff --git a/TO_MERGE/cse/sys_equipment/weaponresting/functions/fn_keyPressed_WR.sqf b/TO_MERGE/cse/sys_equipment/weaponresting/functions/fn_keyPressed_WR.sqf new file mode 100644 index 0000000000..f09559f08a --- /dev/null +++ b/TO_MERGE/cse/sys_equipment/weaponresting/functions/fn_keyPressed_WR.sqf @@ -0,0 +1,37 @@ +/** + * fn_keyPressed_WR.sqf + * @Descr: N/A + * @Author: Glowbal, Ruthberg + * + * @Arguments: [] + * @Return: nil + * @PublicAPI: false + */ + + +#define ALLOWED_ANIMATION_STATES ["amovpercmstpsraswrfldnon","aadjpercmstpsraswrfldup","aadjpercmstpsraswrflddown","aadjpknlmstpsraswrfldup","amovpknlmstpsraswrfldnon","aadjpknlmstpsraswrflddown","aadjppnemstpsraswrfldup","amovppnemstpsraswrfldnon","aadjpknlmstpsraswrfldright","aadjpknlmstpsraswrfldleft","aadjpercmstpsraswrfldright","aadjpercmstpsraswrfldleft","aadjppnemstpsraswrfldright","aadjppnemstpsraswrfldleft","aadjppnemstpsraswrflddown"] + +private ["_playerAnimationState", "_canDeployBipod"]; + +if (weaponLowered player) exitWith {}; +if (!([player] call cse_fnc_canInteract)) exitWith {}; +if (player getVariable ["cse_isWeaponDeployed_WR", false]) exitWith {}; + +_playerAnimationState = (([animationState player, "_"] call BIS_fnc_splitString) select 0); +if (!(_playerAnimationState in ALLOWED_ANIMATION_STATES)) exitWith {}; + +// not deployed -> try to deploy now +_canDeployBipod = call cse_fnc_canDeployBipod_WR; +if (_canDeployBipod select 0) then { + if (player getVariable ["cse_isWeaponRested_WR", false]) then { + call cse_fnc_unrestWeapon_WR; + }; + (_canDeployBipod select 1) call cse_fnc_deployWeapon_WR; +}; + +if (!(player getVariable ["cse_isWeaponRested_WR", false]) && !(player getVariable ["cse_isWeaponDeployed_WR", false])) then { + // not deployed and not rested -> try to rest now + if (call cse_fnc_canRestWeapon_WR) then { + call cse_fnc_restWeapon_WR; + }; +}; diff --git a/TO_MERGE/cse/sys_equipment/weaponresting/functions/fn_restWeapon_WR.sqf b/TO_MERGE/cse/sys_equipment/weaponresting/functions/fn_restWeapon_WR.sqf new file mode 100644 index 0000000000..153247076a --- /dev/null +++ b/TO_MERGE/cse/sys_equipment/weaponresting/functions/fn_restWeapon_WR.sqf @@ -0,0 +1,35 @@ +/** + * fn_restWeapon_WR.sqf + * @Descr: N/A + * @Author: Ruthberg + * + * @Arguments: [] + * @Return: nil + * @PublicAPI: false + */ + + +#define RESTED_RECOIL 0.8 +#define CAM_SHAKE [1.0, 0.5, 6.0] + +private ["_playerAnimationState"]; + + +player setVariable ["cse_isWeaponRested_WR", true, false]; + +playSound "cse_weaponrest_rest"; +addCamShake CAM_SHAKE; +["cse_bipodDeployed", true, "cse\cse_sys_equipment\weaponresting\data\icons\icon_bipod.paa", [1,1,1,1]] call cse_fnc_gui_displayIcon; // TODO: Make a separate icon for weapon resting + +_playerAnimationState = animationState player; +player switchMove format["%1_cse_rested", _playerAnimationState]; +player setUnitRecoilCoefficient RESTED_RECOIL; + +// Watcher that unrests if we rotate/move too much +[] spawn { + while {player getVariable ["cse_isWeaponRested_WR", false]} do { + if !(call cse_fnc_canRestWeapon_WR) exitWith {}; + sleep 0.1; + }; + call cse_fnc_unrestWeapon_WR; +}; diff --git a/TO_MERGE/cse/sys_equipment/weaponresting/functions/fn_undeployWeapon_WR.sqf b/TO_MERGE/cse/sys_equipment/weaponresting/functions/fn_undeployWeapon_WR.sqf new file mode 100644 index 0000000000..b953d49792 --- /dev/null +++ b/TO_MERGE/cse/sys_equipment/weaponresting/functions/fn_undeployWeapon_WR.sqf @@ -0,0 +1,21 @@ +/** + * fn_undeployWeapon_WR.sqf + * @Descr: N/A + * @Author: Ruthberg + * + * @Arguments: [] + * @Return: nil + * @PublicAPI: false + */ + + +private ["_playerAnimationState"]; + +_playerAnimationState = animationState player; +player switchMove (([_playerAnimationState, "_"] call BIS_fnc_splitString) select 0); +player setUnitRecoilCoefficient 1; + +player setVariable ["cse_isWeaponDeployed_WR", false, false]; + +playSound "cse_weaponrest_unrest"; +["cse_bipodDeployed", false, "cse\cse_sys_equipment\weaponresting\data\icons\icon_bipod.paa", [1,1,1,1]] call cse_fnc_gui_displayIcon; \ No newline at end of file diff --git a/TO_MERGE/cse/sys_equipment/weaponresting/functions/fn_unrestWeapon_WR.sqf b/TO_MERGE/cse/sys_equipment/weaponresting/functions/fn_unrestWeapon_WR.sqf new file mode 100644 index 0000000000..ca31eec04e --- /dev/null +++ b/TO_MERGE/cse/sys_equipment/weaponresting/functions/fn_unrestWeapon_WR.sqf @@ -0,0 +1,21 @@ +/** + * fn_unrestWeapon_WR.sqf + * @Descr: N/A + * @Author: Ruthberg + * + * @Arguments: [] + * @Return: nil + * @PublicAPI: false + */ + + +private ["_playerAnimationState"]; + +_playerAnimationState = animationState player; +player switchMove (([_playerAnimationState, "_"] call BIS_fnc_splitString) select 0); +player setUnitRecoilCoefficient 1; + +player setVariable ["cse_isWeaponRested_WR", false, false]; + +playSound "cse_weaponrest_unrest"; +["cse_bipodDeployed", false, "cse\cse_sys_equipment\weaponresting\data\icons\icon_bipod.paa", [1,1,1,1]] call cse_fnc_gui_displayIcon; \ No newline at end of file diff --git a/TO_MERGE/cse/sys_equipment/weaponresting/init_sys_weaponrest.sqf b/TO_MERGE/cse/sys_equipment/weaponresting/init_sys_weaponrest.sqf new file mode 100644 index 0000000000..7137b8cbd7 --- /dev/null +++ b/TO_MERGE/cse/sys_equipment/weaponresting/init_sys_weaponrest.sqf @@ -0,0 +1,9 @@ +if (!hasInterface) exitwith {}; +waituntil{!isnil "cse_gui" && !isnil "cse_main"}; + +waitUntil {!isNull player}; + +["cse_isWeaponRested_WR" , false, false, "wr"] call cse_fnc_defineVariable; +["cse_isWeaponDeployed_WR", false, false, "wr"] call cse_fnc_defineVariable; + +cse_sys_weaponRest = true; diff --git a/TO_MERGE/cse/sys_equipment/weaponresting/sound/weaponrest_rest.wav b/TO_MERGE/cse/sys_equipment/weaponresting/sound/weaponrest_rest.wav new file mode 100644 index 0000000000..fce6386425 Binary files /dev/null and b/TO_MERGE/cse/sys_equipment/weaponresting/sound/weaponrest_rest.wav differ diff --git a/TO_MERGE/cse/sys_equipment/weaponresting/sound/weaponrest_unrest.wav b/TO_MERGE/cse/sys_equipment/weaponresting/sound/weaponrest_unrest.wav new file mode 100644 index 0000000000..72518ddbbf Binary files /dev/null and b/TO_MERGE/cse/sys_equipment/weaponresting/sound/weaponrest_unrest.wav differ diff --git a/TO_MERGE/cse/sys_equipment/weaponsafety/functions/fn_safetyOff_ws.sqf b/TO_MERGE/cse/sys_equipment/weaponsafety/functions/fn_safetyOff_ws.sqf new file mode 100644 index 0000000000..4f81fe8626 --- /dev/null +++ b/TO_MERGE/cse/sys_equipment/weaponsafety/functions/fn_safetyOff_ws.sqf @@ -0,0 +1,18 @@ +/** + * fn_safetyOff_ws.sqf + * @Descr: Puts the given unit/weapon/muzzle combination on fire + * @Author: Ruthberg + * + * @Arguments: [unit OBJECT, weapon STRING, muzzle STRING] + * @Return: nil + * @PublicAPI: true + */ + + +private ["_unit", "_weapon", "_muzzle"]; +_unit = _this select 0; +_weapon = _this select 1; +_muzzle = _this select 2; + +_unit setVariable [format["CSE_WeaponSafety_%1_%2", _weapon, _muzzle], false, false]; +playSound "click"; diff --git a/TO_MERGE/cse/sys_equipment/weaponsafety/functions/fn_safetyOn_ws.sqf b/TO_MERGE/cse/sys_equipment/weaponsafety/functions/fn_safetyOn_ws.sqf new file mode 100644 index 0000000000..3c6e094351 --- /dev/null +++ b/TO_MERGE/cse/sys_equipment/weaponsafety/functions/fn_safetyOn_ws.sqf @@ -0,0 +1,37 @@ +/** + * fn_safetyOn_ws.sqf + * @Descr: Puts the given unit/weapon/muzzle combination on safe + * @Author: Ruthberg + * + * @Arguments: [unit OBJECT, weapon STRING, muzzle STRING] + * @Return: nil + * @PublicAPI: true + */ + + +private ["_unit", "_weapon", "_muzzle", "_ID"]; +_unit = _this select 0; +_weapon = _this select 1; +_muzzle = _this select 2; + +_unit setVariable[format["CSE_WeaponSafety_%1_%2", _weapon, _muzzle], true, false]; +playSound "click"; + +_ID = format["CSE_WeaponSafety_ID_%1_%2_%3", _unit, _weapon, _muzzle]; + +[_ID, "onEachFrame", { + private ["_unit", "_weapon", "_muzzle", "_ID"]; + _unit = _this select 0; + _weapon = _this select 1; + _muzzle = _this select 2; + _ID = _this select 3; + + if (!(_unit getVariable[format["CSE_WeaponSafety_%1_%2", _weapon, _muzzle], false]) || !(_weapon in (weapons (vehicle _unit)))) exitWith { + [_ID, "onEachFrame"] call BIS_fnc_removeStackedEventHandler; + }; + + if (currentWeapon _unit == _weapon && currentMuzzle _unit == _muzzle) then { + (vehicle _unit) setWeaponReloadingTime [_unit, _muzzle, 1]; + }; + +}, [_unit, _weapon, _muzzle, _ID]] call BIS_fnc_addStackedEventHandler; diff --git a/TO_MERGE/cse/sys_equipment/weaponsafety/init_sys_weaponsafety.sqf b/TO_MERGE/cse/sys_equipment/weaponsafety/init_sys_weaponsafety.sqf new file mode 100644 index 0000000000..d2f27293f2 --- /dev/null +++ b/TO_MERGE/cse/sys_equipment/weaponsafety/init_sys_weaponsafety.sqf @@ -0,0 +1,20 @@ +if (!hasInterface) exitwith {}; +waituntil{!isnil "cse_gui" && !isnil "cse_main"}; + +waitUntil {!isNull player}; + +["put_safety_on", (["put_safety_on","action",[126,0,0,0]] call cse_fnc_getKeyBindingFromProfile_F), { + // TODO: Find a way to implement weapon safety without the slide of a pistol being locked back + if (currentWeapon player != "" && (currentWeapon player == primaryWeapon player || currentWeapon player == secondaryWeapon player)) then { + [player, currentWeapon player, currentMuzzle player] call cse_fnc_safetyOn_ws; + }; +}] call cse_fnc_addKeyBindingForAction_F; +["put_safety_on","action","Safety on","Put weapon on safe."] call cse_fnc_settingsDefineDetails_F; + +["put_safety_off", (["put_safety_off","action",[126,1,0,0]] call cse_fnc_getKeyBindingFromProfile_F), { + [player, currentWeapon player, currentMuzzle player] call cse_fnc_safetyOff_ws; +}] call cse_fnc_addKeyBindingForAction_F; +["put_safety_off","action","Safety off","Put weapon on fire."] call cse_fnc_settingsDefineDetails_F; + + +cse_sys_weaponSafety = true;