Actions cleanup

This commit is contained in:
ebaydayz
2016-03-29 14:47:28 -04:00
parent e1a0bfebc1
commit 71b975b05e
38 changed files with 330 additions and 503 deletions

View File

@@ -34,11 +34,31 @@ Author:
#define LOOT_MIN 5
#define LOOT_MAX 8
private ["_debugZone","_spawnCrashSite","_type","_class","_lootGroup","_position","_vehicle","_lootParams","_dir","_mag","_lootNum","_lootPos","_lootVeh","_lootpos","_time"];
private
[
"_debugZone",
"_spawnCrashSite",
"_type",
"_class",
"_lootGroup",
"_position",
"_vehicle",
// "_size",
// "_loot",
"_lootParams",
"_dir",
"_mag",
"_lootNum",
"_lootPos",
"_lootVeh",
"_lootpos",
"_time"
];
diag_log format ["CRASHSPAWNER: Starting crash site spawner. Frequency: %1±%2 min. Spawn chance: %3", SPAWN_FREQUENCY, SPAWN_VARIANCE, SPAWN_CHANCE];
_spawnCrashSite = {
_spawnCrashSite =
{
_type = Loot_SelectSingle(Loot_GetGroup("CrashSiteType"));
_class = _type select 1;
_lootGroup = Loot_GetGroup(_type select 2);
@@ -71,36 +91,49 @@ _spawnCrashSite = {
_lootVeh = Loot_Spawn(_x, _lootPos);
_lootVeh setVariable ["permaLoot", true];
switch (dayz_spawnCrashSite_clutterCutter) do {
case 1: { //Lift loot up by 5cm
switch (dayz_spawnCrashSite_clutterCutter) do
{
case 1: //Lift loot up by 5cm
{
_lootPos set [2, 0.05];
_lootVeh setPosATL _lootpos;
};
case 2: { //Clutter cutter
case 2: //Clutter cutter
{
createVehicle ["ClutterCutter_small_2_EP1", _lootPos, [], 0, "CAN_COLLIDE"];
};
case 3: { //Debug sphere
case 3: //Debug sphere
{
createVehicle ["Sign_sphere100cm_EP1", _lootPos, [], 0, "CAN_COLLIDE"];
};
};
} forEach Loot_Select(_lootGroup, _lootNum);
}
forEach Loot_Select(_lootGroup, _lootNum);
};
//Spawn initial crash sites
for "_i" from 1 to (INITIAL_NUM) do {
for "_i" from 1 to (INITIAL_NUM) do
{
call _spawnCrashSite;
};
while {true} do {
while {true} do
{
//Pick a time to attempt spawning
//currentTime + frequency + ±1 * variance
_time = time + 60 * ((SPAWN_FREQUENCY) + ((round random 1) * 2 - 1) * random (SPAWN_VARIANCE));
//Wait until the previously decided time
while {time < _time} do {
while {time < _time} do
{
uiSleep (60 * (SPAWN_FREQUENCY) / (TIMER_RESOLUTION));
};
//try to spawn
if ((SPAWN_CHANCE) > random 1) then {call _spawnCrashSite;};
if ((SPAWN_CHANCE) > random 1) then
{
call _spawnCrashSite;
};
};