Epoch/Sources/epoch_server_settings/EpochEvents/EarthQuake.sqf
vbawol dabb8ff068 0.3.8.0439
[Fixed] BE kick since 1.58 hotfix.
[Fixed] Attempt fix issues with temporary angle and rotation issues with
base building.
[Fixed] Check for base kit item is in players inventory before spawning
ghost.
[Fixed] Use object as input for remoteExec instead of owner.
http://epochmod.com/forum/topic/41959-be-carefull-with-remoteexec-and-owner/
2016-04-29 09:28:51 -05:00

36 lines
1.5 KiB
Plaintext

/*
Earthquake and Mineral Deposit Event
by Aaron Clark - EpochMod.com
This work is licensed under a Creative Commons Attribution-NonCommercial-NoDerivatives 4.0 International License.
http://creativecommons.org/licenses/by-nc-nd/4.0/
Improvements and or bugfixes and other contributions are welcome via the github:
https://github.com/EpochModTeam/Epoch/tree/master/Sources/epoch_server_settings/EpochEvents/Earthquake.sqf
*/
private ["_marker","_minerals","_randomIndex","_item","_playersNearEpicenter","_position","_chance"];
_position = [epoch_centerMarkerPosition, 0, EPOCH_dynamicVehicleArea, 10, 0, 1000, 0] call BIS_fnc_findSafePos;
if ((count _position) == 2) then{
_playersNearEpicenter = _position nearEntities[["Epoch_Male_F", "Epoch_Female_F"], 1000];
if !(_playersNearEpicenter isEqualTo[]) then{
// decrease chance with more players
_chance = linearConversion [1, 100, (count allPlayers), 0, 0.5, true];
if ((random 1) > _chance) then {
// send earthquake to each player in zone
{
[_position] remoteExec ['EPOCH_client_earthQuake',_x];
}forEach _playersNearEpicenter;
// todo configize
_minerals = ["MineralDepositCopper_EPOCH", "MineralDepositGold_EPOCH", "MineralDepositSilver_EPOCH"];
_item = createVehicle[(selectRandom _minerals), _position, [], 0.0, "CAN_COLLIDE"];
if (EPOCH_showEarthQuakes) then{
_marker = createMarker[str(_position), _position];
_marker setMarkerShape "ICON";
_marker setMarkerType "mil_dot";
// _marker setMarkerText "Mineral";
_marker setMarkerColor "ColorGrey";
};
};
};
};