diff --git a/addons/pike/$PBOPREFIX$ b/addons/pike/$PBOPREFIX$ new file mode 100644 index 0000000000..2eefcc6075 --- /dev/null +++ b/addons/pike/$PBOPREFIX$ @@ -0,0 +1 @@ +z\ace\addons\pike \ No newline at end of file diff --git a/addons/pike/CfgAmmo.hpp b/addons/pike/CfgAmmo.hpp new file mode 100644 index 0000000000..69a712252f --- /dev/null +++ b/addons/pike/CfgAmmo.hpp @@ -0,0 +1,58 @@ +class CfgAmmo { + class FlareBase; + class GVAR(ammo_gl): FlareBase { + model = QPATHTOF(models\ace_pike_ammo.p3d); + lightColor[] = {0, 0, 0, 0}; + smokeColor[] = {0, 0, 0, 0}; + timeToLive = 1; + }; + + class M_Titan_AT; + class GVAR(ammo_rocket): M_Titan_AT { + irLock = 0; + laserLock = 0; + airLock = 0; + manualControl = 0; + + timeToLive = 30; + + model = QPATHTOF(models\ace_pike_ammo.p3d); + maxSpeed = 150; + thrust = 30; + thrustTime = 2; + + hit = 100; + indirectHit = 8; + indirectHitRange = 6; + + initTime = 0; + + // Begin ACE guidance Configs + class ace_missileguidance { + enabled = 1; + + minDeflection = 0.0005; // Minium flap deflection for guidance + maxDeflection = 0.0025; // Maximum flap deflection for guidance + incDeflection = 0.0005; // The incrmeent in which deflection adjusts. + + canVanillaLock = 0; // Can this default vanilla lock? Only applicable to non-cadet mode + + // Guidance type for munitions + defaultSeekerType = "SALH"; + seekerTypes[] = {"SALH"}; + + defaultSeekerLockMode = "LOAL"; + seekerLockModes[] = {"LOAL"}; + + seekerAngle = 90; // Angle in front of the missile which can be searched + seekerAccuracy = 1; // seeker accuracy multiplier + + seekerMinRange = 1; + seekerMaxRange = 1000; // Range from the missile which the seeker can visually search + + // Attack profile type selection + defaultAttackProfile = "LIN"; + attackProfiles[] = { "LIN", "DIR", "MID", "HI" }; + }; + }; +}; diff --git a/addons/pike/CfgEventhandlers.hpp b/addons/pike/CfgEventhandlers.hpp new file mode 100644 index 0000000000..5da5fd0dc2 --- /dev/null +++ b/addons/pike/CfgEventhandlers.hpp @@ -0,0 +1,18 @@ + +class Extended_PreStart_EventHandlers { + class ADDON { + init = QUOTE(call COMPILE_FILE(XEH_preStart)); + }; +}; + +class Extended_PreInit_EventHandlers { + class ADDON { + init = QUOTE( call COMPILE_FILE(XEH_preInit) ); + }; +}; + +class Extended_PostInit_EventHandlers { + class ADDON { + init = QUOTE( call COMPILE_FILE(XEH_postInit) ); + }; +}; diff --git a/addons/pike/CfgMagazines.hpp b/addons/pike/CfgMagazines.hpp new file mode 100644 index 0000000000..ef69f81494 --- /dev/null +++ b/addons/pike/CfgMagazines.hpp @@ -0,0 +1,13 @@ +class CfgMagazines { + class 1Rnd_HE_Grenade_shell; + class ACE_40mm_Pike: 1Rnd_HE_Grenade_shell { + displayName = CSTRING(magazine_displayName); + displayNameShort = "Pike SALH"; + descriptionShort = ""; + // picture = QPATHTOF(data\inventory_ca.paa); + ammo = QGVAR(ammo_gl); + model = QPATHTOF(models\ace_pike_ammo.p3d); + initSpeed = 40; + mass = 10; + }; +}; diff --git a/addons/pike/CfgWeapons.hpp b/addons/pike/CfgWeapons.hpp new file mode 100644 index 0000000000..61c2fef5a1 --- /dev/null +++ b/addons/pike/CfgWeapons.hpp @@ -0,0 +1,6 @@ +class CfgWeapons { + class GrenadeLauncher; + class UGL_F: GrenadeLauncher { + magazines[] += {"ACE_40mm_Pike"}; + }; +}; diff --git a/addons/pike/README.md b/addons/pike/README.md new file mode 100644 index 0000000000..1e3424afa4 --- /dev/null +++ b/addons/pike/README.md @@ -0,0 +1,11 @@ +ace_pike +=========== + +Adds 40mm Pike semi-active laser seeking rocket, firable from the M320 or EGLM grenade launcher. + + +## Maintainers + +The people responsible for merging changes to this component or answering potential questions. + +- [PabstMirror](http://github.com/PabstMirror) diff --git a/addons/pike/XEH_PREP.hpp b/addons/pike/XEH_PREP.hpp new file mode 100644 index 0000000000..64eb51ef80 --- /dev/null +++ b/addons/pike/XEH_PREP.hpp @@ -0,0 +1 @@ +PREP(handleFired); diff --git a/addons/pike/XEH_postInit.sqf b/addons/pike/XEH_postInit.sqf new file mode 100644 index 0000000000..7f39382a7e --- /dev/null +++ b/addons/pike/XEH_postInit.sqf @@ -0,0 +1,5 @@ +#include "script_component.hpp" + +if (!hasInterface) exitWith {}; + +["ace_firedPlayer", FUNC(handleFired)] call CBA_fnc_addEventHandler; diff --git a/addons/pike/XEH_preInit.sqf b/addons/pike/XEH_preInit.sqf new file mode 100644 index 0000000000..a7feade1c3 --- /dev/null +++ b/addons/pike/XEH_preInit.sqf @@ -0,0 +1,7 @@ +#include "script_component.hpp" + +ADDON = false; + +#include "XEH_PREP.hpp" + +ADDON = true; diff --git a/addons/pike/XEH_preStart.sqf b/addons/pike/XEH_preStart.sqf new file mode 100644 index 0000000000..022888575e --- /dev/null +++ b/addons/pike/XEH_preStart.sqf @@ -0,0 +1,3 @@ +#include "script_component.hpp" + +#include "XEH_PREP.hpp" diff --git a/addons/pike/config.cpp b/addons/pike/config.cpp new file mode 100644 index 0000000000..0fea333706 --- /dev/null +++ b/addons/pike/config.cpp @@ -0,0 +1,20 @@ +#include "script_component.hpp" + +class CfgPatches { + class ADDON { + name = COMPONENT_NAME; + units[] = {}; + weapons[] = {}; + requiredVersion = REQUIRED_VERSION; + requiredAddons[] = {"ace_common", "ace_laser", "ace_missileguidance"}; + author = ECSTRING(common,ACETeam); + authors[] = {"PabstMirror"}; + url = ECSTRING(main,URL); + VERSION_CONFIG; + }; +}; + +#include "CfgAmmo.hpp" +#include "CfgEventhandlers.hpp" +#include "CfgMagazines.hpp" +#include "CfgWeapons.hpp" diff --git a/addons/pike/functions/fnc_handleFired.sqf b/addons/pike/functions/fnc_handleFired.sqf new file mode 100644 index 0000000000..34b1ee5816 --- /dev/null +++ b/addons/pike/functions/fnc_handleFired.sqf @@ -0,0 +1,61 @@ +/* + * Author: PabstMirror + * Handlese firing the 40mm pike grenade/rocket + * + * Arguments: + * FiredEH + * + * Return Value: + * Nothing + * + * Example: + * [] call ace_pike_fnc_handleFired + * + * Public: No + */ +#include "script_component.hpp" + +//IGNORE_PRIVATE_WARNING ["_unit", "_weapon", "_muzzle", "_mode", "_ammo", "_magazine", "_projectile"]; +TRACE_7("firedEH:",_unit, _weapon, _muzzle, _mode, _ammo, _magazine, _projectile); +if (_ammo != QGVAR(ammo_gl)) exitWith {}; + +[{ + params ["_unit", "_weapon", "_muzzle", "_mode", "_ammo", "_magazine", "_projectile"]; + TRACE_7("rocket stage",_unit, _weapon, _muzzle, _mode, _ammo, _magazine, _projectile); + + //If null (deleted or hit water) exit: + if (isNull _projectile) exitWith {}; + + private _posASL = getPosASL _projectile; + private _vel = velocity _projectile; + + systemChat format ["gl %1 %2",_vel, round vectorMagnitude _vel]; + + deleteVehicle _projectile; + + private _rocket = QGVAR(ammo_rocket) createVehicle (getPosATL _projectile); + + _rocket setPosASL _posASL; + + // Set correct velocity and direction (must set velocity before changeMissileDirection) + _rocket setVelocity _vel; + [_rocket, vectorNormalized _vel] call EFUNC(missileguidance,changeMissileDirection); + + + private _vel = velocity _rocket; + systemChat format ["rocket %1 %2",_vel, round vectorMagnitude _vel]; + + // Start missile guidance + [_unit, _weapon, _muzzle, _mode, QGVAR(ammo_rocket), _magazine, _rocket] call EFUNC(missileguidance,onFired); + + #ifdef DEBUG_MODE_FULL + [{ + params ["_args", "_pfID"]; + _args params [["_rocket", objNull], "_startTime"]; + if (!alive _rocket) exitWith {systemChat "done"; [_pfID] call CBA_fnc_removePerFrameHandler;}; + drawIcon3D ["\a3\ui_f\data\IGUI\Cfg\Cursors\selectover_ca.paa", [1,0,1,1], ASLtoAGL getPosASL _rocket, 0.75, 0.75, 0, "", 1, 0.025, "TahomaB"]; + hintSilent format ["vel %1\n%2 mps\n%3dist %3\ntof %4",velocity _rocket, round vectorMagnitude velocity _rocket, _rocket distance player, time - _startTime]; + }, 0.0, [_rocket, time]] call CBA_fnc_addPerFrameHandler; + #endif + +}, _this, 0.1] call CBA_fnc_waitAndExecute; diff --git a/addons/pike/functions/script_component.hpp b/addons/pike/functions/script_component.hpp new file mode 100644 index 0000000000..85866ed86b --- /dev/null +++ b/addons/pike/functions/script_component.hpp @@ -0,0 +1 @@ +#include "\z\ace\addons\pike\script_component.hpp" \ No newline at end of file diff --git a/addons/pike/models/ace_pike_ammo.p3d b/addons/pike/models/ace_pike_ammo.p3d new file mode 100644 index 0000000000..c98ca0fff5 Binary files /dev/null and b/addons/pike/models/ace_pike_ammo.p3d differ diff --git a/addons/pike/models/pike_surface.rvmat b/addons/pike/models/pike_surface.rvmat new file mode 100644 index 0000000000..043d6baa36 --- /dev/null +++ b/addons/pike/models/pike_surface.rvmat @@ -0,0 +1,76 @@ +class StageTI { + texture = "a3\data_f\default_glass_ti_ca.paa"; +}; +ambient[] = {1,1,1,1}; +diffuse[] = {1,1,1,1}; +forcedDiffuse[] = {0,0,0,1}; +emmisive[] = {0,0,0,0}; +specular[] = {0.2,0.2,0.2,1}; +specularPower = 500; +PixelShaderID = "Super"; +VertexShaderID = "Super"; +class Stage1 { + texture="#(argb,8,8,3)color(0.5,0.5,0.5,1)"; + uvSource = "tex"; + class uvTransform { + aside[] = {1,0,0}; + up[] = {0,1,0}; + dir[] = {0,0,1}; + pos[] = {0,0,0}; + }; +}; +class Stage2 { + texture = "#(argb,8,8,3)color(0.5,0.5,0.5,0.5,DT)"; + uvSource = "tex"; + class uvTransform { + aside[] = {1,0,0}; + up[] = {0,1,0}; + dir[] = {0,0,1}; + pos[] = {0,0,0}; + }; +}; +class Stage3 { + texture = "#(argb,8,8,3)color(0,0,0,0,MC)"; + uvSource = "tex"; + class uvTransform { + aside[] = {1,0,0}; + up[] = {0,1,0}; + dir[] = {0,0,1}; + pos[] = {0,0,0}; + }; +}; +class Stage4 { + texture = "#(argb,8,8,3)color(1,1,1,1,AS)"; + uvSource = "tex"; + class uvTransform { + aside[] = {1,0,0}; + up[] = {0,1,0}; + dir[] = {0,0,1}; + pos[] = {0,0,0}; + }; +}; +class Stage5 { + texture = "#(argb,8,8,3)color(0,0.6,1,1,SMDI)"; + uvSource = "tex"; + class uvTransform { + aside[] = {1,0,0}; + up[] = {0,1,0}; + dir[] = {0,0,1}; + pos[] = {0,0,0}; + }; +}; +class Stage6 { + texture = "#(ai,32,128,1)fresnel(1.6,1.4)"; + uvSource="none"; +}; +class Stage7 { + useWorldEnvMap = "true"; + texture = "a3\data_f\env_interier_car_ca.paa"; + uvSource = "tex"; + class uvTransform { + aside[] = {1,0,0}; + up[] = {0,1,0}; + dir[] = {0,0,1}; + pos[] = {0,0,0}; + }; +}; diff --git a/addons/pike/script_component.hpp b/addons/pike/script_component.hpp new file mode 100644 index 0000000000..4b45e277e3 --- /dev/null +++ b/addons/pike/script_component.hpp @@ -0,0 +1,18 @@ +#define COMPONENT pike +#define COMPONENT_BEAUTIFIED Pike +#include "\z\ace\addons\main\script_mod.hpp" + +#define DEBUG_MODE_FULL +#define DISABLE_COMPILE_CACHE +#define CBA_DEBUG_SYNCHRONOUS +#define ENABLE_PERFORMANCE_COUNTERS + +#ifdef DEBUG_ENABLED_PIKE + #define DEBUG_MODE_FULL +#endif + +#ifdef DEBUG_SETTINGS_PIKE + #define DEBUG_SETTINGS DEBUG_SETTINGS_PIKE +#endif + +#include "\z\ace\addons\main\script_macros.hpp" diff --git a/addons/pike/stringtable.xml b/addons/pike/stringtable.xml new file mode 100644 index 0000000000..3ed702fcce --- /dev/null +++ b/addons/pike/stringtable.xml @@ -0,0 +1,8 @@ + + + + + 40mm Pike + + + \ No newline at end of file