mirror of
https://github.com/EpochModTeam/DayZ-Epoch.git
synced 2025-12-14 20:13:13 +03:00
Move unused functions to another folder
This commit is contained in:
@@ -1,105 +0,0 @@
|
||||
/***********************************************************
|
||||
ASSIGN DAMAGE TO A Object.
|
||||
Called by "HandleDamage" vehicle Event Handler
|
||||
|
||||
- Function fnc_Obj_FenceHandleDam
|
||||
Wooden Defaults - [Object,[High Explosive(1),Medium Explosive(0.5),Melee damage(0.00001 + random(0.05))]] call fnc_Obj_FenceHandleDam;
|
||||
Metal Defaults - [Object,[High Explosive(0.5),Medium Explosive(0.25),Melee damage(0.00001 + random(0.005))]] call fnc_Obj_FenceHandleDam;
|
||||
- return : 0 no damage
|
||||
|
||||
--Note, Melee damage runs this script 12 times per hit.
|
||||
************************************************************/
|
||||
|
||||
/*
|
||||
private["_obj","_total","_damage"];
|
||||
|
||||
//Object the EH is assigned too
|
||||
_obj = ((_this select 0) select 0);
|
||||
//array holding dam sent to the eventhandler
|
||||
//_damageArray _this select 1;
|
||||
|
||||
if !(((_this select 0) select 4) in ["PipeBomb","explosive_bolt","Hatchet_Swing_Ammo","Crowbar_Swing_Ammo","Machete_Swing_Ammo"]) exitwith { false };
|
||||
|
||||
_damage = switch (1==1) do {
|
||||
case (((_this select 0) select 4) in ["PipeBomb"]): { (((_this select 0) select 1) select 0) }; //0.5 High explosive
|
||||
case (((_this select 0) select 4) in ["explosive_bolt"]): { (((_this select 0) select 1) select 1) }; //0.25 Medium explosive, maybe grenades and other such items.
|
||||
case (((_this select 0) select 4) in ["Hatchet_Swing_Ammo","Crowbar_Swing_Ammo","Machete_Swing_Ammo"]): { ((_this select 0) select 2) }; //0.00001 Melee damage,
|
||||
//default { 0 };
|
||||
};
|
||||
|
||||
|
||||
//Server running or client
|
||||
if (isServer) then {
|
||||
if !(_obj in needUpdate_FenceObjects) then {
|
||||
needUpdate_FenceObjects set [count needUpdate_FenceObjects, _obj];
|
||||
};
|
||||
|
||||
//TotalDamage Set by the server
|
||||
_obj setDamage (damage _obj) + _damage;
|
||||
|
||||
//diag_log format["Server Reporting - %1",needUpdate_FenceObjects];
|
||||
} else {
|
||||
//If its a client send to server for saving and damage setting.
|
||||
PVDZ_fence_Update = [_obj,(damage _obj) + _damage];
|
||||
publicVariableServer "PVDZ_fence_Update";
|
||||
|
||||
//diag_log ("Client Reporting");
|
||||
};
|
||||
|
||||
//} else {
|
||||
// //We really coulde just send to server and have the server setDamage
|
||||
// //send to server then back to owning client/server
|
||||
// PVDZ_send = [_obj,"objWallDamage",_this];
|
||||
// publicVariableServer "PVDZ_send";
|
||||
//};
|
||||
|
||||
|
||||
diag_log format["Object: %1, Damage:%2(%4), Projectile:%3",typeof ((_this select 0) select 0),((damage _obj) + _damage),((_this select 0) select 4),(damage _obj)];
|
||||
*/
|
||||
|
||||
private["_obj","_damage"];
|
||||
|
||||
//[_this,[0.5,0.25,0.00001]]
|
||||
|
||||
if !(((_this select 0) select 4) in ["PipeBomb","explosive_bolt","Hatchet_Swing_Ammo","Crowbar_Swing_Ammo","Machete_Swing_Ammo"]) exitwith { false };
|
||||
|
||||
|
||||
_obj = ((_this select 0) select 0);
|
||||
//_selectionName = ((_this select 0) select 1);
|
||||
//_damage = ((_this select 0) select 2);
|
||||
//_source = ((_this select 0) select 3);
|
||||
//_projectile = ((_this select 0) select 4);
|
||||
|
||||
//_damageArray = (_this select 1);
|
||||
|
||||
_damage = switch (1==1) do {
|
||||
case (((_this select 0) select 4) in ["PipeBomb"]): { ((_this select 1) select 0) }; //0.5 High explosive
|
||||
case (((_this select 0) select 4) in ["explosive_bolt"]): { ((_this select 1) select 1) }; //0.25 Medium explosive, maybe grenades and other such items.
|
||||
case (((_this select 0) select 4) in ["Hatchet_Swing_Ammo","Crowbar_Swing_Ammo","Machete_Swing_Ammo"]): { ((_this select 1) select 2) }; //0.00001 Melee damage,
|
||||
//default { 0 };
|
||||
};
|
||||
|
||||
//Just incase damage from melee is 0 (higher tier fences have no melee damage) we return false
|
||||
//if (_damage == 0) then { _damage = false; };
|
||||
|
||||
//Server running or client
|
||||
if (_damage > 0) then {
|
||||
if (isServer) then {
|
||||
[_obj,(damage _obj) + _damage,"SERVER",dayz_serverKey] call server_addtoFenceUpdateArray;
|
||||
|
||||
//diag_log format["Server Reporting - %1",needUpdate_FenceObjects];
|
||||
} else {
|
||||
//If its a client send to server for saving and damage setting.
|
||||
PVDZ_fence_Update = [_obj,(damage _obj) + _damage,dayz_playerUID,dayz_authKey];
|
||||
publicVariableServer "PVDZ_fence_Update";
|
||||
|
||||
//diag_log ("Client Reporting");
|
||||
};
|
||||
};
|
||||
|
||||
|
||||
diag_log format["Object: %1, Damage:%4 + %5(%2), Projectile:%3",(typeof _obj),((damage _obj) + _damage),((_this select 0) select 4),(damage _obj),_damage];
|
||||
|
||||
// all "HandleDamage event" functions should return the effective damage that the engine will record for that part
|
||||
//(damage _obj) + _damage
|
||||
false
|
||||
@@ -1,30 +0,0 @@
|
||||
|
||||
if (0 != count Dayz_constructionContext) then {
|
||||
if (dayz_soundMuted) then {call player_toggleSoundMute;}; // disable before fadeSound
|
||||
|
||||
if (!(Dayz_constructionContext select 3)) then {
|
||||
_ghost = Dayz_constructionContext select 0;
|
||||
if (abs(([_ghost, player] call BIS_fnc_distance2D) - (1 + (sizeOf (typeOf _ghost)) * 0.5)) < 1) then {
|
||||
showCinemaBorder false;
|
||||
Dayz_BuildCamera = "camera" camCreate (player modeltoWorld [0,0,2]);
|
||||
0.2 fadeSound 0.1;
|
||||
Dayz_BuildCamera cameraeffect ["External", "TOP"];
|
||||
Dayz_BuildCamera camcommit 0;
|
||||
Dayz_BuildCamera camsettarget _ghost;
|
||||
Dayz_BuildCamera camsetFov 0.1;
|
||||
Dayz_BuildCamera camsetrelpos [-1,0,60];
|
||||
Dayz_BuildCamera camcommit 0;
|
||||
Dayz_constructionContext set [3, true];
|
||||
localize "str_buildCameraOn" call dayz_rollingMessages;
|
||||
};
|
||||
}
|
||||
else {
|
||||
Dayz_BuildCamera cameraeffect ["terminate", "TOP"];
|
||||
0.2 fadeSound 1;
|
||||
player switchCamera (Dayz_constructionContext select 2);
|
||||
camdestroy Dayz_BuildCamera;
|
||||
Dayz_constructionContext set [3, false];
|
||||
localize "str_buildCameraOff" call dayz_rollingMessages;
|
||||
};
|
||||
_handled = true; // used by keyboard.sqf
|
||||
};
|
||||
@@ -1,108 +0,0 @@
|
||||
#include "\z\addons\dayz_code\util\Vector.hpp"
|
||||
|
||||
_project =
|
||||
{
|
||||
private ["_verts","_axis","_min","_max"];
|
||||
local _verts = +(_this select 0);
|
||||
local _axis = _this select 1;
|
||||
|
||||
{ _verts set [_foreachIndex, Vector_DotProduct_Fast(_axis, _x)] } foreach _verts;
|
||||
|
||||
local _min = _verts select 0;
|
||||
local _max = _min;
|
||||
|
||||
{
|
||||
if (_x < _min) then
|
||||
{ _min = _x };
|
||||
|
||||
if (_x > _max) then
|
||||
{ _max = _x };
|
||||
}
|
||||
foreach _verts;
|
||||
|
||||
[_min, _max]
|
||||
};
|
||||
|
||||
_notOverlap =
|
||||
{
|
||||
#define AMIN (_this select 0 select 0)
|
||||
#define AMAX (_this select 0 select 1)
|
||||
#define BMIN (_this select 1 select 0)
|
||||
#define BMAX (_this select 1 select 1)
|
||||
|
||||
AMAX < BMIN || AMIN > BMAX
|
||||
};
|
||||
|
||||
_boundingBoxVertices =
|
||||
{
|
||||
private ["_min","_max","_verts","_v"];
|
||||
local _min = _this select 0;
|
||||
local _max = _this select 1;
|
||||
local _verts = [_min, _max];
|
||||
_verts resize 8;
|
||||
|
||||
local _v = +_min;
|
||||
_v set [0, _max select 0];
|
||||
_verts set [2, +_v];
|
||||
_v set [1, _max select 1];
|
||||
_verts set [3, +_v];
|
||||
|
||||
_v = +_min;
|
||||
_v set [1, _max select 1];
|
||||
_verts set [4, +_v];
|
||||
_v set [2, _max select 2];
|
||||
_verts set [5, +_v];
|
||||
|
||||
_v = +_min;
|
||||
_v set [0, _max select 0];
|
||||
_verts set [6, +_v];
|
||||
_v set [2, _max select 2];
|
||||
_verts set [7, _v];
|
||||
|
||||
_verts
|
||||
};
|
||||
|
||||
_modelToWorld =
|
||||
{
|
||||
private ["_object","_verts"];
|
||||
local _object = _this select 0;
|
||||
local _verts = _this select 1;
|
||||
|
||||
{ _verts set [_foreachIndex, _object modelToWorld _x] } foreach _verts;
|
||||
|
||||
_verts
|
||||
};
|
||||
|
||||
_getAxes =
|
||||
{
|
||||
private ["_dir","_up","_side"];
|
||||
local _dir = vectorDir _this;
|
||||
local _up = vectorUp _this;
|
||||
|
||||
local _side = Vector_Rotate3D_Fast(_dir, _up, 90);
|
||||
|
||||
[_dir, _side, _up]
|
||||
};
|
||||
|
||||
_collision =
|
||||
{
|
||||
private ["_abb","_bbb","_averts","_bverts","_axes","_result"];
|
||||
local _abb = boundingBox (_this select 0);
|
||||
local _bbb = boundingBox (_this select 1);
|
||||
local _averts = [_this select 0, _abb call _boundingBoxVertices] call _modelToWorld;
|
||||
local _bverts = [_this select 1, _bbb call _boundingBoxVertices] call _modelToWorld;
|
||||
|
||||
local _axes = (_this select 0 call _getAxes) + (_this select 1 call _getAxes);
|
||||
|
||||
local _result = true;
|
||||
|
||||
{
|
||||
if ([[_averts, _x] call _project, [_bverts, _x] call _project] call _notOverlap) exitWith
|
||||
{ _result = false };
|
||||
}
|
||||
foreach _axes;
|
||||
|
||||
_result
|
||||
};
|
||||
|
||||
_this call _collision;
|
||||
@@ -1,14 +0,0 @@
|
||||
private["_hrStr","_minStr","_strTime"];
|
||||
|
||||
_curDate = date;
|
||||
_hr = _curDate select 3;
|
||||
_min = _curDate select 4;
|
||||
_hrStr = "";
|
||||
_minStr = "";
|
||||
|
||||
if (_hr < 10) then {_hrStr = format["0%1",_hr]} else {_hrStr = format["%1",_hr]};
|
||||
if (_hr == 0) then {_hrStr = "00"};
|
||||
if (_min < 10) then {_minStr = format["0%1",_min]} else {_minStr = format["%1",_min]};
|
||||
if (_min == 0) then {_minStr = "00"};
|
||||
_strTime = format["%1%2 hrs",_hrStr,_minStr];
|
||||
_strTime
|
||||
@@ -1,214 +0,0 @@
|
||||
/*
|
||||
Created exclusively for ArmA2:OA - DayZMod.
|
||||
Please request permission to use/alter/distribute from project leader (R4Z0R49) AND the author (facoptere@gmail.com)
|
||||
*/
|
||||
|
||||
// Check/find a spot before pitching "Land_Fire_DZ", "TentStorage", "Wire_cat1", "Sandbag1_DZ" or "Hedgehog_DZ"
|
||||
// _this 0: object class
|
||||
// _this 1: object (player) or array (ATL format)
|
||||
// _this 2: optional, empty array that will be filled by computed boolean: _testonLadder, _testSea, _testPond, _testBuilding, _testSlope, _testDistance
|
||||
// return a worldspace consisting of array [ direction, ATL position ] or empty array if no position is found
|
||||
// if 2nd argument is a player, the position returned is just in front of the player, direction is so that the object is "looking to" the player
|
||||
|
||||
private ["_booleans","_class","_isPlayer","_size","_testPond","_testBuilding","_testonLadder","_testSlope","_testSea","_testDistance","_noCollision","_dir","_obj","_objectsPond","_ok","_maxdistance","_x","_new","_pos"];
|
||||
|
||||
_class = _this select 0;
|
||||
_pos = _this select 1;
|
||||
|
||||
_realSize = {
|
||||
[[0,0], (boundingBox _this) select 1] call BIS_fnc_distance2D
|
||||
};
|
||||
|
||||
// check that tent position is outside the pool footprint.
|
||||
// we can't check altitude since pool has no height
|
||||
_checkPerimeter = {
|
||||
private ["_inside","_relPos","_point","_boundingBox","_min","_max","_myX","_myY","_building"];
|
||||
|
||||
_building = _this select 0;
|
||||
_point = _this select 1;
|
||||
_inside = false;
|
||||
|
||||
_relPos = _building worldToModel _point;
|
||||
_boundingBox = boundingBox _building;
|
||||
//diag_log format ["%1 %2", _relPos, _boundingBox];
|
||||
_min = _boundingBox select 0;
|
||||
_max = _boundingBox select 1;
|
||||
_myX = _relPos select 0;
|
||||
_myY = _relPos select 1;
|
||||
|
||||
if ((_myX > (_min select 0)) and {(_myX < (_max select 0))}) then {
|
||||
if ((_myY > (_min select 1)) and {(_myY < (_max select 1))}) then {
|
||||
_inside = true;
|
||||
};
|
||||
};
|
||||
|
||||
_inside
|
||||
};
|
||||
|
||||
// check if _pos a player object or some ATL coordinates array
|
||||
_isPlayer = (typeName _pos != "ARRAY");
|
||||
|
||||
_testBuilding = true;
|
||||
_testDistance = _isPlayer;
|
||||
_maxdistance = 5;
|
||||
_testonLadder = _isPlayer;
|
||||
_testPond = false;
|
||||
_testSea = false;
|
||||
_testSlope = false;
|
||||
_noCollision = false;
|
||||
switch _class do {
|
||||
case "TentStorage" : { // tent pitching must follow all restrictions
|
||||
_testPond = true;
|
||||
_testSea = true;
|
||||
};
|
||||
case "DomeTentStorage" : { // tent pitching must follow all restrictions
|
||||
_testPond = true;
|
||||
_testSea = true;
|
||||
};
|
||||
case "StashSmall" : {
|
||||
_testPond = true;
|
||||
_testSea = true;
|
||||
};
|
||||
case "StashMedium" : {
|
||||
_testPond = true;
|
||||
_testSea = true;
|
||||
};
|
||||
case "Land_Fire_DZ" : { // no fire in the water :)
|
||||
_testPond = true;
|
||||
_testSea = true;
|
||||
};
|
||||
case "CamoNet_DZ" : { // no fire in the water :)
|
||||
_testPond = true;
|
||||
_testSea = true;
|
||||
_testSlope = false;
|
||||
_noCollision = false;
|
||||
_testBuilding = false;
|
||||
};
|
||||
case "Wire_cat1" : {};
|
||||
case "Sandbag1_DZ" : {};
|
||||
case "Hedgehog_DZ" : {};
|
||||
default { // = vehicles (used for hive maintenance on startup)
|
||||
_testBuilding = false;
|
||||
_testSlope = false;
|
||||
_noCollision = false;
|
||||
};
|
||||
};
|
||||
|
||||
//diag_log(format["niceSpot: will test: pond:%1 building:%2 slope:%3 sea:%4 distance:%5 collide:%6", _testPond, _testBuilding, _testSlope, _testSea, _testDistance, _noCollision]);
|
||||
|
||||
_dir = if (_isPlayer) then {getDir(_pos)} else {0};
|
||||
_obj = _class createVehicleLocal (getMarkerpos "respawn_west");
|
||||
uiSleep 0.01;
|
||||
_size = _obj call _realSize;
|
||||
if (_isPlayer) then { _size = _size + (_pos call _realSize); };
|
||||
|
||||
// compute initial position. If _pos is the player, then the object will be in front of him/her
|
||||
_new = nil;
|
||||
_new = if (_isPlayer) then { _pos modeltoworld [0,_size/2,0] } else { _pos };
|
||||
_new set [2, 0];
|
||||
|
||||
// place a temporary object (not colliding or can colliding)
|
||||
if (_noCollision) then {
|
||||
deleteVehicle _obj;
|
||||
uiSleep 0.01;
|
||||
_obj = _class createVehicleLocal _new;
|
||||
// get non colliding position
|
||||
_new = getPosATL _obj;
|
||||
// get relative angle of object position according to player PoV
|
||||
if (_isPlayer) then {
|
||||
_x = _pos worldToModel _new;
|
||||
_dir = _dir + (if ((_x select 1)==0) then { 0 } else { (_x select 0) atan2 (_x select 1) });
|
||||
};
|
||||
} else {
|
||||
_obj setDir _dir;
|
||||
_obj setPosATL(_new);
|
||||
};
|
||||
|
||||
if (_testBuilding) then { // let's proceed to the "something or its operator in a building" test
|
||||
_testBuilding = (([_obj, true] call fnc_isInsideBuilding) // obj in/close to a building (enterable or not)
|
||||
// or _pos is a player who is in a *enterable* building
|
||||
OR {(_isPLayer AND {([_pos, false] call fnc_isInsideBuilding)})});
|
||||
};
|
||||
|
||||
deleteVehicle _obj;
|
||||
uiSleep 0.01;
|
||||
|
||||
if (_testPond) then { // let's proceed to the "object in the pond" test (not dirty)
|
||||
_testPond = false;
|
||||
_objectsPond = nearestObjects [_new, [], 100];
|
||||
{
|
||||
if (((typeOf(_x) == "") // unnamed class?
|
||||
AND {((((_x worldToModel _new) select 2) < 0)) // below water level?
|
||||
AND {([_x, _new] call _checkPerimeter)}}) // inside pond square footprint?
|
||||
AND {(["pond", str(_x), false] call fnc_inString)} // and is actually a pond?
|
||||
) exitWith {
|
||||
_testPond = true;
|
||||
};
|
||||
} forEach _objectsPond;
|
||||
};
|
||||
|
||||
if (_testSlope) then { // "flat spot" test
|
||||
_testSlope = false;
|
||||
_x = _new isflatempty [
|
||||
0, // don't check collisions
|
||||
0, // don't look around
|
||||
(0.1*_size), // slope gradient
|
||||
_size, // object size
|
||||
1, // do not check in the sea
|
||||
false, // don't check far from shore
|
||||
if (_isPlayer) then {_pos} else {objNull} // not used -- seems buggy.
|
||||
];
|
||||
if (count _x < 2) then { // safepos found (gradient ok AND not in sea water)
|
||||
_testSlope = true;
|
||||
};
|
||||
};
|
||||
|
||||
if (_testSea) then { // "not in the sea, not on the beach" test
|
||||
_testSea = false;
|
||||
_x = _new isflatempty [
|
||||
0, // don't check collisions
|
||||
0, // don't look around
|
||||
999, // do not check slope gradient
|
||||
_size, // object size
|
||||
0, // check not in the sea
|
||||
false, // don't check far from shore
|
||||
if (_isPlayer) then {_pos} else {objNull} // not used -- seems buggy.
|
||||
];
|
||||
if (count _x < 2) then { // safepos found (gradient ok AND not in sea water)
|
||||
_testSea = true;
|
||||
}
|
||||
else {
|
||||
_x set [2,0];
|
||||
_x = ATLtoASL _x;
|
||||
if (_x select 2 < 3) then { // in the wave foam
|
||||
_testSea = true;
|
||||
};
|
||||
};
|
||||
};
|
||||
|
||||
if (_testDistance) then { // check effective distance from the player
|
||||
_testDistance = ((_pos distance _new) > _maxdistance);
|
||||
};
|
||||
|
||||
if (_testonLadder) then { // forbid item install process if player is on a ladder (or in a vehicle)
|
||||
_testonLadder = (
|
||||
((getNumber (configFile >> "CfgMovesMaleSdr" >> "States" >> (animationState _pos) >> "onLadder")) == 1)
|
||||
OR {((isPlayer _pos) AND {((vehicle _pos) != _pos)})}
|
||||
);
|
||||
};
|
||||
|
||||
//diag_log(format["niceSpot: result pond:%1 building:%2 slope:%3 sea:%4 distance:%5 collide:%6", _testPond, _testBuilding, _testSlope, _testSea, _testDistance, _noCollision]);
|
||||
|
||||
_ok = !_testPond AND !_testBuilding AND !_testSlope AND !_testSea AND !_testDistance AND !_testonLadder;
|
||||
if (count _this > 2) then {
|
||||
_booleans = _this select 2;
|
||||
_booleans set [0, _testonLadder];
|
||||
_booleans set [1, _testSea];
|
||||
_booleans set [2, _testPond];
|
||||
_booleans set [3, _testBuilding];
|
||||
_booleans set [4, _testSlope];
|
||||
_booleans set [5, _testDistance];
|
||||
//diag_log(format["niceSpot: booleans: %1", _booleans]);
|
||||
};
|
||||
|
||||
if (_ok) then { [round(_dir), _new] } else { [] }
|
||||
@@ -1,367 +0,0 @@
|
||||
/*
|
||||
Created by ziellos2k exclusively for DayZMod.
|
||||
Please request permission to use/alter from ziellos2k.
|
||||
|
||||
Edited by Alby with permission from ziellos2k.
|
||||
*/
|
||||
disableSerialization;
|
||||
|
||||
_getItemName = {
|
||||
private ["_return","_classname"];
|
||||
_classname = _this select 0;
|
||||
_return = _classname;
|
||||
|
||||
if (isClass (configFile >> "CfgWeapons" >> _classname)) then {
|
||||
if (isText (configFile >> "CfgWeapons" >> _classname >> "displayName")) then {
|
||||
_return = getText (configFile >> "CfgWeapons" >> _classname >> "displayName");
|
||||
};
|
||||
};
|
||||
|
||||
if (isClass (configFile >> "CfgMagazines" >> _classname)) then {
|
||||
if (isText (configFile >> "CfgMagazines" >> _classname >> "displayName")) then {
|
||||
_return = getText (configFile >> "CfgMagazines" >> _classname >> "displayName");
|
||||
};
|
||||
};
|
||||
|
||||
_return;
|
||||
};
|
||||
|
||||
_getItemPicture = {
|
||||
private ["_return","_classname"];
|
||||
_classname = _this select 0;
|
||||
_return = _classname;
|
||||
|
||||
if (isClass (configFile >> "CfgWeapons" >> _classname)) then {
|
||||
_return = getText (configFile >> "CfgWeapons" >> _classname >> "picture");
|
||||
};
|
||||
|
||||
if (isClass (configFile >> "CfgMagazines" >> _classname)) then {
|
||||
_return = getText (configFile >> "CfgMagazines" >> _classname >> "picture");
|
||||
};
|
||||
|
||||
_return;
|
||||
};
|
||||
|
||||
_inArray = {
|
||||
private ["_return","_array","_search"];
|
||||
_array = _this select 0;
|
||||
_search = _this select 1;
|
||||
|
||||
_return = -1;
|
||||
|
||||
for "_i" from 0 to (count _array) - 1 do {
|
||||
if ((_array select _i) select 0 == _search) then {
|
||||
_return = _i;
|
||||
};
|
||||
};
|
||||
|
||||
_return;
|
||||
};
|
||||
|
||||
_getGear = {
|
||||
private ["_return","_index"];
|
||||
_return = [];
|
||||
_weapons = [];
|
||||
_magazines = [];
|
||||
_nearByPile = nearestObjects [getPosATL player, ["SmallCraftTable_dz"], 3];
|
||||
if (count _nearByPile > 0) then {
|
||||
_weaps = getWeaponCargo (_nearByPile select 0);
|
||||
_mags = getMagazineCargo (_nearByPile select 0);
|
||||
|
||||
//diag_log format ["%1, %2", _weaps, _mags];
|
||||
|
||||
//Add weapons
|
||||
_objWpnTypes = _weaps select 0;
|
||||
_objWpnQty = _weaps select 1;
|
||||
|
||||
for "_i" from 0 to (count _objWpnTypes - 1) do {
|
||||
_obj = _objWpnTypes select _i;
|
||||
_index = [_return, _obj] call _inArray;
|
||||
|
||||
if (_index != -1) then {
|
||||
_return set [_index, [_obj, ((_return select _index) select 1) + (_objWpnQty select _i), 0]];
|
||||
} else {
|
||||
_return set [count _return, [_obj, _objWpnQty select _i, 0]];
|
||||
};
|
||||
};
|
||||
|
||||
//Add Magazines
|
||||
_objMagTypes = _mags select 0;
|
||||
_objMagQty = _mags select 1;
|
||||
|
||||
for "_i" from 0 to (count _objMagTypes - 1) do {
|
||||
_obj = _objMagTypes select _i;
|
||||
_index = [_return, _obj] call _inArray;
|
||||
|
||||
if (_index != -1) then {
|
||||
_return set [_index, [_obj, ((_return select _index) select 1) + (_objMagQty select _i), 0]];
|
||||
} else {
|
||||
_return set [count _return, [_obj, _objMagQty select _i, 0]];
|
||||
};
|
||||
};
|
||||
|
||||
} else {
|
||||
_weapons = weapons player;
|
||||
_magazines = magazines player;
|
||||
|
||||
{
|
||||
_return set [count _return, [_x, 1, 0]];
|
||||
} forEach (_weapons);
|
||||
|
||||
{
|
||||
if !(_x in MeleeMagazines) then {
|
||||
_index = [_return, _x] call _inArray;
|
||||
|
||||
if (_index != -1) then {
|
||||
_return set [_index, [_x, ((_return select _index) select 1) + 1, 0]];
|
||||
} else {
|
||||
_return set [count _return, [_x, 1, 0]];
|
||||
};
|
||||
};
|
||||
} forEach (_magazines);
|
||||
};
|
||||
|
||||
_return;
|
||||
};
|
||||
|
||||
_init = {
|
||||
_itemArray = [] call _getGear;
|
||||
uiNamespace setVariable ["DAYZ_CraftingDialog_Items", _itemArray];
|
||||
};
|
||||
|
||||
_cleanup = {
|
||||
if (dialog) then { closeDialog 0 };
|
||||
uiNamespace setVariable ["DAYZ_CraftingDialog", nil];
|
||||
uiNamespace setVariable ["DAYZ_CraftingDialog_Items", nil];
|
||||
};
|
||||
|
||||
_addItem = {
|
||||
private ["_selected","_classname","_index","_item","_classname","_gearcount","_tablecount"];
|
||||
_selected = lbCurSel _list;
|
||||
_classname = _list lnbData [_selected, 2];
|
||||
|
||||
_index = [_itemArray, _classname] call _inArray;
|
||||
_item = _itemArray select _index;
|
||||
_classname = _item select 0;
|
||||
_gearcount = _item select 1;
|
||||
_tablecount = _item select 2;
|
||||
|
||||
if (_gearcount > 0) then {
|
||||
_gearcount = _gearcount - 1;
|
||||
_tablecount = _tablecount + 1;
|
||||
};
|
||||
|
||||
_itemArray set [_index, [_classname, _gearcount, _tablecount]];
|
||||
};
|
||||
|
||||
_removeItem = {
|
||||
private ["_selected","_classname","_index","_item","_classname","_gearcount","_tablecount"];
|
||||
_selected = lbCurSel _list;
|
||||
_classname = _list lnbData [_selected, 2];
|
||||
|
||||
_index = [_itemArray, _classname] call _inArray;
|
||||
_item = _itemArray select _index;
|
||||
_classname = _item select 0;
|
||||
_gearcount = _item select 1;
|
||||
_tablecount = _item select 2;
|
||||
|
||||
if (_tablecount > 0) then {
|
||||
_gearcount = _gearcount + 1;
|
||||
_tablecount = _tablecount - 1;
|
||||
};
|
||||
|
||||
_itemArray set [_index, [_classname, _gearcount, _tablecount]];
|
||||
};
|
||||
|
||||
_update = {
|
||||
private ["_control","_pictureIndex","_item","_classname","_gearcount","_tablecount","_itemName","_itemPicture","_index"];
|
||||
lbClear _list;
|
||||
|
||||
// clear crafting table boxes
|
||||
for "_i" from 0 to 50 do {
|
||||
_control = _display displayCtrl (200 + _i);
|
||||
_control ctrlSetText "";
|
||||
};
|
||||
|
||||
_pictureIndex = 1;
|
||||
|
||||
for "_i" from 0 to (count _itemArray) - 1 do {
|
||||
_item = _itemArray select _i;
|
||||
_classname = _item select 0;
|
||||
_gearcount = _item select 1;
|
||||
_tablecount = _item select 2;
|
||||
|
||||
_itemName = [_classname] call _getItemName;
|
||||
_itemPicture = [_classname] call _getItemPicture;
|
||||
|
||||
_index = _list lnbAddRow [str _gearcount, "", _itemName, str _tablecount];
|
||||
_list lnbSetData [[_index, 2], _classname];
|
||||
_list lnbSetPicture [[_index, 1], _itemPicture];
|
||||
|
||||
for "_j" from 0 to _tablecount - 1 do {
|
||||
_control = _display displayCtrl (200 + _pictureIndex);
|
||||
_control ctrlSetText _itemPicture;
|
||||
_pictureIndex = _pictureIndex + 1;
|
||||
};
|
||||
};
|
||||
};
|
||||
|
||||
_craftItem = {
|
||||
private ["_classList","_countList","_item","_classname","_tablecount","_arrayToSend"];
|
||||
_classList = [];
|
||||
_countList = [];
|
||||
|
||||
for "_i" from 0 to (count _itemArray) - 1 do {
|
||||
_item = _itemArray select _i;
|
||||
_classname = _item select 0;
|
||||
_tablecount = _item select 2;
|
||||
|
||||
if (_tablecount > 0) then {
|
||||
_classList set [count _classList, _classname];
|
||||
_countList set [count _countList, _tablecount];
|
||||
};
|
||||
};
|
||||
|
||||
if (count _classList > 0) then {
|
||||
_arrayToSend = [_classList,_countList];
|
||||
[_arrayToSend] call player_checkRecipe;
|
||||
|
||||
};
|
||||
};
|
||||
|
||||
_construction = {
|
||||
private ["_classList","_countList","_item","_classname","_tablecount","_arrayToSend"];
|
||||
_classList = [];
|
||||
_countList = [];
|
||||
|
||||
for "_i" from 0 to (count _itemArray) - 1 do {
|
||||
_item = _itemArray select _i;
|
||||
_classname = _item select 0;
|
||||
_tablecount = _item select 2;
|
||||
|
||||
if (_tablecount > 0) then {
|
||||
_classList set [count _classList, _classname];
|
||||
_countList set [count _countList, _tablecount];
|
||||
};
|
||||
};
|
||||
|
||||
if (count _classList > 0) then {
|
||||
_arrayToSend = [_classList,_countList];
|
||||
[_arrayToSend] call player_checkConstructionRecipe;
|
||||
|
||||
};
|
||||
};
|
||||
|
||||
_getRecipes = {
|
||||
private["_config","_control","_controlPos","_msg","_lines"];
|
||||
_config = configFile >> "CfgCrafting";
|
||||
_control = _display displayCtrl 430;
|
||||
_controlPos = ctrlPosition _control;
|
||||
_msg = "";
|
||||
_lines = 0;
|
||||
|
||||
for "_i" from 0 to ((count _config) - 1) do {
|
||||
_entry = _config select _i;
|
||||
_input = getArray (_entry >> "input");
|
||||
_itemMsg = "";
|
||||
|
||||
if (count _input > 0) then {
|
||||
_isRecipe = true;
|
||||
|
||||
{
|
||||
_item = _x select 0;
|
||||
_amount = _x select 2;
|
||||
|
||||
if (typeName _item == "ARRAY") then {
|
||||
_amount = _item select 2;
|
||||
_item = _item select 0;
|
||||
};
|
||||
|
||||
_itemMsg = _itemMsg + format ["%1 %2<br />", _amount, [_item] call _getItemName];
|
||||
_lines = _lines + 1;
|
||||
} forEach _input;
|
||||
|
||||
_msg = _msg + format ["<t size='1.25'>%1</t><br />%2<br />", getText (_entry >> "displayName"), _itemMsg];
|
||||
_lines = _lines + 2.25;
|
||||
};
|
||||
};
|
||||
|
||||
_control ctrlSetPosition [_controlPos select 0, _controlPos select 1, _controlPos select 2, 0.03921 * _lines]; // text size * numoflines
|
||||
_control ctrlSetStructuredText parseText _msg;
|
||||
_control ctrlCommit 0;
|
||||
};
|
||||
|
||||
_getconstructionRecipes = {
|
||||
private["_config","_control","_controlPos","_msg","_lines"];
|
||||
_config = configFile >> "CfgConstruction";
|
||||
_control = _display displayCtrl 430;
|
||||
_controlPos = ctrlPosition _control;
|
||||
_msg = "";
|
||||
_lines = 0;
|
||||
|
||||
for "_i" from 0 to ((count _config) - 1) do {
|
||||
_entry = _config select _i;
|
||||
_input = getArray (_entry >> "input");
|
||||
_itemMsg = "";
|
||||
|
||||
if (count _input > 0) then {
|
||||
_isRecipe = true;
|
||||
|
||||
{
|
||||
_item = _x select 0;
|
||||
_amount = _x select 2;
|
||||
|
||||
if (typeName _item == "ARRAY") then {
|
||||
_amount = _item select 2;
|
||||
_item = _item select 0;
|
||||
};
|
||||
|
||||
_itemMsg = _itemMsg + format ["%1 %2<br />", _amount, [_item] call _getItemName];
|
||||
_lines = _lines + 1;
|
||||
} forEach _input;
|
||||
|
||||
_msg = _msg + format ["<t size='1.25'>%1</t><br />%2<br />", getText (_entry >> "displayName"), _itemMsg];
|
||||
_lines = _lines + 2.25;
|
||||
};
|
||||
};
|
||||
|
||||
_control ctrlSetPosition [_controlPos select 0, _controlPos select 1, _controlPos select 2, 0.03921 * _lines]; // text size * numoflines
|
||||
_control ctrlSetStructuredText parseText _msg;
|
||||
_control ctrlCommit 0;
|
||||
};
|
||||
|
||||
_display = uiNamespace getVariable ["DAYZ_CraftingDialog", nil];
|
||||
_itemArray = uiNamespace getVariable ["DAYZ_CraftingDialog_Items", []];
|
||||
_list = _display displayCtrl 432;
|
||||
|
||||
_event = _this select 0;
|
||||
|
||||
switch (_event) do {
|
||||
case "initcrafting": {
|
||||
[] call _init;
|
||||
[] call _update;
|
||||
[] call _getRecipes;
|
||||
};
|
||||
case "initconstruction": {
|
||||
[] call _init;
|
||||
[] call _update;
|
||||
[] call _getconstructionRecipes;
|
||||
};
|
||||
case "add": {
|
||||
[] call _addItem;
|
||||
[] call _update;
|
||||
};
|
||||
case "remove": {
|
||||
[] call _removeItem;
|
||||
[] call _update;
|
||||
};
|
||||
case "craft": {
|
||||
[] call _craftItem;
|
||||
};
|
||||
case "close": {
|
||||
[] call _cleanup;
|
||||
};
|
||||
case "construction": {
|
||||
[] call _construction;
|
||||
};
|
||||
};
|
||||
@@ -1,58 +0,0 @@
|
||||
//_newObjects = [_previous,weapons player] call player_weaponCheck;
|
||||
private["_change","_currentTypes","_currentQty","_previousTypes","_previousQty","_serial"];
|
||||
|
||||
_currentObjects = _this select 0;
|
||||
_checkObjects = _this select 1;
|
||||
|
||||
_change = false;
|
||||
|
||||
if (count _currentObjects > 1) then {
|
||||
_currentTypes = _currentObjects select 0;
|
||||
_currentQty = _currentObjects select 1;
|
||||
} else {
|
||||
_currentTypes = [];
|
||||
_currentQty = [];
|
||||
};
|
||||
|
||||
if (count _checkObjects > 1) then {
|
||||
_previousTypes = _checkObjects select 0;
|
||||
_previousQty = _checkObjects select 1;
|
||||
} else {
|
||||
_previousTypes = [];
|
||||
_previousQty = [];
|
||||
};
|
||||
//Check if some of old loadout not there
|
||||
|
||||
//Review current loadout
|
||||
_serial = 0;
|
||||
{
|
||||
_itemVal = _x;
|
||||
_itemQty = _currentQty select _serial;
|
||||
|
||||
_oldSerial = _previousTypes find _itemVal;
|
||||
_oldQty = 0;
|
||||
if (_oldSerial >= 0) then {
|
||||
_oldQty = _previousQty select _oldSerial;
|
||||
};
|
||||
if (_itemQty != _oldQty) then {_change = true};
|
||||
|
||||
_serial = _serial + 1;
|
||||
} forEach _currentTypes;
|
||||
|
||||
//Review old loadout
|
||||
_serial = 0;
|
||||
{
|
||||
_itemVal = _x;
|
||||
_itemQty = _previousQty select _serial;
|
||||
|
||||
_oldSerial = _currentTypes find _itemVal;
|
||||
_oldQty = 0;
|
||||
if (_oldSerial >= 0) then {
|
||||
_oldQty = _currentQty select _oldSerial;
|
||||
};
|
||||
if (_itemQty != _oldQty) then {_change = true};
|
||||
|
||||
_serial = _serial + 1;
|
||||
} forEach _previousTypes;
|
||||
|
||||
_change;
|
||||
@@ -1,42 +0,0 @@
|
||||
#define WHITE [1,1,1,1]
|
||||
#define GREY [0.75,0.75,0.75,1]
|
||||
#define GREEN [0.6,0.8,0.4,1]
|
||||
#define RED [1,0.1,0,1]
|
||||
|
||||
private["_task", "_taskDescription", "_taskStatus", "_taskParams"];
|
||||
|
||||
_task = _this select 0;
|
||||
_taskDescription = (taskDescription _task) select 1;
|
||||
_taskStatus = toUpper(taskState _task);
|
||||
|
||||
|
||||
_taskParams = switch (_taskStatus) do
|
||||
{
|
||||
case "CREATED":
|
||||
{
|
||||
[format["NEW TASK ASSIGNED: \n%1", _taskDescription], WHITE, "taskNew"]
|
||||
};
|
||||
|
||||
case "ASSIGNED":
|
||||
{
|
||||
[format["ASSIGNED TASK: \n%1", _taskDescription], WHITE, "taskCurrent"]
|
||||
};
|
||||
|
||||
case "SUCCEEDED":
|
||||
{
|
||||
[format["TASK ACCOMPLISHED: \n%1", _taskDescription], GREEN, "taskDone"]
|
||||
};
|
||||
|
||||
case "FAILED":
|
||||
{
|
||||
[format["TASK FAILED: \n%1", _taskDescription], RED, "taskFAILED"]
|
||||
};
|
||||
|
||||
case "CANCELED":
|
||||
{
|
||||
[format["TASK CANCELED: \n%1", _taskDescription], GREY, "taskDone"]
|
||||
};
|
||||
|
||||
};
|
||||
|
||||
taskHint _taskParams;
|
||||
@@ -1,36 +0,0 @@
|
||||
private ["_newObjects","_change"];
|
||||
//_newObjects = [_previous,weapons player] call player_weaponCheck;
|
||||
_currentObjects = _this select 0;
|
||||
_checkObjects = _this select 1;
|
||||
|
||||
_change = false;
|
||||
|
||||
//Check if some of old loadout not there
|
||||
_newObjects = [];
|
||||
{
|
||||
if (!(_x in _newObjects)) then {
|
||||
_type = _x;
|
||||
_qtyNow = {_x == _type} count _checkObjects;
|
||||
_qtyBefore = {_x == _type} count _currentObjects;
|
||||
if (_qtyNow != _qtyBefore) then {
|
||||
_change = true;
|
||||
};
|
||||
_newObjects set [count _newObjects,_type];
|
||||
};
|
||||
} forEach _currentObjects;
|
||||
|
||||
//Compare current loadout with old loadout
|
||||
_newObjects = [];
|
||||
{
|
||||
if (!(_x in _newObjects)) then {
|
||||
_type = _x;
|
||||
_qtyNow = {_x == _type} count _checkObjects;
|
||||
_qtyBefore = {_x == _type} count _currentObjects;
|
||||
if (_qtyNow != _qtyBefore) then {
|
||||
_change = true;
|
||||
};
|
||||
_newObjects set [count _newObjects,_type];
|
||||
};
|
||||
} forEach _checkObjects;
|
||||
|
||||
_change
|
||||
@@ -1,66 +0,0 @@
|
||||
private["_unit","_targets","_move","_damage","_wound","_sound","_local","_dir","_hpList","_hp","_strH","_dam","_total","_result","_vehicle","_tPos","_zPos","_cantSee","_inAngle"];
|
||||
_unit = _this select 0;
|
||||
_wound = _this select 1;
|
||||
_vehicle = (vehicle player);
|
||||
|
||||
//_targets = _unit getVariable ["targets",[]];
|
||||
//if (!(_vehicle in _targets)) exitWith {};
|
||||
|
||||
//Do the attack
|
||||
_move = "ZombieStandingAttack1";
|
||||
_rnd = 0;
|
||||
|
||||
_rnd = round(random 9) + 1;
|
||||
_move = "ZombieStandingAttack" + str(_rnd);
|
||||
|
||||
_dir = [_unit,player] call BIS_Fnc_dirTo;
|
||||
_unit setDir _dir;
|
||||
|
||||
[objNull, _unit, rPlayMove, _move] call RE;
|
||||
|
||||
//Wait
|
||||
uiSleep 0.3;
|
||||
|
||||
if (_vehicle != player) then {
|
||||
_hpList = _vehicle call vehicle_getHitpoints;
|
||||
_hp = _hpList call BIS_fnc_selectRandom;
|
||||
_wound = getText(configFile >> "cfgVehicles" >> (typeOf _vehicle) >> "HitPoints" >> _hp >> "name");
|
||||
_damage = random 0.03;
|
||||
_chance = round(random 12);
|
||||
|
||||
if ((_chance % 4) == 0) then {
|
||||
_openVehicles = ["ATV_Base_EP1", "Motorcycle", "Bicycle"];
|
||||
{
|
||||
if (_vehicle isKindOf _x) exitWith {
|
||||
player action ["eject", _vehicle];
|
||||
};
|
||||
} forEach _openVehicles;
|
||||
};
|
||||
|
||||
[_unit,"hit",0,false] call dayz_zombieSpeak;
|
||||
|
||||
if (_wound IN [ "glass1", "glass2", "glass3", "glass4", "glass5", "glass6" ]) then {
|
||||
_dam = _vehicle getHit _wound;
|
||||
|
||||
// we limit how _dam could be damaged by Z. Above 0.8, the vehicle could explode, which is ridiculous.
|
||||
_damage = (if (_dam < 0.8 OR {(!(_wound IN dayZ_explosiveParts))}) then {0.1} else {0.01});
|
||||
// Add damage to vehicle. the "sethit" command will be done by the gameengine for which vehicle is local
|
||||
//diag_log(format["%1: Part ""%2"" damaged from vehicle, damage:+%3", __FILE__, _wound, _damage]);
|
||||
_total = [_vehicle, _wound, _damage, _unit, "zombie", true] call fnc_veh_handleDam;
|
||||
};
|
||||
} else {
|
||||
if ((_unit distance player) <= 3) then {
|
||||
_tPos = (getPosASL _vehicle);
|
||||
_zPos = (getPosASL _unit);
|
||||
_inAngle = [_zPos,(getdir _unit),50,_tPos] call fnc_inAngleSector;
|
||||
if (_inAngle) then {
|
||||
_cantSee = [_unit,_vehicle] call dayz_losCheck;
|
||||
if (!_cantSee) then {
|
||||
_damage = 0.1 + random (1.2);
|
||||
//diag_log ("START DAM: Player Hit on " + _wound + " for " + str(_damage));
|
||||
[player, _wound, _damage, _unit,"zombie"] call fnc_usec_damageHandler;
|
||||
[_unit,"hit",0,false] call dayz_zombieSpeak;
|
||||
};
|
||||
};
|
||||
};
|
||||
};
|
||||
@@ -1,43 +0,0 @@
|
||||
private["_position","_doLoiter","_unitTypes","_isNoone","_loot","_array","_agent","_type","_radius","_method","_nearByPlayer","_attempt","_myDest","_newDest","_lootType"];
|
||||
_player = _this select 0;
|
||||
_amount = _this select 1;
|
||||
|
||||
_counter = 0;
|
||||
_agent = objNull;
|
||||
|
||||
if ([_player] call DZE_SafeZonePosCheck) exitWith {};
|
||||
|
||||
while {_counter < _amount} do {
|
||||
|
||||
//Create the Group and populate it
|
||||
_type = "swarm_newBase"; //"_unitTypes call BIS_fnc_selectRandom;
|
||||
//_type = "Pastor";
|
||||
_position = [position _player,50,100,0] call fn_selectRandomLocation;
|
||||
|
||||
_agent = createAgent [_type, _position, [], 0, "NONE"];
|
||||
|
||||
_agent setVariable["agentObjectSwarm",_agent,true];
|
||||
_agent setUnitPos "Middle";
|
||||
|
||||
dayz_swarmSpawnZombies = dayz_swarmSpawnZombies + 1;
|
||||
dayz_spawnZombies = dayz_spawnZombies + 1;
|
||||
|
||||
if (isNull _agent) exitWith {
|
||||
dayz_spawnZombies = dayz_spawnZombies - 1;
|
||||
dayz_swarmSpawnZombies = dayz_swarmSpawnZombies - 1;
|
||||
};
|
||||
|
||||
_isAlive = alive _agent;
|
||||
|
||||
//counter
|
||||
_counter = _counter + 1;
|
||||
|
||||
//debug
|
||||
//diag_log (format["Agent: %1, Type: %2,To spawn: %3/%4",_agent,_type,_amount,_counter]);
|
||||
|
||||
//Move
|
||||
//[_agent, _position] call zombie_loiter;
|
||||
|
||||
//Start behavior
|
||||
_id = [_position,_agent,player] execFSM "\z\AddOns\dayz_code\system\fn_swarmagent.fsm";
|
||||
};
|
||||
Reference in New Issue
Block a user