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 ItemCore;
|
||||
class ACE_ItemCore;
|
||||
class InventoryItem_Base_F;
|
||||
class InventoryFlashlightItem_Base_F;
|
||||
|
||||
class acc_flashlight: ItemCore {
|
||||
class ItemInfo: InventoryFlashlightItem_Base_F {
|
||||
class Flashlight {
|
||||
ACE_Flashlight_Colour = "white";
|
||||
ACE_Flashlight_Size = 2.75;
|
||||
};
|
||||
};
|
||||
};
|
||||
|
||||
class ACE_Flashlight_MX991: ACE_ItemCore {
|
||||
class ACE_Map_Flashlight_MX991: ACE_ItemCore {
|
||||
displayName = CSTRING(MX991_DisplayName);
|
||||
descriptionShort = CSTRING(MX991_Description);
|
||||
model = QPATHTOF(data\MX_991.p3d);
|
||||
@ -22,14 +11,16 @@ class CfgWeapons {
|
||||
scope = 2;
|
||||
class ItemInfo: InventoryItem_Base_F {
|
||||
mass = 1;
|
||||
class FlashLight {
|
||||
ACE_Flashlight_Colour = "red";
|
||||
ACE_Flashlight_Size = 1.75;
|
||||
class ACE_Map_Flashlight {
|
||||
ACE_Map_Flashlight_Color = "red";
|
||||
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);
|
||||
descriptionShort = CSTRING(KSF1_Description);
|
||||
model = QPATHTOF(data\KSF_1.p3d);
|
||||
@ -37,14 +28,16 @@ class CfgWeapons {
|
||||
scope = 2;
|
||||
class ItemInfo: InventoryItem_Base_F {
|
||||
mass = 1;
|
||||
class FlashLight {
|
||||
ACE_Flashlight_Colour = "red";
|
||||
ACE_Flashlight_Size = 1.5;
|
||||
class ACE_Map_Flashlight {
|
||||
ACE_Map_Flashlight_Colour = "red";
|
||||
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);
|
||||
descriptionShort = CSTRING(XL50_Description);
|
||||
model = QPATHTOF(data\Maglight.p3d);
|
||||
@ -52,9 +45,11 @@ class CfgWeapons {
|
||||
scope = 2;
|
||||
class ItemInfo: InventoryItem_Base_F {
|
||||
mass = 1;
|
||||
class FlashLight {
|
||||
ACE_Flashlight_Colour = "white";
|
||||
ACE_Flashlight_Size = 2.15;
|
||||
class ACE_Map_Flashlight {
|
||||
ACE_Map_Flashlight_Colour = "white";
|
||||
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 "CfgVehicles.hpp"
|
||||
#include "CfgWeapons.hpp"
|
||||
#include "CfgSounds.hpp"
|
||||
|
@ -51,4 +51,8 @@ class CfgAmmo {
|
||||
class ACE_FlashlightProxy_Yellow: ACE_FlashlightProxy_White {
|
||||
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;
|
||||
};
|
||||
};
|
||||
};
|
||||
};
|
@ -34,3 +34,10 @@ class ACE_FlashlightEffect_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;
|
||||
}, 0] call CBA_fnc_addPerFrameHandler;
|
||||
|
||||
["ace_settingsInitialized", {
|
||||
["SettingsInitialized", {
|
||||
if (isMultiplayer && {GVAR(DefaultChannel) != -1}) then {
|
||||
//Set the chat channel once the map has finished loading
|
||||
[{
|
||||
@ -100,15 +100,15 @@ call FUNC(determineZoom);
|
||||
GVAR(flashlightInUse) = "";
|
||||
GVAR(glow) = objNull;
|
||||
|
||||
["ace_playerInventoryChanged", {
|
||||
["playerInventoryChanged", {
|
||||
private _flashlights = [ACE_player] call FUNC(getUnitFlashlights);
|
||||
if ((GVAR(flashlightInUse) != "") && !(GVAR(flashlightInUse) in _flashlights)) then {
|
||||
GVAR(flashlightInUse) = "";
|
||||
};
|
||||
}] call CBA_fnc_addEventHandler;
|
||||
}] call EFUNC(common,addEventHandler);
|
||||
|
||||
if (GVAR(mapGlow)) then {
|
||||
["ace_visibleMapChanged", {
|
||||
["visibleMapChanged", {
|
||||
params ["_player", "_mapOn"];
|
||||
if (_mapOn) then {
|
||||
if (!alive _player && !isNull GVAR(glow)) then {
|
||||
@ -128,15 +128,15 @@ call FUNC(determineZoom);
|
||||
[""] 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
|
||||
GVAR(hasWatch) = true;
|
||||
|
||||
["ace_playerInventoryChanged", {
|
||||
["playerInventoryChanged", {
|
||||
if (isNull (_this select 0)) exitWith {
|
||||
GVAR(hasWatch) = true;
|
||||
};
|
||||
@ -145,4 +145,4 @@ GVAR(hasWatch) = true;
|
||||
if (_x isKindOf ["ItemWatch", configFile >> "CfgWeapons"]) exitWith {GVAR(hasWatch) = true;};
|
||||
false
|
||||
} count (assignedItems ACE_player);
|
||||
}] call CBA_fnc_addEventHandler;
|
||||
}] call EFUNC(common,addEventHandler);
|
||||
|
@ -28,6 +28,7 @@ class RscEdit;
|
||||
#include "CfgEventHandlers.hpp"
|
||||
#include "CfgMarkers.hpp"
|
||||
#include "CfgVehicles.hpp"
|
||||
#include "CfgWeapons.hpp"
|
||||
#include "CfgAmmo.hpp"
|
||||
#include "CfgSounds.hpp"
|
||||
#include "CfgLights.hpp"
|
||||
|
@ -26,7 +26,7 @@ if (!isNull _light) 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"};
|
||||
_class = format["ACE_FlashlightProxy_%1", _color];
|
||||
|
||||
|
@ -21,8 +21,8 @@ params ["_unit"];
|
||||
private _flashlights = [];
|
||||
|
||||
{
|
||||
if ((isText (configFile >> "CfgWeapons" >> _x >> "ItemInfo" >> "FlashLight" >> "ACE_Flashlight_Colour")) && !(_x in _flashlights)) then {
|
||||
_flashlights pushBack _x;
|
||||
if ((isText (configFile >> "CfgWeapons" >> _x >> "ItemInfo" >> QGVAR(flashlight) >> QGVAR(Flashlight_Color))) then {
|
||||
_flashlights pushBackUnique _x;
|
||||
};
|
||||
} forEach (items _unit);
|
||||
|
||||
|
@ -51,16 +51,14 @@ if (_flashlight == "") then {
|
||||
//ambient shade fill
|
||||
_mapCtrl drawIcon [_fillTex, [1,1,1,_shadeAlpha], _mapCentre, _screenSize, _screenSize, 0, "", 0];
|
||||
} else {
|
||||
private ["_mousePos", "_colour", "_size", "_flashTex", "_beamSize", "_viewPortRatioFixY", "_offsetX", "_offsetYDown", "_offsetYUp"];
|
||||
private ["_mousePos", "_cfg", "_size", "_flashTex", "_beamSize", "_viewPortRatioFixY", "_offsetX", "_offsetYDown", "_offsetYUp"];
|
||||
//mouse pos
|
||||
_mousePos = GVAR(mousePos);
|
||||
|
||||
//flashlight settings
|
||||
_colour = getText (configFile >> "CfgWeapons" >> _flashlight >> "ItemInfo" >> "FlashLight" >> "ACE_Flashlight_Colour");
|
||||
if !(_colour in ["white", "red", "green", "blue", "yellow"]) then {_colour = "white"};
|
||||
_size = getNumber (configFile >> "CfgWeapons" >> _flashlight >> "ItemInfo" >> "FlashLight" >> "ACE_Flashlight_Size");
|
||||
_flashTex = format[QUOTE(PATHTOF_SYS(ace,flashlights,UI\Flashlight_Beam_%1_ca.paa)), _colour];
|
||||
_beamSize = (safeZoneW/safeZoneWAbs) * _screenSize / _size;
|
||||
_cfg = (configFile >> "CfgWeapons" >> _flashlight >> "ItemInfo" >> QGVAR(Flashlight));
|
||||
_flashTex = getText (_cfg >> QGVAR(Flashlight_Beam));
|
||||
_size = getNumber (_cfg >> QGVAR(Flashlight_Size));
|
||||
|
||||
//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))};
|
||||
|
@ -1,9 +1,9 @@
|
||||
/*
|
||||
* Author: voioper
|
||||
* Switch flashlight.
|
||||
* Switch flashlight on/off.
|
||||
*
|
||||
* Arguments:
|
||||
* 0: Flashlight classname ("" for off) <STRING>
|
||||
* 0: New flashlight classname ("" for off) <STRING>
|
||||
*
|
||||
* Return value:
|
||||
* None
|
||||
@ -16,10 +16,18 @@
|
||||
|
||||
#include "script_component.hpp"
|
||||
|
||||
params ["_flashlight"];
|
||||
params ["_newFlashlight"];
|
||||
private _oldFlashlight = GVAR(flashlightInUse);
|
||||
|
||||
GVAR(flashlightInUse) = _flashlight;
|
||||
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