overheating: add function headers

This commit is contained in:
Nicolás Badano 2015-01-15 23:36:31 -03:00
parent 9bd5758e40
commit c8811552c8
8 changed files with 102 additions and 31 deletions

View File

@ -1,4 +1,16 @@
// by commy2 and CAA-Picard /*
* Author: Commy2 and CAA-Picard
*
* Make the player check the temperature of his weapon
*
* Arguments:
* 0: _player
* 1: _weapon
*
* Return Values:
* None
*
*/
#include "\z\ace\addons\overheating\script_component.hpp" #include "\z\ace\addons\overheating\script_component.hpp"
EXPLODE_2_PVT(_this,_player,_weapon); EXPLODE_2_PVT(_this,_player,_weapon);

View File

@ -1,12 +1,21 @@
// by commy2 /*
* Author: Commy2
*
* Clears the jam from a weapon
*
* Argument:
* 0: Last temperature (number)
* 1: Barrel mass (number)
* 2: Time (number)
*
* Return value:
* New temperature (number)
*/
#include "\z\ace\addons\overheating\script_component.hpp" #include "\z\ace\addons\overheating\script_component.hpp"
private ["_unit", "_weapon", "_skipAnim", "_jammedWeapons"]; EXPLODE_3_PVT(_this,_unit,_weapon,_skipAnim);
_unit = _this select 0;
_weapon = _this select 1;
_skipAnim = _this select 2;
private ["_jammedWeapons"];
_jammedWeapons = _unit getVariable [QGVAR(jammedWeapons), []]; _jammedWeapons = _unit getVariable [QGVAR(jammedWeapons), []];
if (_weapon in _jammedWeapons) then { if (_weapon in _jammedWeapons) then {

View File

@ -13,15 +13,12 @@
*/ */
#include "\z\ace\addons\overheating\script_component.hpp" #include "\z\ace\addons\overheating\script_component.hpp"
private ["_temperature", "_barrelMass", "_totalTime", "_barrelSurface", "_time", "_deltaTime"]; EXPLODE_3_PVT(_this,_temperature,_barrelMass,_totalTime);
_temperature = _this select 0;
_barrelMass = _this select 1;
_totalTime = _this select 2;
// If a long time passed since the last shot, there's no need to calculate anything; the weapon should be cool // If a long time passed since the last shot, there's no need to calculate anything; the weapon should be cool
if (_totalTime > 1800) exitWith {0}; if (_totalTime > 1800) exitWith {0};
private ["_barrelSurface", "_time", "_deltaTime"];
_barrelSurface = _barrelMass / 7850 / 0.003; _barrelSurface = _barrelMass / 7850 / 0.003;
_time = 0; _time = 0;

View File

@ -1,14 +1,23 @@
// based on KK_fnc_playerWeaponMulfunction from KillzoneKid /*
* Author: Commy2, based on KK_fnc_playerWeaponMulfunction from KillzoneKid
*
* Jam the weapon
*
* Argument:
* 0: unit
* 1: weapon
*
* Return value:
* None
*/
#include "\z\ace\addons\overheating\script_component.hpp" #include "\z\ace\addons\overheating\script_component.hpp"
private ["_unit", "_weapon", "_jammedWeapons"]; EXPLODE_2_PVT(_this,_unit,_weapon);
_unit = _this select 0;
_weapon = _this select 1;
// don't jam a weapon with no rounds left // don't jam a weapon with no rounds left
if (_unit ammo _weapon == 0) exitWith {}; if (_unit ammo _weapon == 0) exitWith {};
private ["_jammedWeapons"];
_jammedWeapons = _unit getVariable [QGVAR(jammedWeapons), []]; _jammedWeapons = _unit getVariable [QGVAR(jammedWeapons), []];
_jammedWeapons pushBack _weapon; _jammedWeapons pushBack _weapon;

View File

@ -1,14 +1,30 @@
// by commy2 and CAA-Picard /*
* Author: Commy2 and CAA-Picard
*
* Heat up the weapon
*
* Argument:
* 0: unit
* 1: weapon
* 2: ammo
* 3: projectile
* 4: velocity
*
* Return value:
* None
*/
#include "\z\ace\addons\overheating\script_component.hpp" #include "\z\ace\addons\overheating\script_component.hpp"
private ["_unit", "_weapon", "_ammo", "_projectile", "_velocity", "_variableName", "_overheat", "_temperature", "_time", "_energyIncrement", "_barrelMass", "_scaledTemperature"]; private ["_unit", "_weapon", "_ammo", "_projectile"];
_unit = _this select 0; _unit = _this select 0;
_weapon = _this select 1; _weapon = _this select 1;
_ammo = _this select 4; _ammo = _this select 4;
_projectile = _this select 6; _projectile = _this select 6;
_velocity = velocity _projectile; _velocity = velocity _projectile;
private ["_variableName", "_overheat", "_temperature", "_time", "_energyIncrement", "_barrelMass", "_scaledTemperature"];
// each weapon has it's own variable. Can't store the temperature in the weapon since they are not objects unfortunately. // each weapon has it's own variable. Can't store the temperature in the weapon since they are not objects unfortunately.
_variableName = format [QGVAR(%1), _weapon]; _variableName = format [QGVAR(%1), _weapon];

View File

@ -1,4 +1,16 @@
// by commy2 and CAA-Picard /*
* Author: Commy2 and CAA-Picard
*
* PFH that displays the weapon temperature after a slight delay
*
* Arguments:
* 0: _player
* 1: _weapon
*
* Return Values:
* None
*
*/
#include "\z\ace\addons\overheating\script_component.hpp" #include "\z\ace\addons\overheating\script_component.hpp"
EXPLODE_2_PVT(_this,_params,_pfhId); EXPLODE_2_PVT(_this,_params,_pfhId);

View File

@ -1,10 +1,18 @@
// by commy2 /*
* Author: Commy2
*
* Make a unit start swapping it's barrel
*
* Argument:
* 0: unit
* 1: weapon
*
* Return value:
* None
*/
#include "\z\ace\addons\overheating\script_component.hpp" #include "\z\ace\addons\overheating\script_component.hpp"
private ["_player", "_weapon"]; EXPLODE_2_PVT(_this,_player,_weapon);
_player = _this select 0;
_weapon = _this select 1;
if (stance _player != "PRONE") then { if (stance _player != "PRONE") then {
[_player, "amovpknlmstpsraswrfldnon", 1] call EFUNC(common,doAnimation); [_player, "amovpknlmstpsraswrfldnon", 1] call EFUNC(common,doAnimation);

View File

@ -1,10 +1,18 @@
// by commy2 /*
* Author: Commy2
*
* Swap barrel callback
*
* Argument:
* 0: unit
* 1: weapon
*
* Return value:
* None
*/
#include "\z\ace\addons\overheating\script_component.hpp" #include "\z\ace\addons\overheating\script_component.hpp"
private ["_player", "_weapon"]; EXPLODE_2_PVT(_this,_player,_weapon);
_player = _this select 0;
_weapon = _this select 1;
// don't consume the barrel, but rotate through them. // don't consume the barrel, but rotate through them.
[localize "STR_ACE_Overheating_SwappedBarrel", QUOTE(PATHTOF(UI\spare_barrel_ca.paa))] call EFUNC(common,displayTextPicture); [localize "STR_ACE_Overheating_SwappedBarrel", QUOTE(PATHTOF(UI\spare_barrel_ca.paa))] call EFUNC(common,displayTextPicture);