mirror of
https://github.com/acemod/ACE3.git
synced 2024-08-30 18:23:18 +00:00
more common cleanup
This commit is contained in:
parent
e833c3fc42
commit
3a027ff26f
@ -11,7 +11,7 @@
|
||||
* 4: localizedDescription <STRING>
|
||||
* 5: possibleValues <ARRAY>
|
||||
* 6: isForced <BOOL>
|
||||
* 7: defaultValue (Any)
|
||||
* 7: defaultValue <ANY>
|
||||
*
|
||||
* Return Value:
|
||||
* None
|
||||
@ -20,10 +20,9 @@
|
||||
*/
|
||||
#include "script_component.hpp"
|
||||
|
||||
PARAMS_8(_name,_typeName,_isClientSetable,_localizedName,_localizedDescription,_possibleValues,_isForced,_value);
|
||||
|
||||
private ["_settingData"];
|
||||
params ["_name", "", "", "", "", "", "", "_value"]; //["_name", "_typeName", "_isClientSetable", "_localizedName", "_localizedDescription", "_possibleValues", "_isForced", "_value"];
|
||||
|
||||
private "_settingData";
|
||||
_settingData = [_name] call FUNC(getSettingData);
|
||||
|
||||
// Exit if the setting already exists
|
||||
|
@ -1,34 +1,29 @@
|
||||
/*
|
||||
* Author: jaynus
|
||||
*
|
||||
* Register an event handler for an ACE synced event
|
||||
*
|
||||
* Argument:
|
||||
* 0: Name (String)
|
||||
* 1: Handler (Code)
|
||||
* 2: TTL (Number or Code) [Optional]
|
||||
* Arguments:
|
||||
* 0: Name <STRING>
|
||||
* 1: Handler <CODE>
|
||||
* 2: TTL (optional: 0) <NUMBER, CODE>
|
||||
*
|
||||
* Return value:
|
||||
* Boolean of success
|
||||
* Return Value:
|
||||
* Boolean of success <BOOL>
|
||||
*
|
||||
* Public: Yes
|
||||
*/
|
||||
//#define DEBUG_MODE_FULL
|
||||
#include "script_component.hpp"
|
||||
//IGNORE_PRIVATE_WARNING("_handleSyncedEvent");
|
||||
|
||||
PARAMS_2(_name,_handler);
|
||||
params ["_name", "_handler", ["_ttl", 0]];
|
||||
|
||||
private["_ttl", "_eventId", "_data"];
|
||||
if( (count _this) > 2) then {
|
||||
_ttl = _this select 2;
|
||||
} else {
|
||||
_ttl = 0;
|
||||
};
|
||||
|
||||
if(HASH_HASKEY(GVAR(syncedEvents),_name)) exitWith {
|
||||
if (HASH_HASKEY(GVAR(syncedEvents),_name)) exitWith {
|
||||
ACE_LOGERROR("Duplicate synced event creation.");
|
||||
false
|
||||
};
|
||||
|
||||
private ["_eventId", "_data"];
|
||||
|
||||
_eventId = [_name, FUNC(_handleSyncedEvent)] call FUNC(addEventHandler);
|
||||
_data = [_handler,[],_ttl,_eventId];
|
||||
_data = [_handler, [], _ttl, _eventId];
|
||||
|
||||
HASH_SET(GVAR(syncedEvents),_name,_data);
|
||||
|
@ -1,95 +1,141 @@
|
||||
/*
|
||||
* Author: Garth 'L-H' de Wet
|
||||
* Adds an item,weapon,magazine to the unit's inventory
|
||||
* or places it in a weaponHolder if no space.
|
||||
* Adds an item, weapon, or magazine to the unit's inventory or places it in a weaponHolder if no space.
|
||||
*
|
||||
* Arguments:
|
||||
* 0: Unit <OBJECT>
|
||||
* 1: Classname <STRING>
|
||||
* 2: Container (uniform, vest, backpack) <STRING><OPTIONAL>
|
||||
* 3: Magazine Ammo Count <NUMBER><OPTIONAL>
|
||||
* 2: Container (uniform, vest, backpack) (default: "") <STRING>
|
||||
* 3: Magazine Ammo Count (default: -1) <NUMBER>
|
||||
*
|
||||
* Return Value:
|
||||
* Array:
|
||||
* 0: Added to player (Bool)
|
||||
* 1: weaponholder (OBJECT)
|
||||
* 0: Added to player <BOOL>
|
||||
* 1: weaponholder <OBJECT>
|
||||
*
|
||||
* Public: Yes
|
||||
*/
|
||||
//#define DEBUG_MODE_FULL
|
||||
#include "script_component.hpp"
|
||||
|
||||
PARAMS_2(_unit,_classname);
|
||||
DEFAULT_PARAM(2,_container,"");
|
||||
DEFAULT_PARAM(3,_ammoCount,-1);
|
||||
params ["_unit", "_classname", ["_container", ""], ["_ammoCount", -1]];
|
||||
|
||||
private ["_addedToPlayer", "_canAdd", "_type", "_pos"];
|
||||
private ["_type", "_canAdd", "_addedToUnit"];
|
||||
|
||||
_canAdd = false;
|
||||
_addedToPlayer = true;
|
||||
|
||||
_type = [_classname] call EFUNC(common,getItemType);
|
||||
_type = [_classname] call FUNC(getItemType);
|
||||
|
||||
switch (_container) do {
|
||||
case "vest": { _canAdd = _unit canAddItemToVest _classname; };
|
||||
case "backpack": { _canAdd = _unit canAddItemToBackpack _classname; };
|
||||
case "uniform": { _canAdd = _unit canAddItemToUniform _classname; };
|
||||
default {_canAdd = _unit canAdd _classname;};
|
||||
};
|
||||
|
||||
switch ((_type select 0)) do {
|
||||
case "weapon": {
|
||||
if (_canAdd) then {
|
||||
switch (_container) do {
|
||||
case "vest": { (vestContainer _unit) addWeaponCargoGlobal [_classname, 1]; };
|
||||
case "backpack": { (backpackContainer _unit) addWeaponCargoGlobal [_classname, 1]; };
|
||||
case "uniform": { (uniformContainer _unit) addWeaponCargoGlobal [_classname, 1]; };
|
||||
default { _unit addWeaponGlobal _classname; };
|
||||
};
|
||||
} else {
|
||||
_addedToPlayer = false;
|
||||
_pos = _unit modelToWorldVisual [0,1,0.05];
|
||||
_unit = createVehicle ["WeaponHolder_Single_F",_pos,[],0,"NONE"];
|
||||
_unit addWeaponCargoGlobal [_classname,1];
|
||||
_unit setPosATL _pos;
|
||||
};
|
||||
case "vest": {
|
||||
_canAdd = _unit canAddItemToVest _classname;
|
||||
};
|
||||
case "magazine": {
|
||||
if (_ammoCount == -1) then {_ammoCount = getNumber (configFile >> "CfgMagazines" >> _classname >> "count");};
|
||||
if (_canAdd) then {
|
||||
switch (_container) do {
|
||||
case "vest": { (vestContainer _unit) addMagazineCargoGlobal [_classname, _ammoCount]; };
|
||||
case "backpack": { (backpackContainer _unit) addMagazineCargoGlobal [_classname, _ammoCount]; };
|
||||
case "uniform": { (uniformContainer _unit) addMagazineCargoGlobal [_classname, _ammoCount]; };
|
||||
default {_unit addMagazine [_classname, _ammoCount]; };
|
||||
};
|
||||
} else {
|
||||
_addedToPlayer = false;
|
||||
_pos = _unit modelToWorldVisual [0,1,0.05];
|
||||
_unit = createVehicle ["WeaponHolder_Single_F",_pos,[],0,"NONE"];
|
||||
_unit addMagazineCargoGlobal [_classname, _ammoCount];
|
||||
_unit setPosATL _pos;
|
||||
};
|
||||
case "backpack": {
|
||||
_canAdd = _unit canAddItemToBackpack _classname;
|
||||
};
|
||||
case "item": {
|
||||
if (_canAdd) then {
|
||||
switch (_container) do {
|
||||
case "vest": { _unit addItemToVest _classname; };
|
||||
case "backpack": { _unit addItemToBackpack _classname; };
|
||||
case "uniform": { _unit addItemToUniform _classname; };
|
||||
default { _unit addItem _classname; };
|
||||
};
|
||||
} else {
|
||||
_addedToPlayer = false;
|
||||
_pos = _unit modelToWorldVisual [0,1,0.05];
|
||||
_unit = createVehicle ["WeaponHolder_Single_F",_pos,[],0,"NONE"];
|
||||
_unit addItemCargoGlobal [_classname,1];
|
||||
_unit setPosATL _pos;
|
||||
};
|
||||
case "uniform": {
|
||||
_canAdd = _unit canAddItemToUniform _classname;
|
||||
};
|
||||
default {
|
||||
_canAdd = _unit canAdd _classname;
|
||||
};
|
||||
};
|
||||
|
||||
switch (_type select 0) do {
|
||||
case "weapon": {
|
||||
if (_canAdd) then {
|
||||
_addedToUnit = true;
|
||||
|
||||
switch (_container) do {
|
||||
case "vest": {
|
||||
(vestContainer _unit) addWeaponCargoGlobal [_classname, 1];
|
||||
};
|
||||
case "backpack": {
|
||||
(backpackContainer _unit) addWeaponCargoGlobal [_classname, 1];
|
||||
};
|
||||
case "uniform": {
|
||||
(uniformContainer _unit) addWeaponCargoGlobal [_classname, 1];
|
||||
};
|
||||
default {
|
||||
_unit addWeaponGlobal _classname;
|
||||
};
|
||||
};
|
||||
} else {
|
||||
_addedToUnit = false;
|
||||
|
||||
private "_pos";
|
||||
_pos = _unit modelToWorldVisual [0,1,0.05];
|
||||
|
||||
_unit = createVehicle ["WeaponHolder_Single_F", _pos, [], 0, "NONE"];
|
||||
_unit addWeaponCargoGlobal [_classname, 1];
|
||||
_unit setPosATL _pos;
|
||||
};
|
||||
};
|
||||
|
||||
case "magazine": {
|
||||
if (_ammoCount == -1) then {
|
||||
_ammoCount = getNumber (configFile >> "CfgMagazines" >> _classname >> "count");
|
||||
};
|
||||
|
||||
if (_canAdd) then {
|
||||
_addedToUnit = true;
|
||||
|
||||
switch (_container) do {
|
||||
case "vest": {
|
||||
(vestContainer _unit) addMagazineCargoGlobal [_classname, 1/*_ammoCount*/]; //@todo Bug! This isn't really the ammo, but magazine count. No such command.
|
||||
};
|
||||
case "backpack": {
|
||||
(backpackContainer _unit) addMagazineCargoGlobal [_classname, 1/*_ammoCount*/]; //@todo Bug! This isn't really the ammo, but magazine count. No such command.
|
||||
};
|
||||
case "uniform": {
|
||||
(uniformContainer _unit) addMagazineCargoGlobal [_classname, 1/*_ammoCount*/]; //@todo Bug! This isn't really the ammo, but magazine count. No such command.
|
||||
};
|
||||
default {
|
||||
_unit addMagazine [_classname, _ammoCount];
|
||||
};
|
||||
};
|
||||
} else {
|
||||
_addedToUnit = false;
|
||||
|
||||
private "_pos";
|
||||
_pos = _unit modelToWorldVisual [0,1,0.05];
|
||||
|
||||
_unit = createVehicle ["WeaponHolder_Single_F", _pos, [], 0, "NONE"];
|
||||
_unit addMagazineCargoGlobal [_classname, 1/*_ammoCount*/]; //@todo Bug! This isn't really the ammo, but magazine count. No such command.
|
||||
_unit setPosATL _pos;
|
||||
};
|
||||
};
|
||||
|
||||
case "item": {
|
||||
if (_canAdd) then {
|
||||
_addedToUnit = true;
|
||||
|
||||
switch (_container) do {
|
||||
case "vest": {
|
||||
_unit addItemToVest _classname;
|
||||
};
|
||||
case "backpack": {
|
||||
_unit addItemToBackpack _classname;
|
||||
};
|
||||
case "uniform": {
|
||||
_unit addItemToUniform _classname;
|
||||
};
|
||||
default {
|
||||
_unit addItem _classname;
|
||||
};
|
||||
};
|
||||
} else {
|
||||
_addedToUnit = false;
|
||||
|
||||
private "_pos";
|
||||
_pos = _unit modelToWorldVisual [0,1,0.05];
|
||||
|
||||
_unit = createVehicle ["WeaponHolder_Single_F", _pos, [], 0, "NONE"];
|
||||
_unit addItemCargoGlobal [_classname, 1];
|
||||
_unit setPosATL _pos;
|
||||
};
|
||||
};
|
||||
|
||||
default {
|
||||
_addedToUnit = false;
|
||||
ACE_LOGWARNING_2("Incorrect item type passed to %1, passed: %2",QFUNC(AddToInventory),_type);
|
||||
};
|
||||
};
|
||||
|
||||
[_addedToPlayer,_unit]
|
||||
[_addedToUnit, _unit]
|
||||
|
@ -3,12 +3,14 @@
|
||||
*
|
||||
* Returns a brightness value depending on the sun and moon state. Ranges from 0 to 1 (dark ... bright).
|
||||
*
|
||||
* Argument:
|
||||
* None.
|
||||
* Arguments:
|
||||
* None
|
||||
*
|
||||
* Return value:
|
||||
* Ambient brightness (Number)
|
||||
* Return Value:
|
||||
* Ambient brightness <NUMBER>
|
||||
*
|
||||
* Public: Yes
|
||||
*/
|
||||
#include "script_component.hpp"
|
||||
|
||||
(sunOrMoon * sunOrMoon * (1 - overcast * 0.25) + (moonIntensity/5) * (1 - overcast)) min 1
|
||||
(sunOrMoon * sunOrMoon * (1 - overcast * 0.25) + (moonIntensity / 5) * (1 - overcast)) min 1
|
||||
|
@ -1,25 +1,23 @@
|
||||
/*
|
||||
Name: FUNC(applyForceWalkStatus)
|
||||
|
||||
Author: Pabst Mirror
|
||||
|
||||
Description:
|
||||
Applys the forceWalk status of an unit. Called from Extended_InitPost_EventHandlers.
|
||||
|
||||
Parameters:
|
||||
0: OBJECT - Unit
|
||||
|
||||
Returns:
|
||||
None
|
||||
|
||||
Example:
|
||||
[ACE_Player] call FUNC(applyForceWalkStatus)
|
||||
* Author: Pabst Mirror
|
||||
* Applys the forceWalk status of an unit. Called from Extended_InitPost_EventHandlers.
|
||||
*
|
||||
* Arguments:
|
||||
* 0: Unit <OBJECT>
|
||||
*
|
||||
* Return Value:
|
||||
* None
|
||||
*
|
||||
* Example:
|
||||
* [ACE_Player] call FUNC(applyForceWalkStatus)
|
||||
*
|
||||
* Public: No
|
||||
*/
|
||||
#include "script_component.hpp"
|
||||
|
||||
private ["_forceWalkNumber"];
|
||||
params ["_unit"];
|
||||
|
||||
PARAMS_1(_unit);
|
||||
private "_forceWalkNumber";
|
||||
_forceWalkNumber = _unit getVariable ["ACE_forceWalkStatusNumber", 0];
|
||||
|
||||
_unit forceWalk (_forceWalkNumber > 0);
|
||||
|
@ -1,23 +1,23 @@
|
||||
/*
|
||||
* Author: commy2
|
||||
*
|
||||
* Get a binary equivalent of a decimal number.
|
||||
*
|
||||
* Argument:
|
||||
* 0: Decimal Number (Number)
|
||||
* 1: Minimum length of the returned Array, note: returned array can be larger (Number, optional default 8)
|
||||
* Arguments:
|
||||
* 0: Decimal Number <NUMBER>
|
||||
* 1: Minimum length of the returned Array, note: returned array can be larger (default: 8) <NUMBER>
|
||||
*
|
||||
* Return value:
|
||||
* Booleans (Array)
|
||||
* Return Value:
|
||||
* Booleans <ARRAY>
|
||||
*
|
||||
* Public: Yes
|
||||
*/
|
||||
#include "script_component.hpp"
|
||||
|
||||
private ["_number", "_minLength", "_array", "_index", "_rest"];
|
||||
params ["_number", ["_minLength", 8]];
|
||||
|
||||
_number = round (_this select 0);
|
||||
_minLength = _this select 1;
|
||||
_number = round _number;
|
||||
|
||||
if (isNil "_minLength") then {_minLength = 8};
|
||||
private ["_array", "_index", "_rest"];
|
||||
|
||||
_array = [];
|
||||
_array resize _minLength;
|
||||
@ -35,4 +35,5 @@ while {_number > 0} do {
|
||||
_array set [_index, _rest == 1];
|
||||
_index = _index + 1;
|
||||
};
|
||||
|
||||
_array
|
||||
|
@ -1,30 +1,33 @@
|
||||
/**
|
||||
* fn_gui_blurScreen.sqf
|
||||
* @Descr:
|
||||
* @Author: Glowbal
|
||||
/*
|
||||
* Author: Glowbal
|
||||
*
|
||||
* @Arguments: []
|
||||
* @Return:
|
||||
* @PublicAPI: true
|
||||
* Arguments:
|
||||
* 0: ID <NUMBER>
|
||||
* 1: Show? <BOOL, NUMBER>
|
||||
*
|
||||
* Return Value:
|
||||
* None
|
||||
*
|
||||
* Public: Yes
|
||||
*/
|
||||
|
||||
#include "script_component.hpp"
|
||||
|
||||
if (!hasInterface) exitWith {};
|
||||
|
||||
private ["_show"];
|
||||
PARAMS_1(_id);
|
||||
_show = if (count _this > 1) then {_this select 1} else {false};
|
||||
params ["_id", ["_show", false]];
|
||||
|
||||
if (typeName _show == "SCALAR") then {
|
||||
_show = _show == 1;
|
||||
};
|
||||
|
||||
if (isNil QGVAR(SHOW_BLUR_SCREEN_COLLECTION)) then {
|
||||
GVAR(SHOW_BLUR_SCREEN_COLLECTION) = [];
|
||||
};
|
||||
if (typeName _show == typeName 0) then {
|
||||
_show = (_show == 1);
|
||||
};
|
||||
|
||||
if (_show) then {
|
||||
GVAR(SHOW_BLUR_SCREEN_COLLECTION) pushback _id;
|
||||
GVAR(SHOW_BLUR_SCREEN_COLLECTION) pushBack _id;
|
||||
|
||||
// show blur
|
||||
if (isnil QGVAR(MENU_ppHandle_GUI_BLUR_SCREEN)) then {
|
||||
GVAR(MENU_ppHandle_GUI_BLUR_SCREEN) = ppEffectCreate ["DynamicBlur", 102];
|
||||
@ -34,9 +37,10 @@ if (_show) then {
|
||||
};
|
||||
} else {
|
||||
GVAR(SHOW_BLUR_SCREEN_COLLECTION) = GVAR(SHOW_BLUR_SCREEN_COLLECTION) - [_id];
|
||||
|
||||
if (GVAR(SHOW_BLUR_SCREEN_COLLECTION) isEqualTo []) then {
|
||||
// hide blur
|
||||
if (!isnil QGVAR(MENU_ppHandle_GUI_BLUR_SCREEN)) then {
|
||||
if (!isNil QGVAR(MENU_ppHandle_GUI_BLUR_SCREEN)) then {
|
||||
ppEffectDestroy GVAR(MENU_ppHandle_GUI_BLUR_SCREEN);
|
||||
GVAR(MENU_ppHandle_GUI_BLUR_SCREEN) = nil;
|
||||
};
|
||||
|
Loading…
Reference in New Issue
Block a user