Skip to content
This repository has been archived by the owner on Jul 30, 2022. It is now read-only.

Commit

Permalink
Variables unification, fn_SC_unicoins update
Browse files Browse the repository at this point in the history
  • Loading branch information
Vladimir Benes committed Aug 21, 2017
1 parent 682f99a commit 7cd8fce
Show file tree
Hide file tree
Showing 7 changed files with 236 additions and 110 deletions.
@@ -1,7 +1,7 @@
// ===========================================================================
// @PAINT VEHICLES
// ===========================================================================
private ["_object","_colorArr","_textArr","_pname","_PUID","_name","_pcolor","_pcolor2","_clrinit","_clrinit2","_texture","_texture2","_position","_worldspace","_fuel","_objectID","_key"];
private ["_object","_colorArr","_textArr","_pname","_PUID","_name","_colour","_colour2","_clrinit","_clrinit2","_texture","_texture2","_position","_worldspace","_fuel","_objectID","_key"];

_object = _this select 0;
_colorArr = _this select 1;
Expand All @@ -12,24 +12,27 @@ _name = getText(configFile >> "cfgVehicles" >> (typeOf _object) >> "displayName"

call {
if (count _textArr == 0) exitWith {
_pcolor = _colorArr select 0;
_pcolor2 = _colorArr select 1;
_colour = _colorArr select 0;
_colour2 = _colorArr select 1;

_clrinit = format ["#(argb,8,8,3)color(%1)",_pcolor];
_clrinit2 = format ["#(argb,8,8,3)color(%1)",_pcolor2];
if (isNil "_colour") then {_colour = "0";};
if (isNil "_colour2") then {_colour2 = "0";};

_clrinit = format ["#(argb,8,8,3)color(%1)",_colour];
_clrinit2 = format ["#(argb,8,8,3)color(%1)",_colour2];

_object setVehicleInit "this setObjectTexture [0,"+str _clrinit+"];";
_object setVehicleInit "this setObjectTexture [1,"+str _clrinit2+"];";

processInitCommands;

_object setVariable["Colour",_pcolor,true];
_object setVariable["Colour2",_pcolor2,true];
_object setVariable["Colour",_colour,true];
_object setVariable["Colour2",_colour2,true];

diag_log format ["VEHICLE PAINT: Player %1 (%2) has painted a %3!",_pname,_PUID,_name];

_position = getPosATL _object;
_worldspace = [getDir _object,_position,_pcolor,_pcolor2] call AN_fnc_formatWorldspace;
_worldspace = [getDir _object,_position,_colour,_colour2] call AN_fnc_formatWorldspace;

_fuel = 0;
_fuel = fuel _object;
Expand All @@ -38,7 +41,7 @@ call {
_key = format["CHILD:305:%1:%2:%3:",_objectID,_worldspace,_fuel];
_key call server_hiveWrite;

// diag_log format ["=== VEHICLE PAINT DEBUG: NORMAL MODE: _pcolor [%1], _pcolor2 [%2]",_pcolor,_pcolor2];
// diag_log format ["=== VEHICLE PAINT DEBUG: NORMAL MODE: _colour [%1], _colour2 [%2]",_colour,_colour2];
};
if (count _colorArr == 0) exitWith {
_texture = _textArr select 0;
Expand All @@ -49,16 +52,16 @@ call {

processInitCommands;

_pcolor = "0";
_pcolor2 = "0";
_colour = "0";
_colour2 = "0";

_object setVariable["Colour",_pcolor,true];
_object setVariable["Colour2",_pcolor2,true];
_object setVariable["Colour",_colour,true];
_object setVariable["Colour2",_colour2,true];

diag_log format ["VEHICLE PAINT: Player %1 (%2) has reset painting of %3!",_pname,_PUID,_name];

_position = getPosATL _object;
_worldspace = [getDir _object,_position,_pcolor,_pcolor2] call AN_fnc_formatWorldspace;
_worldspace = [getDir _object,_position,_colour,_colour2] call AN_fnc_formatWorldspace;

_fuel = 0;
_fuel = fuel _object;
Expand All @@ -67,7 +70,7 @@ call {
_key = format["CHILD:305:%1:%2:%3:",_objectID,_worldspace,_fuel];
_key call server_hiveWrite;

// diag_log format ["=== VEHICLE PAINT DEBUG: RESET MODE: _pcolor [%1], _pcolor2 [%2]",_pcolor,_pcolor2];
// diag_log format ["=== VEHICLE PAINT DEBUG: RESET MODE: _colour [%1], _colour2 [%2]",_colour,_colour2];
};

};
Expand Up @@ -50,15 +50,17 @@ _needUpdate = _object in needUpdate_objects;

// TODO ----------------------
// ===========================================================================
// @UPDATED: PAINT VAEHICLES
// @UPDATED: PAINT VEHICLES
// ===========================================================================
_object_position = {
private ["_position","_worldspace","_fuel","_key","_pcolor","_pcolor2"];
private ["_position","_worldspace","_fuel","_key","_colour","_colour2"];
_position = getPosATL _object;
if (_object isKindOf "AllVehicles") then {
_pcolor = _object getVariable ["Colour","0"];
_pcolor2 = _object getVariable ["Colour2","0"];
_worldspace = [getDir _object,_position,_pcolor,_pcolor2] call AN_fnc_formatWorldspace;
_colour = _object getVariable ["Colour","0"];
_colour2 = _object getVariable ["Colour2","0"];
if (isNil "_colour") then {_colour = "0";};
if (isNil "_colour2") then {_colour2 = "0";};
_worldspace = [getDir _object,_position,_colour,_colour2] call AN_fnc_formatWorldspace;
_fuel = fuel _object;
} else {
_worldspace = [getDir _object, _position] call AN_fnc_formatWorldspace;
Expand Down
28 changes: 14 additions & 14 deletions @DayZ_Epoch_Server/addons/dayz_server/system/server_monitor.sqf
Expand Up @@ -220,7 +220,7 @@ if ((playersNumber west + playersNumber civilian) == 0) exitWith {
_object setVariable ["lastUpdate",diag_ticktime];
_object setVariable ["ObjectID", _idKey, true];
_object setVariable ["OwnerPUID", _ownerPUID, true];
if (Z_SingleCurrency && {_type in DZE_MoneyStorageClasses}) then {
if (Z_SingleCurrency && {(_type in DZE_MoneyStorageClasses) || (_object isKindOf "AllVehicles")}) then {
_object setVariable [Z_MoneyVariable, _storageMoney, true];
};

Expand Down Expand Up @@ -272,7 +272,7 @@ if ((playersNumber west + playersNumber civilian) == 0) exitWith {
// =====================================================================
if (_object isKindOf "AllVehicles") then {
// =====================================================================
private ["_pcolor","_pcolor2","_clrinit","_clrinit2"];
private ["_colour","_colour2","_clrinit","_clrinit2"];
// =====================================================================
_object setVariable ["CharacterID", _ownerID, true];
_isAir = _object isKindOf "Air";
Expand All @@ -284,25 +284,25 @@ if ((playersNumber west + playersNumber civilian) == 0) exitWith {
_object setVariable [_strH,_dam,true];
} foreach _hitpoints;
[_object,"damage"] call server_updateObject;
// =======================================================================
// =====================================================================
if(count _worldspace >= 4) then {
if (((typeName(_worldspace select 2)) == "STRING") and ((typeName(_worldspace select 3)) == "STRING")) then {
_pcolor = _worldspace select 2;
_pcolor2 = _worldspace select 3;
if (_pcolor != "0") then {
_object setVariable ["Colour",_pcolor,true];
_clrinit = format ["#(argb,8,8,3)color(%1)",_pcolor];
_colour = _worldspace select 2;
_colour2 = _worldspace select 3;
if (_colour != "0") then {
_object setVariable ["Colour",_colour,true];
_clrinit = format ["#(argb,8,8,3)color(%1)",_colour];
_object setVehicleInit "this setObjectTexture [0,"+str _clrinit+"];";
};
if (_pcolor2 != "0") then {
_object setVariable ["Colour2",_pcolor2,true];
_clrinit2 = format ["#(argb,8,8,3)color(%1)",_pcolor2];
if (_colour2 != "0") then {
_object setVariable ["Colour2",_colour2,true];
_clrinit2 = format ["#(argb,8,8,3)color(%1)",_colour2];
_object setVehicleInit "this setObjectTexture [1,"+str _clrinit2+"];";
};
processInitCommands;
};
};
// =======================================================================
// =====================================================================

_object setFuel _fuel;
if (!_isSafeObject) then {
Expand Down Expand Up @@ -478,10 +478,10 @@ if (dayz_townGenerator) then {execVM "\z\addons\dayz_server\system\lit_fireplace
_uid = getPlayerUID _player;
_treeModel = _tree call fn_getModelName;

if (_dis < 30 && (_treeModel in dayz_trees or (_treeModel in dayz_plant)) && (_uid != "")) then {
if ((_dis < 30) && (_treeModel in dayz_trees) && (_uid != "")) then {
_tree setDamage 1;
dayz_choppedTrees set [count dayz_choppedTrees,_tree];
diag_log format["Server setDamage on tree or plant %1 chopped down by %2(%3)",_treeModel,_name,_uid];
diag_log format["Server setDamage on tree %1 chopped down by %2(%3)",_treeModel,_name,_uid];
};
};

Expand Down

0 comments on commit 7cd8fce

Please sign in to comment.