mirror of
https://github.com/acemod/ACE3.git
synced 2024-08-30 18:23:18 +00:00
Merge pull request #377 from KoffeinFlummi/142light
142 directional light for map effects
This commit is contained in:
commit
1ae69d56ff
@ -63,7 +63,7 @@ if (_lightSource isKindOf "CAManBase") then {
|
||||
_lightLevel = (linearConversion [0, 30, _distance, 1, 0, true]) * (linearConversion [_innerAngle, _outerAngle, _angle, 1, 0, true]);
|
||||
|
||||
} else {
|
||||
// handle any object, strcutures, cars, tanks, etc.
|
||||
// handle any object, strcutures, cars, tanks, etc. @todo campfires, burning vehicles
|
||||
|
||||
private "_lights";
|
||||
_lights = [_lightSource] call FUNC(getTurnedOnLights);
|
||||
|
@ -66,10 +66,13 @@ if (_lightLevel > 0.95) exitWith {
|
||||
[false, [0.5,0.5,0.5,0]]
|
||||
};
|
||||
|
||||
private "_vehicle";
|
||||
_vehicle = vehicle _unit;
|
||||
|
||||
// Do not obscure the map if the player is on a enclosed vehicle (assume internal illumination)
|
||||
if (vehicle _unit != _unit) then {
|
||||
if (_vehicle != _unit) then {
|
||||
// Player is in a vehicle
|
||||
if ((vehicle _unit) isKindOf "Tank") then {
|
||||
if (isTurnedOut _unit && {_vehicle isKindOf "Tank" || {_vehicle isKindOf "Wheeled_APC"}}) then {
|
||||
_isEnclosed = true;
|
||||
};
|
||||
};
|
||||
@ -81,32 +84,10 @@ if (_isEnclosed) exitWith {
|
||||
// Player is not in a vehicle
|
||||
TRACE_1("Player is on foot or in an open vehicle","");
|
||||
|
||||
// Check if player is near a campfires, lights or vehicles with lights on - 15m
|
||||
_nearObjects = [nearestObjects [_unit, ["All"], 15], {(inflamed _this) || (isLightOn _this)}] call EFUNC(common,filter);
|
||||
if (count (_nearObjects) > 0) then {
|
||||
_light = _nearObjects select 0;
|
||||
|
||||
_ll = (1 - (((((_unit distance _light) - 5)/10) max 0) min 1));
|
||||
if (_ll > _lightLevel) then {
|
||||
_lightLevel = _ll;
|
||||
TRACE_1("player near campfire","");
|
||||
};
|
||||
};
|
||||
|
||||
|
||||
// Gun with light
|
||||
_nearObjects = [nearestObjects [_unit, ["CAManBase"], 10], { _this isFlashlightOn (currentWeapon _this)}] call EFUNC(common,filter);
|
||||
if (count (_nearObjects) > 0) then {
|
||||
_light = (_nearObjects select 0);
|
||||
_flashlight = (_light weaponAccessories currentMuzzle _light) select 1;
|
||||
|
||||
// Check if it's a day laser
|
||||
if (_flashlight == "ACE_acc_pointer_red") exitWith {};
|
||||
if (_flashlight == "ACE_acc_pointer_green") exitWith {};
|
||||
|
||||
_lightLevel = _lightLevel max (1 - (((((_unit distance _light) - 2)/8) max 0) min 1));
|
||||
TRACE_1("Using gun light","");
|
||||
};
|
||||
// Check if player is near a campfires, streetlamps, units with flashlights, vehicles with lights on, etc. - 40m
|
||||
{
|
||||
_lightLevel = _lightLevel max ([_unit, _x] call EFUNC(common,lightIntensityFromObject));
|
||||
} forEach nearestObjects [_unit, ["All"], 40];
|
||||
|
||||
|
||||
// @todo: Illumination flares (timed)
|
||||
|
Loading…
Reference in New Issue
Block a user