mirror of
https://github.com/acemod/ACE3.git
synced 2024-08-30 18:23:18 +00:00
Customized map lighting for vehicle interiors (#5401)
* Customized map lighting for vehicle interiors * Tabs for cases * Add wiki for new configs * V
This commit is contained in:
parent
c3986b0a04
commit
e7ebbd5750
@ -126,3 +126,43 @@ GVAR(hasWatch) = true;
|
||||
false
|
||||
} count (assignedItems _unit);
|
||||
}, true] call CBA_fnc_addPlayerEventHandler;
|
||||
|
||||
|
||||
// Vehicle map lighting:
|
||||
GVAR(vehicleLightCondition) = {true};
|
||||
GVAR(vehicleExteriorTurrets) = [];
|
||||
GVAR(vehicleLightColor) = [1,1,1,0];
|
||||
|
||||
["vehicle", {
|
||||
params ["_unit", "_vehicle"];
|
||||
if ((isNull _vehicle) || {_unit == _vehicle}) exitWith {};
|
||||
private _cfg = configfile >> "CfgVehicles" >> (typeOf _vehicle);
|
||||
GVAR(vehicleExteriorTurrets) = getArray (_cfg >> QGVAR(vehicleExteriorTurrets));
|
||||
GVAR(vehicleLightColor) = [_cfg >> QGVAR(vehicleLightColor), "array", [1,1,1,0]] call CBA_fnc_getConfigEntry;
|
||||
|
||||
// Handle vehicles with toggleable interior lights:
|
||||
private _vehicleLightCondition = getText (_cfg >> QGVAR(vehicleLightCondition));
|
||||
if (_vehicleLightCondition == "") then {
|
||||
private _userAction = toLower getText (_cfg >> "UserActions" >> "ToggleLight" >> "statement");
|
||||
switch (true) do {
|
||||
case ((_userAction find "cabinlights_hide") > 0): {_vehicleLightCondition = "(_vehicle animationSourcePhase 'cabinlights_hide') == 1";};
|
||||
case ((_userAction find "cargolights_hide") > 0): {_vehicleLightCondition = "(_vehicle animationSourcePhase 'cargolights_hide') == 1";};
|
||||
};
|
||||
};
|
||||
|
||||
GVAR(vehicleLightCondition) = if (_vehicleLightCondition != "") then {
|
||||
if (_vehicle isKindOf "Helicopter" || {_vehicle isKindOf "Plane"}) then {
|
||||
compile format ["(driver _vehicle == _unit) || {gunner _vehicle == _unit} || {%1}", _vehicleLightCondition];
|
||||
} else {
|
||||
compile _vehicleLightCondition
|
||||
};
|
||||
} else {
|
||||
switch (true) do {
|
||||
case (_vehicle isKindOf "Tank");
|
||||
case (_vehicle isKindOf "Wheeled_APC"): { {true} };
|
||||
case (_vehicle isKindOf "Helicopter");
|
||||
case (_vehicle isKindOf "Plane"): { {(driver _vehicle == _unit) || {gunner _vehicle == _unit}} };
|
||||
default { {false} };
|
||||
};
|
||||
};
|
||||
}, true] call CBA_fnc_addPlayerEventHandler;
|
||||
|
@ -47,9 +47,9 @@ if (_lightLevel > 0.95) exitWith {
|
||||
private _vehicle = vehicle _unit;
|
||||
|
||||
// Do not obscure the map if the player is on a enclosed vehicle (assume internal illumination)
|
||||
if ((_vehicle != _unit) && {!isTurnedOut _unit && {_vehicle isKindOf "Tank" || {(_vehicle isKindOf "Helicopter" || _vehicle isKindOf "Plane") && {driver _vehicle == _unit || {gunner _vehicle == _unit}}} || {_vehicle isKindOf "Wheeled_APC"}}}) exitWith {
|
||||
TRACE_1("Player in a enclosed vehicle","");
|
||||
[false, [1,1,1,0]]
|
||||
if ((_vehicle != _unit) && {(!isTurnedOut _unit)} && GVAR(vehicleLightCondition) && {!((_unit call CBA_fnc_turretPath) in GVAR(vehicleExteriorTurrets))}) exitWith {
|
||||
TRACE_1("Player in a enclosed vehicle",GVAR(vehicleLightColor));
|
||||
[!(GVAR(vehicleLightColor) isEqualTo [1,1,1,0]), GVAR(vehicleLightColor)]
|
||||
};
|
||||
|
||||
// Player is not in a vehicle
|
||||
|
30
docs/wiki/framework/map-framework.md
Normal file
30
docs/wiki/framework/map-framework.md
Normal file
@ -0,0 +1,30 @@
|
||||
---
|
||||
layout: wiki
|
||||
title: Map Framework
|
||||
description: Explains the Map system for developers
|
||||
group: framework
|
||||
order: 5
|
||||
parent: wiki
|
||||
mod: ace
|
||||
version:
|
||||
major: 3
|
||||
minor: 11
|
||||
patch: 0
|
||||
---
|
||||
|
||||
## 1. Config Values
|
||||
|
||||
### 1.1 Vehicle Interior Lighting
|
||||
|
||||
```cpp
|
||||
class CfgVehicles {
|
||||
class MyCar {
|
||||
// Sets color of light projected onto player's map
|
||||
ace_map_vehicleLightColor[] = {0,1,0,0.1};
|
||||
|
||||
// Lists turret indexes that are outside of the vehicle and would not recieve interior lighting (e.g. riding on top of a tank)
|
||||
ace_map_vehicleExteriorTurrets[] = {12,13};
|
||||
|
||||
// Condition for interior lights to be working (string that when compiled and call should return a bool, will be passed _vehicle)
|
||||
ace_map_vehicleLightCondition[] = "(_vehicle animationSourcePhase 'cabinlights_hide') == 1";
|
||||
```
|
@ -107,6 +107,7 @@ class CfgVehicles {
|
||||
};
|
||||
};
|
||||
class rhs_bmp1tank_base: Tank_F {
|
||||
EGVAR(map,vehicleLightColor)[] = {0,1,0,0.1};
|
||||
EGVAR(refuel,fuelCapacity) = 460;
|
||||
class Turrets: Turrets {
|
||||
class MainTurret: MainTurret {
|
||||
@ -147,6 +148,7 @@ class CfgVehicles {
|
||||
};
|
||||
};
|
||||
class rhs_btr_base: Wheeled_APC_F {
|
||||
EGVAR(map,vehicleLightColor)[] = {0,0,1,0.1};
|
||||
EGVAR(refuel,fuelCapacity) = 300;
|
||||
class Turrets: Turrets {
|
||||
class MainTurret: MainTurret {
|
||||
@ -271,6 +273,7 @@ class CfgVehicles {
|
||||
};
|
||||
class Heli_Light_02_base_F: Helicopter_Base_H {};
|
||||
class RHS_Mi8_base : Heli_Light_02_base_F {
|
||||
EGVAR(map,vehicleLightColor)[] = {1,0,0,0.1};
|
||||
EGVAR(refuel,fuelCapacity) = 3700;
|
||||
EGVAR(fastroping,enabled) = 0;
|
||||
class EventHandlers: EventHandlers {
|
||||
@ -340,6 +343,7 @@ class CfgVehicles {
|
||||
};
|
||||
|
||||
class RHS_Mi24_base : Heli_Attack_02_base_F {
|
||||
EGVAR(map,vehicleLightColor)[] = {1,0,0,0.1};
|
||||
EGVAR(refuel,fuelCapacity) = 1851;
|
||||
EGVAR(fastroping,enabled) = 0;
|
||||
class Turrets: Turrets {
|
||||
|
@ -232,6 +232,7 @@ class CfgVehicles {
|
||||
};
|
||||
|
||||
class rhsusf_CH53E_USMC: Helicopter_Base_H {
|
||||
EGVAR(map,vehicleLightColor)[] = {1,0,0,0.1};
|
||||
EGVAR(fastroping,enabled) = 1;
|
||||
EGVAR(fastroping,ropeOrigins)[] = {{0,-9.5,2.6}};
|
||||
EGVAR(fastroping,onCut) = QFUNC(onCut);
|
||||
@ -338,6 +339,7 @@ class CfgVehicles {
|
||||
|
||||
class APC_Tracked_02_base_F: Tank_F {};
|
||||
class rhsusf_m113tank_base: APC_Tracked_02_base_F {
|
||||
EGVAR(map,vehicleLightColor)[] = {0,1,0,0.1};
|
||||
EGVAR(refuel,fuelCapacity) = 360;
|
||||
class Turrets: Turrets {
|
||||
class MainTurret: MainTurret {
|
||||
|
Loading…
Reference in New Issue
Block a user