Merge pull request #1082 from Fank/Feature/1072

Added DZE_StaticConstructionCount
This commit is contained in:
vbawol
2014-02-06 12:24:30 -06:00
3 changed files with 154 additions and 141 deletions

View File

@@ -56,7 +56,7 @@ _needNear = getArray (configFile >> "CfgMagazines" >> _item >> "ItemActions" >>
case "fire":
{
_isNear = {inflamed _x} count (getPosATL player nearObjects _distance);
if(_isNear == 0) then {
if(_isNear == 0) then {
_abort = true;
_reason = "fire";
};
@@ -64,7 +64,7 @@ _needNear = getArray (configFile >> "CfgMagazines" >> _item >> "ItemActions" >>
case "workshop":
{
_isNear = count (nearestObjects [player, ["Wooden_shed_DZ","WoodShack_DZ","WorkBench_DZ"], _distance]);
if(_isNear == 0) then {
if(_isNear == 0) then {
_abort = true;
_reason = "workshop";
};
@@ -72,7 +72,7 @@ _needNear = getArray (configFile >> "CfgMagazines" >> _item >> "ItemActions" >>
case "fueltank":
{
_isNear = count (nearestObjects [player, dayz_fuelsources, _distance]);
if(_isNear == 0) then {
if(_isNear == 0) then {
_abort = true;
_reason = "fuel tank";
_distance = 30;
@@ -147,11 +147,11 @@ if(_IsNearPlot == 0) then {
} else {
// Since there are plots nearby we check for ownership and then for friend status
// check nearby plots ownership and then for friend status
_nearestPole = _findNearestPole select 0;
// Find owner
// Find owner
_ownerID = _nearestPole getVariable["CharacterID","0"];
// diag_log format["DEBUG BUILDING: %1 = %2", dayz_characterID, _ownerID];
@@ -160,7 +160,7 @@ if(_IsNearPlot == 0) then {
if(dayz_characterID == _ownerID) then { //Keep ownership
// owner can build anything within his plot except other plots
if(!_isPole) then {
_canBuildOnPlot = true;
_canBuildOnPlot = true;
};
} else {
@@ -204,21 +204,21 @@ if (_hasrequireditem) then {
};
_object = createVehicle [_classname, _location, [], 0, "CAN_COLLIDE"];
_object attachTo [player,_offset];
_position = getPosATL _object;
cutText [(localize "str_epoch_player_45"), "PLAIN DOWN"];
_objHDiff = 0;
while {_isOk} do {
_zheightchanged = false;
_zheightdirection = "";
_rotate = false;
if (DZE_Q) then {
DZE_Q = false;
_zheightdirection = "up";
@@ -227,7 +227,7 @@ if (_hasrequireditem) then {
if (DZE_Z) then {
DZE_Z = false;
_zheightdirection = "down";
_zheightchanged = true;
_zheightchanged = true;
};
if (DZE_Q_alt) then {
DZE_Q_alt = false;
@@ -259,7 +259,7 @@ if (_hasrequireditem) then {
DZE_6 = false;
_dir = 0;
};
if(_rotate) then {
_object setDir _dir;
_object setPosATL _position;
@@ -297,7 +297,7 @@ if (_hasrequireditem) then {
_position set [2,((_position select 2)-0.01)];
_objHDiff = _objHDiff - 0.01;
};
_object setDir (getDir _object);
if((_isAllowedUnderGround == 0) and ((_position select 2) < 0)) then {
@@ -305,13 +305,13 @@ if (_hasrequireditem) then {
};
_object setPosATL _position;
//diag_log format["DEBUG Change BUILDING POS: %1", _position];
_object attachTo [player];
};
sleep 0.5;
_location2 = getPosATL player;
@@ -324,19 +324,19 @@ if (_hasrequireditem) then {
//diag_log format["DEBUG BUILDING POS: %1", _position];
deleteVehicle _object;
};
if(_location1 distance _location2 > 5) exitWith {
_isOk = false;
_cancel = true;
_reason = "You've moved to far away from where you started building (within 5 meters)";
_reason = "You've moved to far away from where you started building (within 5 meters)";
detach _object;
deleteVehicle _object;
};
if(abs(_objHDiff) > 5) exitWith {
_isOk = false;
_cancel = true;
_reason = "Cannot move up or down more than 5 meters";
_reason = "Cannot move up or down more than 5 meters";
detach _object;
deleteVehicle _object;
};
@@ -371,49 +371,54 @@ if (_hasrequireditem) then {
_classname = _classnametmp;
// Start Build
// Start Build
_tmpbuilt = createVehicle [_classname, _location, [], 0, "CAN_COLLIDE"];
_tmpbuilt setdir _dir;
// Get position based on object
_location = _position;
if((_isAllowedUnderGround == 0) and ((_location select 2) < 0)) then {
_location set [2,0];
};
_tmpbuilt setPosATL _location;
cutText [format[(localize "str_epoch_player_138"),_text], "PLAIN DOWN"];
_limit = 3;
if(isNumber (configFile >> "CfgVehicles" >> _classname >> "constructioncount")) then {
_limit = getNumber(configFile >> "CfgVehicles" >> _classname >> "constructioncount");
if (DZE_StaticConstructionCount > 0) then {
_limit = DZE_StaticConstructionCount;
}
else {
if (isNumber (configFile >> "CfgVehicles" >> _classname >> "constructioncount")) then {
_limit = getNumber(configFile >> "CfgVehicles" >> _classname >> "constructioncount");
};
};
_isOk = true;
_proceed = false;
_counter = 0;
while {_isOk} do {
[10,10] call dayz_HungerThirst;
player playActionNow "Medic";
_dis=20;
_sfx = "repair";
[player,_sfx,0,false,_dis] call dayz_zombieSpeak;
[player,_sfx,0,false,_dis] call dayz_zombieSpeak;
[player,_dis,true,(getPosATL player)] spawn player_alertZombies;
r_interrupt = false;
_animState = animationState player;
r_doLoop = true;
_started = false;
_finished = false;
while {r_doLoop} do {
_animState = animationState player;
_isMedic = ["medic",_animState] call fnc_inString;
@@ -450,16 +455,16 @@ if (_hasrequireditem) then {
_isOk = false;
_proceed = true;
};
};
if (_proceed) then {
_num_removed = ([player,_item] call BIS_fnc_invRemove);
if(_num_removed == 1) then {
cutText [format[localize "str_build_01",_text], "PLAIN DOWN"];
if (_isPole) then {
[] spawn player_plotPreview;
};
@@ -467,11 +472,11 @@ if (_hasrequireditem) then {
_tmpbuilt setVariable ["OEMPos",_location,true];
if(_lockable > 1) then {
_combinationDisplay = "";
switch (_lockable) do {
case 2: { // 2 lockbox
_combination_1 = (floor(random 3)) + 100; // 100=red,101=green,102=blue
_combination_2 = floor(random 10);
@@ -489,7 +494,7 @@ if (_hasrequireditem) then {
};
_combinationDisplay = format["%1%2%3",_combination_1_Display,_combination_2,_combination_3];
};
case 3: { // 3 combolock
_combination_1 = floor(random 10);
_combination_2 = floor(random 10);
@@ -498,7 +503,7 @@ if (_hasrequireditem) then {
dayz_combination = _combination;
_combinationDisplay = _combination;
};
case 4: { // 4 safe
_combination_1 = floor(random 10);
_combination_2 = floor(random 10);
@@ -511,17 +516,17 @@ if (_hasrequireditem) then {
};
_tmpbuilt setVariable ["CharacterID",_combination,true];
PVDZE_obj_Publish = [_combination,_tmpbuilt,[_dir,_location],_classname];
publicVariableServer "PVDZE_obj_Publish";
cutText [format[(localize "str_epoch_player_140"),_combinationDisplay,_text], "PLAIN DOWN", 5];
} else {
_tmpbuilt setVariable ["CharacterID",dayz_characterID,true];
// fire?
if(_tmpbuilt isKindOf "Land_Fire_DZ") then {
_tmpbuilt spawn player_fireMonitor;

View File

@@ -27,7 +27,7 @@ _isOk = true;
_proceed = false;
_objType = typeOf _obj;
// Chance to break tools
// Chance to break tools
_isDestructable = _obj isKindOf "BuiltItems";
_isWreck = _objType in DZE_isWreck;
_isRemovable = _objType in DZE_isRemovable;
@@ -36,8 +36,13 @@ _isMine = _objType in ["Land_iron_vein_wreck","Land_silver_vein_wreck","Land_gol
_isModular = _obj isKindOf "ModularItems";
_limit = 3;
if(isNumber (configFile >> "CfgVehicles" >> _objType >> "constructioncount")) then {
_limit = getNumber(configFile >> "CfgVehicles" >> _objType >> "constructioncount");
if (DZE_StaticConstructionCount > 0) then {
_limit = DZE_StaticConstructionCount;
}
else {
if (isNumber (configFile >> "CfgVehicles" >> _objType >> "constructioncount")) then {
_limit = getNumber(configFile >> "_objType" >> _classname >> "constructioncount");
};
};
_findNearestPoles = nearestObjects[player, ["Plastic_Pole_EP1_DZ"], 30];
@@ -50,12 +55,12 @@ if(_IsNearPlot >= 1) then {
_nearestPole = _findNearestPole select 0;
// Find owner
// Find owner
_ownerID = _nearestPole getVariable["CharacterID","0"];
// check if friendly to owner
if(dayz_characterID != _ownerID) then {
_friendlies = player getVariable ["friendlyTo",[]];
// check if friendly to owner
if(!(_ownerID in _friendlies)) then {
@@ -91,7 +96,7 @@ while {_isOk} do {
player playActionNow "Medic";
_dis=20;
[player,_dis,true,(getPosATL player)] spawn player_alertZombies;
r_interrupt = false;
_animState = animationState player;
r_doLoop = true;
@@ -113,9 +118,9 @@ while {_isOk} do {
if (r_interrupt) then {
r_doLoop = false;
};
sleep 0.1;
};
if(!_finished) exitWith {
@@ -143,7 +148,7 @@ while {_isOk} do {
_isOk = false;
_proceed = true;
};
};
@@ -161,21 +166,21 @@ if(_brokenTool) then {
// Remove only if player waited
if (_proceed) then {
// Double check that object is not null
if(!isNull(_obj)) then {
_ipos = getPosATL _obj;
deleteVehicle _obj;
if(!_isWreck) then {
PVDZE_obj_Delete = [_objectID,_objectUID,_activatingPlayer];
publicVariableServer "PVDZE_obj_Delete";
};
cutText [format[(localize "str_epoch_player_165"),_nameVehicle], "PLAIN DOWN"];
_preventRefund = false;
_selectedRemoveOutput = [];
@@ -189,10 +194,10 @@ if (_proceed) then {
} else {
_selectedRemoveOutput = getArray (configFile >> "CfgVehicles" >> _objType >> "removeoutput");
_preventRefund = (_objectID == "0" && _objectUID == "0");
};
};
if((count _selectedRemoveOutput) <= 0) then {
cutText [(localize "str_epoch_player_90"), "PLAIN DOWN"];
};
@@ -220,7 +225,7 @@ if (_proceed) then {
if (typeName _countOut == "ARRAY") then {
_countOut = round((random (_countOut select 1)) + (_countOut select 0));
};
_item addMagazineCargoGlobal [_itemOut,_countOut];
_item addMagazineCargoGlobal [_itemOut,_countOut];
} forEach _selectedRemoveOutput;
_item setposATL _iPos;

View File

@@ -18,26 +18,26 @@ AllPlayers = ["Survivor2_DZ","SurvivorWcombat_DZ","SurvivorWdesert_DZ","Survivor
//Cooking
meatraw = [
"FoodSteakRaw",
"FoodmeatRaw",
"FoodbeefRaw",
"FoodmuttonRaw",
"FoodchickenRaw",
"FoodrabbitRaw",
"FoodbaconRaw",
"FoodSteakRaw",
"FoodmeatRaw",
"FoodbeefRaw",
"FoodmuttonRaw",
"FoodchickenRaw",
"FoodrabbitRaw",
"FoodbaconRaw",
"ItemTrout",
"ItemSeaBass",
"ItemTuna"
];
exceptionsraw = ["ItemTuna"];
meatcooked = [
"FoodSteakCooked",
"FoodmeatCooked",
"FoodbeefCooked",
"FoodmuttonCooked",
"FoodchickenCooked",
"FoodrabbitCooked",
"FoodbaconCooked",
"FoodSteakCooked",
"FoodmeatCooked",
"FoodbeefCooked",
"FoodmuttonCooked",
"FoodchickenCooked",
"FoodrabbitCooked",
"FoodbaconCooked",
"ItemTroutCooked",
"ItemSeaBassCooked",
"ItemTunaCooked"
@@ -49,10 +49,10 @@ no_output_food = ["FoodMRE", "FoodPistachio", "FoodNutmix","FoodBioMeat"]+meatco
badfood = ["FoodBioMeat","FoodCanUnlabeled"];
food_with_output=[
"FoodCanBakedBeans",
"FoodCanSardines",
"FoodCanFrankBeans",
"FoodCanPasta",
"FoodCanBakedBeans",
"FoodCanSardines",
"FoodCanFrankBeans",
"FoodCanPasta",
"FoodCanGriff",
"FoodCanBadguy",
"FoodCanBoneboy",
@@ -68,10 +68,10 @@ food_with_output=[
];
food_output = [
"TrashTinCan",
"TrashTinCan",
"TrashTinCan",
"TrashTinCan",
"TrashTinCan",
"TrashTinCan",
"TrashTinCan",
"TrashTinCan",
"FoodCanGriffEmpty",
"FoodCanBadguyEmpty",
"FoodCanBoneboyEmpty",
@@ -88,41 +88,41 @@ food_output = [
//Drinking
no_output_drink = ["ItemWaterbottle", "ItemWaterbottleBoiled"];
drink_with_output = [
"ItemSoda", //just to define item for ItemSodaEmpty
"ItemSoda", //just to define item for ItemSodaEmpty
"ItemSodaRbull",
"ItemSodaOrangeSherbet",
"ItemSodaCoke",
"ItemSodaPepsi",
"ItemSodaMdew",
"ItemSodaMtngreen",
"ItemSodaR4z0r",
"ItemSodaClays",
"ItemSodaSmasht",
"ItemSodaDrwaste",
"ItemSodaLemonade",
"ItemSodaLvg",
"ItemSodaMzly",
"ItemSodaRabbit"
"ItemSodaCoke",
"ItemSodaPepsi",
"ItemSodaMdew",
"ItemSodaMtngreen",
"ItemSodaR4z0r",
"ItemSodaClays",
"ItemSodaSmasht",
"ItemSodaDrwaste",
"ItemSodaLemonade",
"ItemSodaLvg",
"ItemSodaMzly",
"ItemSodaRabbit"
];
drink_output = [
"ItemSodaEmpty",
"ItemSodaEmpty",
"ItemSodaEmpty",
"ItemSodaCokeEmpty",
"ItemSodaPepsiEmpty",
"ItemSodaMdewEmpty",
"ItemSodaMtngreenEmpty",
"ItemSodaR4z0rEmpty",
"ItemSodaClaysEmpty",
"ItemSodaSmashtEmpty",
"ItemSodaDrwasteEmpty",
"ItemSodaLemonadeEmpty",
"ItemSodaLvgEmpty",
"ItemSodaMzlyEmpty",
"ItemSodaRabbitEmpty"
"ItemSodaEmpty",
"ItemSodaEmpty",
"ItemSodaEmpty",
"ItemSodaCokeEmpty",
"ItemSodaPepsiEmpty",
"ItemSodaMdewEmpty",
"ItemSodaMtngreenEmpty",
"ItemSodaR4z0rEmpty",
"ItemSodaClaysEmpty",
"ItemSodaSmashtEmpty",
"ItemSodaDrwasteEmpty",
"ItemSodaLemonadeEmpty",
"ItemSodaLvgEmpty",
"ItemSodaMzlyEmpty",
"ItemSodaRabbitEmpty"
];
boil_tin_cans = [
"TrashTinCan",
"TrashTinCan",
"FoodCanGriffEmpty",
"FoodCanBadguyEmpty",
"FoodCanBoneboyEmpty",
@@ -135,19 +135,19 @@ boil_tin_cans = [
"FoodCanPowellEmpty",
"FoodCanTylersEmpty",
"FoodCanUnlabeledEmpty",
"ItemSodaEmpty",
"ItemSodaCokeEmpty",
"ItemSodaPepsiEmpty",
"ItemSodaMdewEmpty",
"ItemSodaMtngreenEmpty",
"ItemSodaR4z0rEmpty",
"ItemSodaClaysEmpty",
"ItemSodaSmashtEmpty",
"ItemSodaDrwasteEmpty",
"ItemSodaLemonadeEmpty",
"ItemSodaLvgEmpty",
"ItemSodaMzlyEmpty",
"ItemSodaRabbitEmpty"
"ItemSodaEmpty",
"ItemSodaCokeEmpty",
"ItemSodaPepsiEmpty",
"ItemSodaMdewEmpty",
"ItemSodaMtngreenEmpty",
"ItemSodaR4z0rEmpty",
"ItemSodaClaysEmpty",
"ItemSodaSmashtEmpty",
"ItemSodaDrwasteEmpty",
"ItemSodaLemonadeEmpty",
"ItemSodaLvgEmpty",
"ItemSodaMzlyEmpty",
"ItemSodaRabbitEmpty"
];
dayz_combination = "";
@@ -245,7 +245,7 @@ dayz_resetSelfActions = {
s_halo_action = -1;
s_player_SurrenderedGear = -1;
s_player_maintain_area = -1;
s_player_maintain_area_preview = -1;
s_player_maintain_area_preview = -1;
s_player_heli_lift = -1;
s_player_heli_detach = -1;
};
@@ -256,7 +256,7 @@ s_player_lastTarget = [objNull,objNull,objNull,objNull,objNull];
s_player_repairActions = [];
s_player_lockunlock = [];
// Custom
// Custom
s_player_madsci = [];
s_player_parts = [];
s_player_combi = [];
@@ -417,7 +417,7 @@ dayz_selectedDoor = objNull;
PVDZE_veh_Publish = []; // for vehicle traders
PVDZE_obj_Trade = []; // For all traders increment qty
PVDZE_plr_TradeMenu = []; // For all traders
PVDZE_plr_TradeMenu = []; // For all traders
PVDZE_plr_DeathB = [];
//DayZ settings
@@ -505,6 +505,9 @@ if(isNil "DZE_HeliLift") then {
if(isNil "DZE_DamageBeforeMaint") then {
DZE_DamageBeforeMaint = 0.09;
};
if(isNil "DZE_StaticConstructionCount") then {
DZE_StaticConstructionCount = 0;
};
// needed on server
@@ -563,7 +566,7 @@ if(isServer) then {
dayz_players = [];
dead_bodyCleanup = [];
needUpdate_objects = [];
DZE_DYN_AntiStuck = 0;
DZE_DYN_AntiStuck2nd = 0;
DZE_DYN_AntiStuck3rd = 0;
@@ -581,38 +584,38 @@ if(isServer) then {
if(isNil "DZE_BackpackGuard") then {
DZE_BackpackGuard = true;
};
if(isNil "DZE_CleanNull") then {
DZE_CleanNull = false;
};
DZE_safeVehicle = ["ParachuteWest","ParachuteC"];
};
if(!isDedicated) then {
dayz_spawnPos = getPosATL player;
dayz_buildingMonitor = []; //Buildings to check
dayz_bodyMonitor = [];
// weather control var
zeroPreviousWeather = [0,0,[0,0],0];
zeroCurrentWeather = [0,0,[0,0],0];
if (DZE_MissionLootTable) then {
dayz_baseTypes = getArray (missionConfigFile >> "CfgBuildingLoot" >> "Default" >> "zombieClass");
} else {
dayz_baseTypes = getArray (configFile >> "CfgBuildingLoot" >> "Default" >> "zombieClass");
};
//temperature variables
dayz_temperatur = 36; //TeeChange
dayz_temperaturnormal = 36; //TeeChange
dayz_temperaturmax = 42; //TeeChange
dayz_temperaturmin = 27; //TeeChange
//player special variables
dayZ_lastPlayerUpdate = 0;
dayZ_everyonesTents = [];
@@ -689,7 +692,7 @@ if(!isDedicated) then {
if(isNil "DZE_HaloJump") then {
DZE_HaloJump = true;
};
if(isNil "DZE_AntiWallLimit") then {
DZE_AntiWallLimit = 1;
};
@@ -699,14 +702,14 @@ if(!isDedicated) then {
if(isNil "DZE_R3F_WEIGHT") then {
DZE_R3F_WEIGHT = true;
};
DZE_AntiWallCounter = 0;
DZE_FreshSpawn = false;
DZE_myHaloVehicle = objNull;
DZE_Friends = [];
DZE_CanPickup = true;