xpdb/addons/load/functions/fnc_environment.sqf
Jacob Schmidt 1b6b825653
All checks were successful
Build / Build (push) Successful in 53s
Initial Repo Setup
2025-01-01 21:18:03 -06:00

52 lines
1.6 KiB
Plaintext

#include "script_component.hpp"
/*
* Function: xpdb_load_fnc_environment
* Author: NikolaiF90, J.Schmidt
* Edit: 07.27.2024
* Copyright © 2024 NikolaiF90, J.Schmidt, All rights reserved
*
* Do not edit without permission!
*
* This work is licensed under the Creative Commons Attribution-NonCommercial-NoDerivative 4.0 International License.
* To view a copy of this license, vist https://creativecommons.org/licenses/by-nc-nd/4.0/ or send a letter to Creative Commons,
* PO Box 1866, Mountain View, CA 94042
*
* [Description]
* Load environment data from specified slot and change weather.
*
* Arguments:
* 0: ID of Slot <SCALAR> (default: 0)
*
* Return Value:
* N/A
*
* Examples:
* [1] call xpdb_load_fnc_environment
*
* Public: Yes
*/
params [["_slot", nil, [0]]];
[EGVAR(db,debug), "xpdb_load_fnc_environment", format ["Loading environment data from slot '%1'", _slot], false] call EFUNC(utils,debug);
private _environment = ["environment", _slot] call EFUNC(core,loadData);
if (isNil "_environment" || (count _environment) == 1) exitWith { [EGVAR(db,debug), "xpdb_load_fnc_environment", format ["No environment data to load from slot '%1'", _slot], false] call EFUNC(utils,debug); };
private _transitionTime = 15;
{
private _key = _x;
private _value = _y;
switch (_key) do {
case "date": { setDate _value };
case "rain": { _transitionTime setRain _value };
case "fog": { _transitionTime setFog _value };
case "overcast": { _transitionTime setOvercast _value };
};
} forEach _environment;
[EGVAR(db,debug), "xpdb_load_fnc_environment", "Environment data loaded.", false] call EFUNC(utils,debug);