mirror of
https://github.com/acemod/ACE3.git
synced 2024-08-30 18:23:18 +00:00
Housekeeping of ace_flashlights and ace_map.
ace_map now handles flashlights independently of ace_flashlights. ace_map searches for flashlight beam textures directly from weapon configs. ace_map has acc_flashlight config (so vanilla ace_map will have at least one flashlight to use).
This commit is contained in:
parent
f0b0b49f3c
commit
f3fc99f3b8
@ -1,7 +0,0 @@
|
|||||||
class CfgSounds {
|
|
||||||
class ACE_flashlights_flashlightClick {
|
|
||||||
name = "ACE_flashlights_flashlightClick";
|
|
||||||
sound[] = {"\a3\sounds_f\weapons\Other\dry4.wss", 0.2, 2};
|
|
||||||
titles[] = {};
|
|
||||||
};
|
|
||||||
};
|
|
@ -1,20 +1,9 @@
|
|||||||
class CfgWeapons {
|
class CfgWeapons {
|
||||||
|
|
||||||
class ItemCore;
|
|
||||||
class ACE_ItemCore;
|
class ACE_ItemCore;
|
||||||
class InventoryItem_Base_F;
|
class InventoryItem_Base_F;
|
||||||
class InventoryFlashlightItem_Base_F;
|
|
||||||
|
|
||||||
class acc_flashlight: ItemCore {
|
class ACE_Map_Flashlight_MX991: ACE_ItemCore {
|
||||||
class ItemInfo: InventoryFlashlightItem_Base_F {
|
|
||||||
class Flashlight {
|
|
||||||
ACE_Flashlight_Colour = "white";
|
|
||||||
ACE_Flashlight_Size = 2.75;
|
|
||||||
};
|
|
||||||
};
|
|
||||||
};
|
|
||||||
|
|
||||||
class ACE_Flashlight_MX991: ACE_ItemCore {
|
|
||||||
displayName = CSTRING(MX991_DisplayName);
|
displayName = CSTRING(MX991_DisplayName);
|
||||||
descriptionShort = CSTRING(MX991_Description);
|
descriptionShort = CSTRING(MX991_Description);
|
||||||
model = QPATHTOF(data\MX_991.p3d);
|
model = QPATHTOF(data\MX_991.p3d);
|
||||||
@ -22,14 +11,16 @@ class CfgWeapons {
|
|||||||
scope = 2;
|
scope = 2;
|
||||||
class ItemInfo: InventoryItem_Base_F {
|
class ItemInfo: InventoryItem_Base_F {
|
||||||
mass = 1;
|
mass = 1;
|
||||||
class FlashLight {
|
class ACE_Map_Flashlight {
|
||||||
ACE_Flashlight_Colour = "red";
|
ACE_Map_Flashlight_Color = "red";
|
||||||
ACE_Flashlight_Size = 1.75;
|
ACE_Map_Flashlight_Beam = QUOTE(PATHTOF(UI\Flashlight_beam_red_ca.paa));
|
||||||
|
ACE_Map_Flashlight_Size = 1.75;
|
||||||
|
ACE_Map_Flashlight_Sound = 1;
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
class ACE_Flashlight_KSF1: ACE_ItemCore {
|
class ACE_Map_Flashlight_KSF1: ACE_ItemCore {
|
||||||
displayName = CSTRING(KSF1_DisplayName);
|
displayName = CSTRING(KSF1_DisplayName);
|
||||||
descriptionShort = CSTRING(KSF1_Description);
|
descriptionShort = CSTRING(KSF1_Description);
|
||||||
model = QPATHTOF(data\KSF_1.p3d);
|
model = QPATHTOF(data\KSF_1.p3d);
|
||||||
@ -37,14 +28,16 @@ class CfgWeapons {
|
|||||||
scope = 2;
|
scope = 2;
|
||||||
class ItemInfo: InventoryItem_Base_F {
|
class ItemInfo: InventoryItem_Base_F {
|
||||||
mass = 1;
|
mass = 1;
|
||||||
class FlashLight {
|
class ACE_Map_Flashlight {
|
||||||
ACE_Flashlight_Colour = "red";
|
ACE_Map_Flashlight_Colour = "red";
|
||||||
ACE_Flashlight_Size = 1.5;
|
ACE_Map_Flashlight_Beam = QUOTE(PATHTOF(UI\Flashlight_beam_red_ca.paa));
|
||||||
|
ACE_Map_Flashlight_Size = 1.5;
|
||||||
|
ACE_Map_Flashlight_Sound = 1;
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
class ACE_Flashlight_XL50: ACE_ItemCore {
|
class ACE_Map_Flashlight_XL50: ACE_ItemCore {
|
||||||
displayName = CSTRING(XL50_DisplayName);
|
displayName = CSTRING(XL50_DisplayName);
|
||||||
descriptionShort = CSTRING(XL50_Description);
|
descriptionShort = CSTRING(XL50_Description);
|
||||||
model = QPATHTOF(data\Maglight.p3d);
|
model = QPATHTOF(data\Maglight.p3d);
|
||||||
@ -52,9 +45,11 @@ class CfgWeapons {
|
|||||||
scope = 2;
|
scope = 2;
|
||||||
class ItemInfo: InventoryItem_Base_F {
|
class ItemInfo: InventoryItem_Base_F {
|
||||||
mass = 1;
|
mass = 1;
|
||||||
class FlashLight {
|
class ACE_Map_Flashlight {
|
||||||
ACE_Flashlight_Colour = "white";
|
ACE_Map_Flashlight_Colour = "white";
|
||||||
ACE_Flashlight_Size = 2.15;
|
ACE_Map_Flashlight_Beam = QUOTE(PATHTOF(UI\Flashlight_beam_white_ca.paa));
|
||||||
|
ACE_Map_Flashlight_Size = 2.15;
|
||||||
|
ACE_Map_Flashlight_Sound = 1;
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
@ -16,4 +16,3 @@ class CfgPatches {
|
|||||||
#include "CfgEventHandlers.hpp"
|
#include "CfgEventHandlers.hpp"
|
||||||
#include "CfgVehicles.hpp"
|
#include "CfgVehicles.hpp"
|
||||||
#include "CfgWeapons.hpp"
|
#include "CfgWeapons.hpp"
|
||||||
#include "CfgSounds.hpp"
|
|
||||||
|
@ -51,4 +51,8 @@ class CfgAmmo {
|
|||||||
class ACE_FlashlightProxy_Yellow: ACE_FlashlightProxy_White {
|
class ACE_FlashlightProxy_Yellow: ACE_FlashlightProxy_White {
|
||||||
effectsSmoke = "ACE_FlashlightEffect_Yellow";
|
effectsSmoke = "ACE_FlashlightEffect_Yellow";
|
||||||
};
|
};
|
||||||
|
|
||||||
|
class ACE_FlashlightProxy_Orange: ACE_FlashlightProxy_White {
|
||||||
|
effectsSmoke = "ACE_FlashlightEffect_Orange";
|
||||||
|
};
|
||||||
};
|
};
|
16
addons/map/CfgWeapons.hpp
Normal file
16
addons/map/CfgWeapons.hpp
Normal file
@ -0,0 +1,16 @@
|
|||||||
|
class CfgWeapons {
|
||||||
|
|
||||||
|
class ItemCore;
|
||||||
|
class InventoryFlashlightItem_Base_F;
|
||||||
|
|
||||||
|
class acc_flashlight: ItemCore {
|
||||||
|
class ItemInfo: InventoryFlashlightItem_Base_F {
|
||||||
|
class ACE_Map_Flashlight {
|
||||||
|
ACE_Map_Flashlight_Color = "white";
|
||||||
|
ACE_Map_Flashlight_Beam = QUOTE(PATHTOF(UI\Flashlight_beam_white_ca.paa));
|
||||||
|
ACE_Map_Flashlight_Size = 2.75;
|
||||||
|
ACE_Map_Flashlight_Sound = 1;
|
||||||
|
};
|
||||||
|
};
|
||||||
|
};
|
||||||
|
};
|
@ -33,4 +33,11 @@ class ACE_FlashlightEffect_Yellow {
|
|||||||
simulation = "light";
|
simulation = "light";
|
||||||
type = "ACE_FlashlightLight_Yellow";
|
type = "ACE_FlashlightLight_Yellow";
|
||||||
};
|
};
|
||||||
|
};
|
||||||
|
|
||||||
|
class ACE_FlashlightEffect_Orange {
|
||||||
|
class Light1 {
|
||||||
|
simulation = "light";
|
||||||
|
type = "ACE_FlashlightLight_Orange";
|
||||||
|
};
|
||||||
};
|
};
|
BIN
addons/map/UI/Flashlight_Beam_white_ca.paa
Normal file
BIN
addons/map/UI/Flashlight_Beam_white_ca.paa
Normal file
Binary file not shown.
@ -73,7 +73,7 @@ call FUNC(determineZoom);
|
|||||||
[_this select 1] call CBA_fnc_removePerFrameHandler;
|
[_this select 1] call CBA_fnc_removePerFrameHandler;
|
||||||
}, 0] call CBA_fnc_addPerFrameHandler;
|
}, 0] call CBA_fnc_addPerFrameHandler;
|
||||||
|
|
||||||
["ace_settingsInitialized", {
|
["SettingsInitialized", {
|
||||||
if (isMultiplayer && {GVAR(DefaultChannel) != -1}) then {
|
if (isMultiplayer && {GVAR(DefaultChannel) != -1}) then {
|
||||||
//Set the chat channel once the map has finished loading
|
//Set the chat channel once the map has finished loading
|
||||||
[{
|
[{
|
||||||
@ -100,15 +100,15 @@ call FUNC(determineZoom);
|
|||||||
GVAR(flashlightInUse) = "";
|
GVAR(flashlightInUse) = "";
|
||||||
GVAR(glow) = objNull;
|
GVAR(glow) = objNull;
|
||||||
|
|
||||||
["ace_playerInventoryChanged", {
|
["playerInventoryChanged", {
|
||||||
private _flashlights = [ACE_player] call FUNC(getUnitFlashlights);
|
private _flashlights = [ACE_player] call FUNC(getUnitFlashlights);
|
||||||
if ((GVAR(flashlightInUse) != "") && !(GVAR(flashlightInUse) in _flashlights)) then {
|
if ((GVAR(flashlightInUse) != "") && !(GVAR(flashlightInUse) in _flashlights)) then {
|
||||||
GVAR(flashlightInUse) = "";
|
GVAR(flashlightInUse) = "";
|
||||||
};
|
};
|
||||||
}] call CBA_fnc_addEventHandler;
|
}] call EFUNC(common,addEventHandler);
|
||||||
|
|
||||||
if (GVAR(mapGlow)) then {
|
if (GVAR(mapGlow)) then {
|
||||||
["ace_visibleMapChanged", {
|
["visibleMapChanged", {
|
||||||
params ["_player", "_mapOn"];
|
params ["_player", "_mapOn"];
|
||||||
if (_mapOn) then {
|
if (_mapOn) then {
|
||||||
if (!alive _player && !isNull GVAR(glow)) then {
|
if (!alive _player && !isNull GVAR(glow)) then {
|
||||||
@ -128,15 +128,15 @@ call FUNC(determineZoom);
|
|||||||
[""] call FUNC(flashlightGlow);
|
[""] call FUNC(flashlightGlow);
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
}] call CBA_fnc_addEventHandler;
|
}] call EFUNC(common,addEventHandler);
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
}] call CBA_fnc_addEventHandler;
|
}] call EFUNC(common,addEventHandler);
|
||||||
|
|
||||||
// hide clock on map if player has no watch
|
// hide clock on map if player has no watch
|
||||||
GVAR(hasWatch) = true;
|
GVAR(hasWatch) = true;
|
||||||
|
|
||||||
["ace_playerInventoryChanged", {
|
["playerInventoryChanged", {
|
||||||
if (isNull (_this select 0)) exitWith {
|
if (isNull (_this select 0)) exitWith {
|
||||||
GVAR(hasWatch) = true;
|
GVAR(hasWatch) = true;
|
||||||
};
|
};
|
||||||
@ -145,4 +145,4 @@ GVAR(hasWatch) = true;
|
|||||||
if (_x isKindOf ["ItemWatch", configFile >> "CfgWeapons"]) exitWith {GVAR(hasWatch) = true;};
|
if (_x isKindOf ["ItemWatch", configFile >> "CfgWeapons"]) exitWith {GVAR(hasWatch) = true;};
|
||||||
false
|
false
|
||||||
} count (assignedItems ACE_player);
|
} count (assignedItems ACE_player);
|
||||||
}] call CBA_fnc_addEventHandler;
|
}] call EFUNC(common,addEventHandler);
|
||||||
|
@ -28,6 +28,7 @@ class RscEdit;
|
|||||||
#include "CfgEventHandlers.hpp"
|
#include "CfgEventHandlers.hpp"
|
||||||
#include "CfgMarkers.hpp"
|
#include "CfgMarkers.hpp"
|
||||||
#include "CfgVehicles.hpp"
|
#include "CfgVehicles.hpp"
|
||||||
|
#include "CfgWeapons.hpp"
|
||||||
#include "CfgAmmo.hpp"
|
#include "CfgAmmo.hpp"
|
||||||
#include "CfgSounds.hpp"
|
#include "CfgSounds.hpp"
|
||||||
#include "CfgLights.hpp"
|
#include "CfgLights.hpp"
|
||||||
@ -163,4 +164,4 @@ class RscDisplayServerGetReady: RscDisplayGetReady {
|
|||||||
#include "MapControls.hpp"
|
#include "MapControls.hpp"
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
};
|
};
|
@ -26,7 +26,7 @@ if (!isNull _light) then {
|
|||||||
};
|
};
|
||||||
|
|
||||||
if (_flashlight != "") then {
|
if (_flashlight != "") then {
|
||||||
_color = getText (configFile >> "CfgWeapons" >> _flashlight >> "ItemInfo" >> "FlashLight" >> "ACE_Flashlight_Colour");
|
_color = getText (configFile >> "CfgWeapons" >> _flashlight >> "ItemInfo" >> QGVAR(Flashlight) >> QGVAR(Flashlight_Color));
|
||||||
if !(_color in ["white", "red", "green", "blue", "yellow"]) then {_color = "white"};
|
if !(_color in ["white", "red", "green", "blue", "yellow"]) then {_color = "white"};
|
||||||
_class = format["ACE_FlashlightProxy_%1", _color];
|
_class = format["ACE_FlashlightProxy_%1", _color];
|
||||||
|
|
||||||
|
@ -21,8 +21,8 @@ params ["_unit"];
|
|||||||
private _flashlights = [];
|
private _flashlights = [];
|
||||||
|
|
||||||
{
|
{
|
||||||
if ((isText (configFile >> "CfgWeapons" >> _x >> "ItemInfo" >> "FlashLight" >> "ACE_Flashlight_Colour")) && !(_x in _flashlights)) then {
|
if ((isText (configFile >> "CfgWeapons" >> _x >> "ItemInfo" >> QGVAR(flashlight) >> QGVAR(Flashlight_Color))) then {
|
||||||
_flashlights pushBack _x;
|
_flashlights pushBackUnique _x;
|
||||||
};
|
};
|
||||||
} forEach (items _unit);
|
} forEach (items _unit);
|
||||||
|
|
||||||
|
@ -51,16 +51,14 @@ if (_flashlight == "") then {
|
|||||||
//ambient shade fill
|
//ambient shade fill
|
||||||
_mapCtrl drawIcon [_fillTex, [1,1,1,_shadeAlpha], _mapCentre, _screenSize, _screenSize, 0, "", 0];
|
_mapCtrl drawIcon [_fillTex, [1,1,1,_shadeAlpha], _mapCentre, _screenSize, _screenSize, 0, "", 0];
|
||||||
} else {
|
} else {
|
||||||
private ["_mousePos", "_colour", "_size", "_flashTex", "_beamSize", "_viewPortRatioFixY", "_offsetX", "_offsetYDown", "_offsetYUp"];
|
private ["_mousePos", "_cfg", "_size", "_flashTex", "_beamSize", "_viewPortRatioFixY", "_offsetX", "_offsetYDown", "_offsetYUp"];
|
||||||
//mouse pos
|
//mouse pos
|
||||||
_mousePos = GVAR(mousePos);
|
_mousePos = GVAR(mousePos);
|
||||||
|
|
||||||
//flashlight settings
|
//flashlight settings
|
||||||
_colour = getText (configFile >> "CfgWeapons" >> _flashlight >> "ItemInfo" >> "FlashLight" >> "ACE_Flashlight_Colour");
|
_cfg = (configFile >> "CfgWeapons" >> _flashlight >> "ItemInfo" >> QGVAR(Flashlight));
|
||||||
if !(_colour in ["white", "red", "green", "blue", "yellow"]) then {_colour = "white"};
|
_flashTex = getText (_cfg >> QGVAR(Flashlight_Beam));
|
||||||
_size = getNumber (configFile >> "CfgWeapons" >> _flashlight >> "ItemInfo" >> "FlashLight" >> "ACE_Flashlight_Size");
|
_size = getNumber (_cfg >> QGVAR(Flashlight_Size));
|
||||||
_flashTex = format[QUOTE(PATHTOF_SYS(ace,flashlights,UI\Flashlight_Beam_%1_ca.paa)), _colour];
|
|
||||||
_beamSize = (safeZoneW/safeZoneWAbs) * _screenSize / _size;
|
|
||||||
|
|
||||||
//after 5x zoom, it's simulated to be fixed (it actually gets bigger relative to zoom)
|
//after 5x zoom, it's simulated to be fixed (it actually gets bigger relative to zoom)
|
||||||
if (_mapScale < 0.2) then {_beamSize = _beamSize / (_mapScale * (1 / 0.2))};
|
if (_mapScale < 0.2) then {_beamSize = _beamSize / (_mapScale * (1 / 0.2))};
|
||||||
|
@ -1,9 +1,9 @@
|
|||||||
/*
|
/*
|
||||||
* Author: voioper
|
* Author: voioper
|
||||||
* Switch flashlight.
|
* Switch flashlight on/off.
|
||||||
*
|
*
|
||||||
* Arguments:
|
* Arguments:
|
||||||
* 0: Flashlight classname ("" for off) <STRING>
|
* 0: New flashlight classname ("" for off) <STRING>
|
||||||
*
|
*
|
||||||
* Return value:
|
* Return value:
|
||||||
* None
|
* None
|
||||||
@ -16,10 +16,18 @@
|
|||||||
|
|
||||||
#include "script_component.hpp"
|
#include "script_component.hpp"
|
||||||
|
|
||||||
params ["_flashlight"];
|
params ["_newFlashlight"];
|
||||||
|
private _oldFlashlight = GVAR(flashlightInUse);
|
||||||
|
|
||||||
GVAR(flashlightInUse) = _flashlight;
|
|
||||||
if (GVAR(mapGlow)) then {
|
if (GVAR(mapGlow)) then {
|
||||||
[GVAR(flashlightInUse)] call FUNC(flashlightGlow);
|
[_newFlashlight] call FUNC(flashlightGlow);
|
||||||
};
|
};
|
||||||
playSound "ACE_map_flashlightClick";
|
|
||||||
|
if (
|
||||||
|
(getNumber (configFile >> "CfgWeapons" >> _newFlashlight >> "ItemInfo" >> QGVAR(Flashlight) >> QGVAR(Flashlight_Sound)) > 0) ||
|
||||||
|
{getNumber (configFile >> "CfgWeapons" >> _oldFlashlight >> "ItemInfo" >> QGVAR(Flashlight) >> QGVAR(Flashlight_Sound)) > 0}
|
||||||
|
) then {
|
||||||
|
playSound QGVAR(flashlightClick);
|
||||||
|
};
|
||||||
|
|
||||||
|
GVAR(flashlightInUse) = _newFlashlight;
|
Loading…
Reference in New Issue
Block a user