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

@@ -21,12 +21,26 @@ Author:
#define SEARCH_SLOPE_MAX 1000
#define SEARCH_BLACKLIST [[[12923,3643],[14275,2601]]]
private ["_typeGroup","_position","_type","_class","_vehicle","_loot","_lootGroup","_lootNum","_lootPos","_lootVeh","_size"];
private
[
"_typeGroup",
"_position",
"_type",
"_class",
"_vehicle",
"_loot",
"_lootGroup",
"_lootNum",
"_lootPos",
"_lootVeh",
"_size"
];
_lootGroup = Loot_GetGroup("CarePackage");
_typeGroup = Loot_GetGroup("CarePackageType");
for "_i" from 1 to (SPAWN_NUM) do {
for "_i" from 1 to (SPAWN_NUM) do
{
_type = Loot_SelectSingle(_typeGroup);
_class = _type select 1;
_lootNum = round Math_RandomRange(_type select 2, _type select 3);
@@ -49,15 +63,21 @@ for "_i" from 1 to (SPAWN_NUM) do {
_lootVeh = Loot_Spawn(_x, _lootPos);
_lootVeh setVariable ["permaLoot", true];
switch (dayz_spawncarepkgs_clutterCutter) do {
case 1: { //Lift loot up by 5cm
switch (dayz_spawncarepkgs_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"];
};
};

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;
};
};

View File

@@ -35,19 +35,32 @@ Author:
#define SEARCH_PRECISION 30
#define SEARCH_ATTEMPTS 10
private ["_typeGroup","_lootGroup","_objectGroup","_type","_position","_composition","_compositionObjects","_objectPos"];
private
[
"_typeGroup",
"_lootGroup",
"_objectGroup",
"_type",
"_position",
"_composition",
"_compositionObjects",
"_objectPos"
];
_typeGroup = Loot_GetGroup("InfectedCampType");
_lootGroup = Loot_GetGroup("InfectedCamp");
_objectGroup = Loot_GetGroup("InfectedCampObject");
for "_i" from 1 to (CAMP_NUM) do {
for "_i" from 1 to (CAMP_NUM) do
{
//Select type of camp
_type = Loot_SelectSingle(_typeGroup);
_composition = _type select 1;
//Find a position
for "_j" from 1 to (SEARCH_ATTEMPTS) do {
for "_j" from 1 to (SEARCH_ATTEMPTS) do
{
_position = ((selectBestPlaces [SEARCH_CENTER, SEARCH_RADIUS, SEARCH_EXPRESSION, SEARCH_PRECISION, 1]) select 0) select 0;
_position set [2, 0];
@@ -62,7 +75,8 @@ for "_i" from 1 to (CAMP_NUM) do {
//Add loot to containers
{
if (_x isKindOf (CAMP_CONTAINER_BASE)) then {
if (_x isKindOf (CAMP_CONTAINER_BASE)) then
{
Loot_InsertCargo(_x, _lootGroup, round Math_RandomRange(LOOT_MIN, LOOT_MAX));
};
} forEach _compositionObjects;