mirror of
https://github.com/EpochModTeam/DayZ-Epoch.git
synced 2025-12-13 19:52:38 +03:00
Formatting cleanup
- Removed random spaces
- Added back comments so it is easier to compare
- Removed redundant } else {
This commit is contained in:
@@ -1,44 +1,48 @@
|
|||||||
|
//private ["_class","_position","_dir","_group","_oldUnit","_newUnit","_currentWpn","_muzzles","_currentAnim","_playerUID","_weapons","_magazines","_primweapon","_secweapon","_newBackpackType","_backpackWpn","_backpackMag","_backpackWpnTypes","_backpackWpnQtys","_countr","_backpackmagTypes","_backpackmagQtys","_display","_createSafePos","_wpnType","_ismelee","_rndx","_rndy"];
|
||||||
private ["_weapons","_backpackWpn","_backpackMag","_currentWpn","_isWeapon","_backpackWpnTypes","_backpackWpnQtys","_countr","_class","_position","_dir","_currentAnim","_playerUID","_countMags","_magazines","_primweapon","_secweapon","_newBackpackType","_muzzles","_oldUnit","_group","_newUnit","_oldGroup","_idc","_display","_switchUnit"];
|
private ["_weapons","_backpackWpn","_backpackMag","_currentWpn","_isWeapon","_backpackWpnTypes","_backpackWpnQtys","_countr","_class","_position","_dir","_currentAnim","_playerUID","_countMags","_magazines","_primweapon","_secweapon","_newBackpackType","_muzzles","_oldUnit","_group","_newUnit","_oldGroup","_idc","_display","_switchUnit"];
|
||||||
|
_class = _this;
|
||||||
|
|
||||||
disableSerialization;
|
disableSerialization;
|
||||||
_class = _this;
|
//Old location system causes issues with players getting damaged during movement.
|
||||||
|
//_position = getPosATL player;
|
||||||
|
//New system testing needed.
|
||||||
_position = player modeltoWorld [0,0,0];
|
_position = player modeltoWorld [0,0,0];
|
||||||
_dir = getDir player;
|
_dir = getDir player;
|
||||||
_currentAnim = animationState player;
|
_currentAnim = animationState player;
|
||||||
|
//_currentCamera = cameraView;
|
||||||
_playerUID = [player] call FNC_GetPlayerUID;
|
_playerUID = [player] call FNC_GetPlayerUID;
|
||||||
_weapons = weapons player;
|
|
||||||
_countMags = call player_countMagazinesWBackpack;
|
//BackUp Weapons and Mags
|
||||||
if (((typeName _countMags) != "ARRAY")) exitWith {localize "str_actions_switchmodel_fail" call dayz_rollingMessages;};
|
_weapons = weapons player;
|
||||||
|
_countMags = call player_countMagazinesWBackpack; //magazines player;
|
||||||
|
if (typeName _countMags != "ARRAY") exitWith {localize "str_actions_switchmodel_fail" call dayz_rollingMessages;};
|
||||||
_magazines = _countMags select 0;
|
_magazines = _countMags select 0;
|
||||||
|
if ((_playerUID == dayz_playerUID) && (count _magazines == 0) && (count (magazines player) > 0)) exitWith {localize "str_actions_switchmodel_fail" call dayz_rollingMessages;};
|
||||||
|
|
||||||
if ((_playerUID == dayz_playerUID) && (count _magazines == 0) && (count (magazines player) > 0 )) exitWith {localize "str_actions_switchmodel_fail" call dayz_rollingMessages;};
|
_primweapon = primaryWeapon player;
|
||||||
|
_secweapon = secondaryWeapon player;
|
||||||
|
|
||||||
_primweapon = primaryWeapon player;
|
if (!(_primweapon in _weapons) && _primweapon != "") then {
|
||||||
_secweapon = secondaryWeapon player;
|
_weapons set [count _weapons, _primweapon];
|
||||||
|
|
||||||
if(!(_primweapon in _weapons) && _primweapon != "") then {
|
|
||||||
_weapons set [(count _weapons), _primweapon];
|
|
||||||
};
|
};
|
||||||
|
|
||||||
if(!(_secweapon in _weapons) && _secweapon != "") then {
|
if (!(_secweapon in _weapons) && _secweapon != "") then {
|
||||||
_weapons set [(count _weapons), _secweapon];
|
_weapons set [count _weapons, _secweapon];
|
||||||
};
|
};
|
||||||
|
|
||||||
//BackUp Backpack
|
//BackUp Backpack
|
||||||
dayz_myBackpack = unitBackpack player;
|
dayz_myBackpack = unitBackpack player;
|
||||||
_newBackpackType = (typeOf dayz_myBackpack);
|
_newBackpackType = typeOf dayz_myBackpack;
|
||||||
if(_newBackpackType != "") then {
|
if (_newBackpackType != "") then {
|
||||||
_backpackWpn = getWeaponCargo unitBackpack player;
|
_backpackWpn = getWeaponCargo unitBackpack player;
|
||||||
|
|
||||||
_backpackMag = _countMags select 1;
|
_backpackMag = _countMags select 1;
|
||||||
};
|
};
|
||||||
|
|
||||||
//Get Muzzle
|
|
||||||
_currentWpn = currentWeapon player;
|
_currentWpn = currentWeapon player;
|
||||||
_muzzles = getArray(configFile >> "cfgWeapons" >> _currentWpn >> "muzzles");
|
_muzzles = getArray(configFile >> "cfgWeapons" >> _currentWpn >> "muzzles");
|
||||||
if (count _muzzles > 1) then {
|
if (count _muzzles > 1) then {_currentWpn = currentMuzzle player;};
|
||||||
_currentWpn = currentMuzzle player;
|
|
||||||
};
|
//Debug Message
|
||||||
// diag_log "Attempting to switch model";
|
// diag_log "Attempting to switch model";
|
||||||
// diag_log str(_weapons);
|
// diag_log str(_weapons);
|
||||||
// diag_log str(_magazines);
|
// diag_log str(_magazines);
|
||||||
@@ -52,53 +56,49 @@ if (count _muzzles > 1) then {
|
|||||||
_display = findDisplay 106;
|
_display = findDisplay 106;
|
||||||
_display closeDisplay 0;
|
_display closeDisplay 0;
|
||||||
|
|
||||||
|
|
||||||
//BackUp Player Object
|
//BackUp Player Object
|
||||||
_oldUnit = player;
|
_oldUnit = player;
|
||||||
_oldGroup = group player;
|
_oldGroup = group player;
|
||||||
|
|
||||||
/**********************************/
|
/***********************************/
|
||||||
//DONT USE player AFTER THIS POINT//
|
//DONT USE player AFTER THIS POINT
|
||||||
/**********************************/
|
/***********************************/
|
||||||
|
|
||||||
//Create New Character
|
//Create New Character
|
||||||
|
//[player] joinSilent grpNull;
|
||||||
_group = createGroup west;
|
_group = createGroup west;
|
||||||
_newUnit = _group createUnit [_class,getMarkerPos "respawn_west",[],0,"NONE"];
|
_newUnit = _group createUnit [_class,getMarkerPos "respawn_west",[],0,"NONE"];
|
||||||
_newUnit setDir _dir;
|
_newUnit setDir _dir;
|
||||||
{_newUnit removeMagazine _x;} count magazines _newUnit;
|
{_newUnit removeMagazine _x;} count magazines _newUnit;
|
||||||
removeAllWeapons _newUnit;
|
removeAllWeapons _newUnit;
|
||||||
|
|
||||||
//Equip New Charactar
|
//Equip New Character
|
||||||
{
|
{
|
||||||
if (typeName _x == "ARRAY") then {if ((count _x) > 0) then {_newUnit addMagazine [(_x select 0), (_x select 1)]; }; } else { _newUnit addMagazine _x; };
|
if (typeName _x == "ARRAY") then {if (count _x > 0) then {_newUnit addMagazine [_x select 0,_x select 1]; }; } else { _newUnit addMagazine _x; };
|
||||||
} count _magazines;
|
} count _magazines;
|
||||||
|
|
||||||
{
|
{_newUnit addWeapon _x;} count _weapons;
|
||||||
_newUnit addWeapon _x;
|
|
||||||
} count _weapons;
|
|
||||||
|
|
||||||
//Check && Compare it
|
//Check and Compare it
|
||||||
if(str(_weapons) != str(weapons _newUnit)) then {
|
if (str(_weapons) != str(weapons _newUnit)) then {
|
||||||
//Get Differecnce
|
//Get Differecnce
|
||||||
{
|
{_weapons = _weapons - [_x];} count (weapons _newUnit);
|
||||||
_weapons = _weapons - [_x];
|
|
||||||
} count (weapons _newUnit);
|
|
||||||
//Add the Missing
|
//Add the Missing
|
||||||
{
|
{_newUnit addWeapon _x;} count _weapons;
|
||||||
_newUnit addWeapon _x;
|
|
||||||
} count _weapons;
|
|
||||||
};
|
};
|
||||||
|
|
||||||
if(_primweapon != (primaryWeapon _newUnit)) then {
|
if (_primweapon != (primaryWeapon _newUnit)) then {
|
||||||
_newUnit addWeapon _primweapon;
|
_newUnit addWeapon _primweapon;
|
||||||
};
|
};
|
||||||
|
|
||||||
if(_secweapon != (secondaryWeapon _newUnit) && _secweapon != "") then {
|
if (_secweapon != (secondaryWeapon _newUnit) && _secweapon != "") then {
|
||||||
_newUnit addWeapon _secweapon;
|
_newUnit addWeapon _secweapon;
|
||||||
};
|
};
|
||||||
|
|
||||||
_switchUnit = {
|
_switchUnit = {
|
||||||
|
//Make New Unit Playable (1 of these 3 commands causes crashes with gear dialog open)
|
||||||
|
//_oldUnit setPosATL [_position select 0 + cos(_dir) * 2, _position select 1 + sin(_dir) * 2, _position select 2];
|
||||||
addSwitchableUnit _newUnit;
|
addSwitchableUnit _newUnit;
|
||||||
setPlayable _newUnit;
|
setPlayable _newUnit;
|
||||||
selectPlayer _newUnit;
|
selectPlayer _newUnit;
|
||||||
@@ -110,56 +110,56 @@ _switchUnit = {
|
|||||||
_oldUnit setPosATL [(_createSafePos select 0) + _rndx, (_createSafePos select 1) + _rndy, 0];
|
_oldUnit setPosATL [(_createSafePos select 0) + _rndx, (_createSafePos select 1) + _rndy, 0];
|
||||||
_newUnit setPosATL _position;
|
_newUnit setPosATL _position;
|
||||||
removeAllWeapons _oldUnit;
|
removeAllWeapons _oldUnit;
|
||||||
{_oldUnit removeMagazine _x;} count magazines _oldUnit;
|
{_oldUnit removeMagazine _x;} count magazines _oldUnit;
|
||||||
if !(isNull _oldUnit) then {deleteVehicle _oldUnit;};
|
if !(isNull _oldUnit) then {deleteVehicle _oldUnit;};
|
||||||
deleteGroup _oldGroup;
|
deleteGroup _oldGroup;
|
||||||
if (_currentWpn != "") then {_newUnit selectWeapon _currentWpn;};
|
if (_currentWpn != "") then {_newUnit selectWeapon _currentWpn;};
|
||||||
};
|
};
|
||||||
//Add && Fill BackPack
|
|
||||||
if (!isNil "_newBackpackType") then {
|
|
||||||
if (_newBackpackType != "") then {
|
|
||||||
_newUnit addBackpack _newBackpackType;
|
|
||||||
dayz_myBackpack = unitBackpack _newUnit;
|
|
||||||
//Weapons
|
|
||||||
_backpackWpnTypes = [];
|
|
||||||
_backpackWpnQtys = [];
|
|
||||||
if (count _backpackWpn > 0) then {
|
|
||||||
_backpackWpnTypes = _backpackWpn select 0;
|
|
||||||
_backpackWpnQtys = _backpackWpn select 1;
|
|
||||||
};
|
|
||||||
[] call _switchUnit;
|
|
||||||
if (gear_done) then {Sleep 0.001;};
|
|
||||||
["1"] call gearDialog_create;
|
|
||||||
if (gear_done) then {Sleep 0.001;};
|
|
||||||
//magazines
|
|
||||||
_countr = 0;
|
|
||||||
{
|
|
||||||
if ((typeName _x) != "STRING") then {
|
|
||||||
_isWeapon = (isClass(configFile >> "CfgWeapons" >> (_x select 0)));
|
|
||||||
} else {
|
|
||||||
_isWeapon = (isClass(configFile >> "CfgWeapons" >> _x));
|
|
||||||
};
|
|
||||||
if (!_isWeapon) then {
|
|
||||||
_countr = _countr + 1;
|
|
||||||
if ((typeName _x) != "STRING") then {
|
|
||||||
dayz_myBackpack addMagazineCargoGlobal [(_x select 0), 1];
|
|
||||||
_idc = 4999 + _countr;
|
|
||||||
_idc setIDCAmmoCount (_x select 1);
|
|
||||||
} else {
|
|
||||||
dayz_myBackpack addMagazineCargoGlobal [_x, 1];
|
|
||||||
};
|
|
||||||
};
|
|
||||||
} count _backpackMag;
|
|
||||||
(findDisplay 106) closeDisplay 0;
|
|
||||||
if (gear_done) then {Sleep 0.001; disableUserInput false;};
|
|
||||||
_countr = 0;
|
|
||||||
{
|
|
||||||
|
|
||||||
dayz_myBackpack addWeaponCargoGlobal [_x,(_backpackWpnQtys select _countr)];
|
//Add and Fill BackPack
|
||||||
|
if (!isNil "_newBackpackType" && {_newBackpackType != ""}) then {
|
||||||
|
_newUnit addBackpack _newBackpackType;
|
||||||
|
//_oldBackpack = dayz_myBackpack;
|
||||||
|
dayz_myBackpack = unitBackpack _newUnit;
|
||||||
|
|
||||||
|
_backpackWpnTypes = [];
|
||||||
|
_backpackWpnQtys = [];
|
||||||
|
if (count _backpackWpn > 0) then {
|
||||||
|
_backpackWpnTypes = _backpackWpn select 0;
|
||||||
|
_backpackWpnQtys = _backpackWpn select 1;
|
||||||
|
};
|
||||||
|
call _switchUnit;
|
||||||
|
if (gear_done) then {sleep 0.001;};
|
||||||
|
["1"] call gearDialog_create;
|
||||||
|
if (gear_done) then {sleep 0.001;};
|
||||||
|
_countr = 0;
|
||||||
|
{
|
||||||
|
if (typeName _x != "STRING") then {
|
||||||
|
_isWeapon = isClass (configFile >> "CfgWeapons" >> (_x select 0));
|
||||||
|
} else {
|
||||||
|
_isWeapon = isClass (configFile >> "CfgWeapons" >> _x);
|
||||||
|
};
|
||||||
|
if (!_isWeapon) then {
|
||||||
_countr = _countr + 1;
|
_countr = _countr + 1;
|
||||||
} count _backpackWpnTypes;
|
if (typeName _x != "STRING") then {
|
||||||
} else { [] call _switchUnit; };
|
dayz_myBackpack addMagazineCargoGlobal [_x select 0, 1];
|
||||||
} else { [] call _switchUnit; };
|
_idc = 4999 + _countr;
|
||||||
|
_idc setIDCAmmoCount (_x select 1);
|
||||||
|
} else {
|
||||||
|
dayz_myBackpack addMagazineCargoGlobal [_x, 1];
|
||||||
|
};
|
||||||
|
};
|
||||||
|
} count _backpackMag;
|
||||||
|
(findDisplay 106) closeDisplay 0;
|
||||||
|
if (gear_done) then {sleep 0.001; disableUserInput false;};
|
||||||
|
_countr = 0;
|
||||||
|
{
|
||||||
|
dayz_myBackpack addWeaponCargoGlobal [_x,(_backpackWpnQtys select _countr)];
|
||||||
|
_countr = _countr + 1;
|
||||||
|
} count _backpackWpnTypes;
|
||||||
|
} else {
|
||||||
|
call _switchUnit;
|
||||||
|
};
|
||||||
|
|
||||||
//Debug Message
|
//Debug Message
|
||||||
diag_log "Swichtable Unit Created. Equipment:";
|
diag_log "Swichtable Unit Created. Equipment:";
|
||||||
@@ -176,11 +176,15 @@ deleteGroup _oldGroup;
|
|||||||
|
|
||||||
// player switchCamera = _currentCamera;
|
// player switchCamera = _currentCamera;
|
||||||
if (_currentWpn != "") then {_newUnit selectWeapon _currentWpn;};
|
if (_currentWpn != "") then {_newUnit selectWeapon _currentWpn;};
|
||||||
|
|
||||||
[objNull, player, rSwitchMove, _currentAnim] call RE;
|
[objNull, player, rSwitchMove, _currentAnim] call RE;
|
||||||
|
//dayz_originalPlayer attachTo [_newUnit];
|
||||||
player disableConversation true;
|
player disableConversation true;
|
||||||
player setVariable ["BIS_noCoreConversations",true];
|
player setVariable ["BIS_noCoreConversations",true];
|
||||||
|
|
||||||
|
// _playerUID=getPlayerUID player;
|
||||||
|
// _playerObjName = format["player%1",_playerUID];
|
||||||
|
// call compile format["%1 = player;",_playerObjName];
|
||||||
|
// publicVariable _playerObjName;
|
||||||
|
|
||||||
call dayz_meleeMagazineCheck;
|
call dayz_meleeMagazineCheck;
|
||||||
{player reveal _x} count (nearestObjects [getPosATL player,["AllVehicles","WeaponHolder","Land_A_tent","BuiltItems","ModularItems","DZE_Base_Object"],75]);
|
{player reveal _x} count (nearestObjects [getPosATL player,["AllVehicles","WeaponHolder","Land_A_tent","BuiltItems","ModularItems","DZE_Base_Object"],75]);
|
||||||
Reference in New Issue
Block a user