I swear this feels a lot like my last post, but this is different. I am trying to change the member variables of the SnapPositions in the CfgConstruction class. This is located both in the exile_server config.bin and the exile_client.bin. I am trying to make a server addon that will override these snap values. I have made an exile_construct.pbo in the ExileServer addons folder. I need help because I have seen this done serverside, but I believe I am doing something wrong. I am obviously trying to do more than change these snap values, but this is the wrench in the road that will prevent me from further coding new exile construction features.
My config.cpp looks similar to the following:
class CfgPatches
{
class exile_construct
{
requiredVersion = 0.1;
requiredAddons[] = {"exile_server","exile_client"};
units[] = {};
weapons[] = {};
};
};
/* Tried with and without pre/posInit
class CfgFunctions
{
class exile_construct
{
class main
{
file="exile_construct\bootstrap";
class preInit {preInit = 1;};
class postInit {postInit = 1;};
};
};
};
*/
class AbstractConstruction;
class CfgConstruction
{
class AbstractWall: AbstractConstruction
{
class SnapPositions
{
Wall01[]={0,0,0}; //Set to zero just for an example
Wall02[]={0,0,0};
Wall03[]={0,0,0};
Wall04[]={0,0,0};
Floor01[]={0,2.875,3};
Floor02[]={0,-2.875,3};
};
class SnapObjects
{
class Exile_Construction_WoodWallHalf_Static
{
positions[]=
{
"Wall01",
"Wall02",
"Wall03",
"Wall04"
//Took out Wall05 - 08
};
};
...//the rest of the objects follow
};
};
};
My addon has no functions, so when I used pre/postInit my preInit looked like this:
{
_code = compileFinal (preprocessFileLineNumbers (_x select 1));
missionNamespace setVariable [(_x select 0), _code];
}
forEach
[
];
Edit1 20170904: Seems like the ExileClient_construction_thread and my ExileServer_system_checkClass get different values for output.
My ExileServer_system_checkClass code:
private["_array"];
_array = getArray (configFile >> "CfgConstruction" >> "AbstractWall" >> "SnapPositions" >> "Wall01");
{
if( _forEachIndex == 0)then { format["Wall01 X: %1",_x] call ExileServer_util_log;};
if( _forEachIndex == 1)then { format["Wall01 Y: %1",_x] call ExileServer_util_log;};
if( _forEachIndex == 2)then { format["Wall01 Z: %1",_x] call ExileServer_util_log;};
}
forEach _array;
//Outputs the value I want them to be; Even if I check against ConcreteDoor instead of Abstract wall I get the same output
14:52:50 "ExileServer - Wall01 X: -3"
14:52:50 "ExileServer - Wall01 Y: 1.5"
14:52:50 "ExileServer - Wall01 Z: 0"
ExileClient_construction_thread code:
case 3:
{
ExileClientConstructionIsSnapped = false;
if (ExileClientConstructionIsInSelectSnapObjectMode) then
{
ExileClientConstructionPossibleSnapPositions = [];
ExileClientConstructionCurrentSnapToObject = objNull;
_position = getPosATL player;
_position set [2, -500];
_rotation = (ExileClientConstructionRotation + (getDir player) + 360) % 360;
_vectorDirection = [sin(_rotation), cos(_rotation), 0];
_potentionalSnapObject = cursorTarget;
if !(isNull _potentionalSnapObject) then
{
if (_potentionalSnapObject distance player < 12) then
{
_snapToClassName = typeOf _potentionalSnapObject;
if (_snapToClassName in ExileClientConstructionSnapToObjectClassNames) then
{
ExileClientConstructionCurrentSnapToObject = _potentionalSnapObject;
_snapToConfig = ("getText(_x >> 'staticObject') == _snapToClassName" configClasses(configFile >> "CfgConstruction")) select 0;
//Begin my check
diag_log format["Not array, _snapToConfig = %1", _snapToConfig];
//End my check
{
_snapPosition = getArray (_snapToConfig >> "SnapPositions" >> _x);
//Begin my check
_snapPositionName = _x;
{
if( _forEachIndex == 0)then { diag_log format["%1 X: %2", _snapPositionName, _x]};
if( _forEachIndex == 1)then { diag_log format["%1 Y: %2", _snapPositionName, _x]};
if( _forEachIndex == 2)then { diag_log format["%1 Z: %2", _snapPositionName, _x]};
}
forEach _snapPosition;
//End my check
_possibleSnapPosition = ASLtoATL (AGLtoASL (_potentionalSnapObject modelToWorld _snapPosition));
ExileClientConstructionPossibleSnapPositions pushBack _possibleSnapPosition;
}
forEach getArray (ExileClientConstructionConfig >> "SnapObjects" >> _snapToClassName >> "positions");
};
};
};
}
//Output the old values, that I do not want
14:53:03 "Not array, _snapToConfig = bin\config.bin/CfgConstruction/ConcreteDoor"
14:53:03 "Wall01 X: -6"
14:53:03 "Wall01 Y: 0"
14:53:03 "Wall01 Z: 0"
14:53:03 "Wall02 X: -2.875"
14:53:03 "Wall02 Y: -2.875"
14:53:03 "Wall02 Z: 0"
14:53:03 "Wall03 X: 2.875"
14:53:03 "Wall03 Y: -2.875"
14:53:03 "Wall03 Z: 0"
14:53:03 "Wall04 X: 6"
14:53:03 "Wall04 Y: 0"
14:53:03 "Wall04 Z: 0"
14:53:03 "Wall05 X: 2.875"
14:53:03 "Wall05 Y: 2.875"
14:53:03 "Wall05 Z: 0"
14:53:03 "Wall06 X: -2.875"
14:53:03 "Wall06 Y: 2.875"
14:53:03 "Wall06 Z: 0"
14:53:03 "Wall07 X: 0"
14:53:03 "Wall07 Y: 0"
14:53:03 "Wall07 Z: 3"
14:53:03 "Wall08 X: 0"
14:53:03 "Wall08 Y: 0"
14:53:03 "Wall08 Z: -3"