mirror of
https://github.com/ravmustang/eXpochVectorBuild4Exile.git
synced 2025-07-25 19:02:18 +00:00
FREE vector building for exile
This commit is contained in:
35
README.md
Normal file
35
README.md
Normal file
@ -0,0 +1,35 @@
|
||||
    
|
||||
|
||||
|
||||
# To the User:
|
||||
####NEW Disclaimer:
|
||||
This was created through research and testing in Arma 3
|
||||
I thank Bohemia for their WIKI and public Forums.
|
||||
Thank you to all who have supported DonkeyPunch, DirtySanchez, eXpoch and our servers.
|
||||
|
||||
As the heading to all the files say:
|
||||
|
||||
|
||||
#### eXpochClient_FREE_vectorBuilding
|
||||
|
||||
#### Made for Anarchy, adapted to eXpoch and ported into Altis Life and Operation BlockHead by DirtySanchez
|
||||
|
||||
#### and NOW EXILE WILL FEEL THE FREE VECTOR, go get a job sellers of scripts, this is a modding community.
|
||||
#### Sharing is caring and douchebaggery is a bannable offense
|
||||
|
||||
#### http://DonkeyPunch.INFO
|
||||
|
||||
|
||||
|
||||
|
||||
####Licensing and Terms:
|
||||
This is free software provided to the community to use for free.
|
||||
Do not charge money to install, support, modify or anything of any matter.
|
||||
NO money is to be involved in any form while dealing with this script.
|
||||
Please join https://discord.me/eXpoch for help installing or troubleshooting.
|
||||
THE HELP IS FREE just like the script.
|
||||
|
||||
All work in this release is licensed under:
|
||||
|
||||
This work is licensed under the Creative Commons Attribution-NonCommercial-NoDerivatives 4.0 International License.
|
||||
To view a copy of this license, visit http://creativecommons.org/licenses/by-nc-nd/4.0/.
|
42
eXile.MAPNAME/CfgExileCustomCode.cpp
Normal file
42
eXile.MAPNAME/CfgExileCustomCode.cpp
Normal file
@ -0,0 +1,42 @@
|
||||
/**
|
||||
* config.cpp class CfgExileCustomCode
|
||||
*
|
||||
* Exile Mod
|
||||
* www.exilemod.com
|
||||
* © 2015 Exile Mod Team
|
||||
*
|
||||
* This work is licensed under the Creative Commons Attribution-NonCommercial-NoDerivatives 4.0 International License.
|
||||
* To view a copy of this license, visit http://creativecommons.org/licenses/by-nc-nd/4.0/.
|
||||
*
|
||||
eXpochClient_FREE_vectorBuilding
|
||||
|
||||
Made for Anarchy, adapted to eXpoch and ported into Altis Life and Operation BlockHead by DirtySanchez
|
||||
|
||||
and NOW EXILE WILL FEEL THE FREE VECTOR, go get a job sellers of scripts, this is a modding community.
|
||||
Sharing is caring and douchebaggery is a bannable offense
|
||||
|
||||
http://DonkeyPunch.INFO
|
||||
*/
|
||||
|
||||
class CfgExileCustomCode
|
||||
{
|
||||
/*
|
||||
You can overwrite every single file of our code without touching it.
|
||||
To do that, add the function name you want to overwrite plus the
|
||||
path to your custom file here. If you wonder how this works, have a
|
||||
look at our bootstrap/fn_preInit.sqf function.
|
||||
|
||||
Simply add the following scheme here:
|
||||
|
||||
<Function Name of Exile> = "<New File Name>";
|
||||
|
||||
Example:
|
||||
|
||||
ExileClient_util_fusRoDah = "myaddon\myfunction.sqf";
|
||||
*/
|
||||
ExileClient_construction_thread = "eXpochVectorBldg\ExileClient_construction_thread.sqf";
|
||||
ExileClient_construction_beginExistingObject = "eXpochVectorBldg\ExileClient_construction_beginExistingObject.sqf";
|
||||
ExileClient_construction_beginNewObject = "eXpochVectorBldg\ExileClient_construction_beginNewObject.sqf";
|
||||
ExileClient_object_construction_network_constructionResponse = "eXpochVectorBldg\ExileClient_object_construction_network_constructionResponse.sqf";
|
||||
ExileClient_construction_handleAbort = "eXpochVectorBldg\ExileClient_construction_handleAbort.sqf";
|
||||
};
|
@ -0,0 +1,49 @@
|
||||
/**
|
||||
* ExileClient_construction_beginExistingObject
|
||||
*
|
||||
* Exile Mod
|
||||
* www.exilemod.com
|
||||
* <20> 2015 Exile Mod Team
|
||||
*
|
||||
* This work is licensed under the Creative Commons Attribution-NonCommercial-NoDerivatives 4.0 International License.
|
||||
* To view a copy of this license, visit http://creativecommons.org/licenses/by-nc-nd/4.0/.
|
||||
*
|
||||
eXpochClient_FREE_vectorBuilding
|
||||
|
||||
Made for Anarchy, adapted to eXpoch and ported into Altis Life and Operation BlockHead by DirtySanchez
|
||||
|
||||
and NOW EXILE WILL FEEL THE FREE VECTOR, go get a job sellers of scripts, this is a modding community.
|
||||
Sharing is caring and douchebaggery is a bannable offense
|
||||
|
||||
http://DonkeyPunch.INFO
|
||||
*/
|
||||
|
||||
private["_previewObjectClassName"];
|
||||
if (ExileClientPlayerIsInCombat) then
|
||||
{
|
||||
["ErrorTitleAndText", ["Construction aborted!", "You cannot build during a combat."]] call ExileClient_gui_toaster_addTemplateToast;
|
||||
}
|
||||
else
|
||||
{
|
||||
ExileClientConstructionObject = _this;
|
||||
ExileClientConstructionCanPlaceObject = false;
|
||||
ExileClientConstructionConfig = ("getText(_x >> 'staticObject') == ExileClientConstructionObject" configClasses(configFile >> "CfgConstruction")) select 0;
|
||||
_previewObjectClassName = getText(ExileClientConstructionConfig >> "previewObject");
|
||||
ExileClientConstructionSnapToObjectClassNames = (ExileClientConstructionConfig >> "SnapObjects") call Bis_fnc_getCfgSubClasses;
|
||||
ExileClientConstructionProcess = 2;
|
||||
ExileClientConstructionRotation = 0;
|
||||
ExileClientConstructionObjectDisplayName = getText(configFile >> "CfgVehicles" >> _previewObjectClassName >> "displayName");
|
||||
ExileClientConstructionOffset = [0, 5,0];
|
||||
BuildPosX = 0;BuildPosY = 5;BuildPosZ = 0;BuildVecYaw = 0;BuildVecPitch = 0;BuildVecRoll = 0;
|
||||
[] call freeVectorBuilding;
|
||||
ExileClientConstructionMode = 1;
|
||||
ExileClientConstructionIsInSelectSnapObjectMode = true;
|
||||
ExileClientConstructionSupportSnapMode = count(ExileClientConstructionSnapToObjectClassNames) > 0;
|
||||
ExileClientConstructionCurrentSnapToObject = objNull;
|
||||
{
|
||||
player reveal _x;
|
||||
}
|
||||
forEach (player nearObjects ["Exile_Construction_Abstract_Static", 20]);
|
||||
["buildConstructionRequest", [_previewObjectClassName,ExileClientConstructionPosition]] call ExileClient_system_network_send;
|
||||
};
|
||||
true
|
@ -0,0 +1,58 @@
|
||||
/**
|
||||
* ExileClient_construction_beginNewObject
|
||||
*
|
||||
* Exile Mod
|
||||
* www.exilemod.com
|
||||
* <20> 2015 Exile Mod Team
|
||||
*
|
||||
* This work is licensed under the Creative Commons Attribution-NonCommercial-NoDerivatives 4.0 International License.
|
||||
* To view a copy of this license, visit http://creativecommons.org/licenses/by-nc-nd/4.0/.
|
||||
*
|
||||
eXpochClient_FREE_vectorBuilding
|
||||
|
||||
Made for Anarchy, adapted to eXpoch and ported into Altis Life and Operation BlockHead by DirtySanchez
|
||||
|
||||
and NOW EXILE WILL FEEL THE FREE VECTOR, go get a job sellers of scripts, this is a modding community.
|
||||
Sharing is caring and douchebaggery is a bannable offense
|
||||
|
||||
http://DonkeyPunch.INFO
|
||||
*/
|
||||
|
||||
private["_kitClassName","_previewObjectClassName"];
|
||||
_kitClassName = _this select 0;
|
||||
ExileClientConstructionConfig = ("getText(_x >> 'kitMagazine') == _kitClassName" configClasses(configFile >> "CfgConstruction")) select 0;
|
||||
_previewObjectClassName = getText(ExileClientConstructionConfig >> "previewObject");
|
||||
ExileClientConstructionSnapToObjectClassNames = (ExileClientConstructionConfig >> "SnapObjects") call Bis_fnc_getCfgSubClasses;
|
||||
ExileClientConstructionProcess = 1;
|
||||
ExileClientConstructionOffset = [0, 5, 0];
|
||||
ExileClientConstructionPosition = [0, 0, 0];
|
||||
BuildPosX = 0;BuildPosY = 5;BuildPosZ = 0;BuildVecYaw = 0;BuildVecPitch = 0;BuildVecRoll = 0;
|
||||
ExileClientConstructionRotation = 0;
|
||||
ExileClientConstructionKitClassName = _kitClassName;
|
||||
ExileClientConstructionObjectDisplayName = getText(configFile >> "CfgVehicles" >> _previewObjectClassName >> "displayName");
|
||||
if (ExileClientPlayerIsInCombat) then
|
||||
{
|
||||
["ErrorTitleAndText", ["Construction aborted!", "You cannot build during a combat."]] call ExileClient_gui_toaster_addTemplateToast;
|
||||
}
|
||||
else
|
||||
{
|
||||
ExileClientConstructionMode = 1;
|
||||
ExileClientConstructionIsInSelectSnapObjectMode = true;
|
||||
ExileClientConstructionSupportSnapMode = count(ExileClientConstructionSnapToObjectClassNames) > 0;
|
||||
ExileClientConstructionCurrentSnapToObject = objNull;
|
||||
ExileClientConstructionPosition = [getPosATL player, ExileClientConstructionOffset select 1, getDir player] call ExileClient_util_math_getPositionInDirection;
|
||||
ExileClientConstructionPosition set[2, ExileClientConstructionOffset select 2];
|
||||
{
|
||||
player reveal _x;
|
||||
}
|
||||
forEach (player nearObjects ["Exile_Construction_Abstract_Static", 20]);
|
||||
if((count _this) < 2 )then
|
||||
{
|
||||
["buildConstructionRequest", [_previewObjectClassName,ExileClientConstructionPosition]] call ExileClient_system_network_send;
|
||||
}
|
||||
else
|
||||
{
|
||||
["buildTerritoryRequest", [_previewObjectClassName, (ASLtoAGL (ATLtoASL ExileClientConstructionPosition)),_this select 1,_this select 2]] call ExileClient_system_network_send;
|
||||
};
|
||||
};
|
||||
true
|
@ -0,0 +1,81 @@
|
||||
/**
|
||||
* ExileClient_construction_handleAbort
|
||||
*
|
||||
* Exile Mod
|
||||
* www.exilemod.com
|
||||
* <20> 2015 Exile Mod Team
|
||||
*
|
||||
* This work is licensed under the Creative Commons Attribution-NonCommercial-NoDerivatives 4.0 International License.
|
||||
* To view a copy of this license, visit http://creativecommons.org/licenses/by-nc-nd/4.0/.
|
||||
*
|
||||
eXpochClient_FREE_vectorBuilding
|
||||
|
||||
Made for Anarchy, adapted to eXpoch and ported into Altis Life and Operation BlockHead by DirtySanchez
|
||||
|
||||
and NOW EXILE WILL FEEL THE FREE VECTOR, go get a job sellers of scripts, this is a modding community.
|
||||
Sharing is caring and douchebaggery is a bannable offense
|
||||
|
||||
http://DonkeyPunch.INFO
|
||||
*/
|
||||
|
||||
private["_simulatePhysics"];
|
||||
_simulatePhysics = _this;
|
||||
switch (ExileClientConstructionResult) do
|
||||
{
|
||||
case 1:
|
||||
{
|
||||
if( ExileClientConstructionProcess isEqualTo 1) then
|
||||
{
|
||||
[player, ExileClientConstructionKitClassName] call ExileClient_util_playerCargo_remove;
|
||||
};
|
||||
[ExileClientConstructionObject, getText (ExileClientConstructionConfig >> "staticObject"), _simulatePhysics] spawn ExileClient_construction_simulationCountDown;
|
||||
if (getText (ExileClientConstructionConfig >> "staticObject") isEqualTo "Exile_Container_Safe") then
|
||||
{
|
||||
["SuccessTitleAndText", ["Placed safe!", "The PIN has been set to 0000."]] call ExileClient_gui_toaster_addTemplateToast;
|
||||
}
|
||||
else
|
||||
{
|
||||
["SuccessTitleAndText", ["Placed object!", format ["You have successfully placed a %1.", ExileClientConstructionObjectDisplayName]]] call ExileClient_gui_toaster_addTemplateToast;
|
||||
};
|
||||
};
|
||||
case 3:
|
||||
{
|
||||
if (ExileClientConstructionProcess isEqualTo 2) then
|
||||
{
|
||||
[ExileClientConstructionObject, getText (ExileClientConstructionConfig >> "staticObject"), true] spawn ExileClient_construction_simulationCountDown;
|
||||
}
|
||||
else
|
||||
{
|
||||
deleteVehicle ExileClientConstructionObject;
|
||||
};
|
||||
["ErrorTitleAndText", ["Construction aborted!", "Do not move more than 20 meters."]] call ExileClient_gui_toaster_addTemplateToast;
|
||||
};
|
||||
case 2:
|
||||
{
|
||||
if (ExileClientConstructionProcess isEqualTo 2) then
|
||||
{
|
||||
[ExileClientConstructionObject, getText(ExileClientConstructionConfig >> "staticObject"), _simulatePhysics] spawn ExileClient_construction_simulationCountDown;
|
||||
}
|
||||
else
|
||||
{
|
||||
deleteVehicle ExileClientConstructionObject;
|
||||
};
|
||||
if (ExileClientPlayerIsInCombat) then
|
||||
{
|
||||
["ErrorTitleAndText", ["Construction aborted!", "You cannot build during a combat."]] call ExileClient_gui_toaster_addTemplateToast;
|
||||
}
|
||||
else
|
||||
{
|
||||
["ErrorTitleOnly", ["Construction aborted!"]] call ExileClient_gui_toaster_addTemplateToast;
|
||||
};
|
||||
};
|
||||
};
|
||||
BuildPosX = 0;BuildPosY = 5;BuildPosZ = 0;
|
||||
BuildVecYaw = 0;BuildVecPitch = 0;BuildVecRoll = 0;
|
||||
(findDisplay 46) displayRemoveEventHandler ["KeyDown", keyDownEHId];
|
||||
ExileClientConstructionObject = objNull;
|
||||
ExileClientIsInConstructionMode = false;
|
||||
ExileClientConstructionResult = 0;
|
||||
ExileClientConstructionProcess = 0;
|
||||
ExileClientConstructionLock = false;
|
||||
true
|
@ -0,0 +1,277 @@
|
||||
/**
|
||||
* ExileClient_construction_thread
|
||||
*
|
||||
* Exile Mod
|
||||
* www.exilemod.com
|
||||
* <20> 2015 Exile Mod Team
|
||||
*
|
||||
* This work is licensed under the Creative Commons Attribution-NonCommercial-NoDerivatives 4.0 International License.
|
||||
* To view a copy of this license, visit http://creativecommons.org/licenses/by-nc-nd/4.0/.
|
||||
*
|
||||
eXpochClient_FREE_vectorBuilding
|
||||
|
||||
Made for Anarchy, adapted to eXpoch and ported into Altis Life and Operation BlockHead by DirtySanchez
|
||||
|
||||
and NOW EXILE WILL FEEL THE FREE VECTOR, go get a job sellers of scripts, this is a modding community.
|
||||
Sharing is caring and douchebaggery is a bannable offense
|
||||
|
||||
http://DonkeyPunch.INFO
|
||||
*/
|
||||
|
||||
private["_boundingBox","_boundingBoxMinimum","_boundingBoxMaximum","_boundingBoxPointsTop","_boundingBoxPointsBottom","_objectColor","_materialColor","_simulatePhysics","_position","_rotation","_vectorDirection","_isFlag","_vectorUp","_potentionalSnapObject","_snapToClassName","_snapToConfig","_snapPosition","_possibleSnapPosition","_contactThreshold","_isBelowTerrain","_worldPosition","_isInAir","_numberOfContactsBottom","_startPosition","_endPosition","_newDirAndUp"];
|
||||
scriptName 'Exile Construction Thread';
|
||||
("ExileClientConstructionModeLayer" call BIS_fnc_rscLayer) cutRsc ["RscExileConstructionMode", "PLAIN", 1, false];
|
||||
ExileClientIsInConstructionMode = true;
|
||||
ExileClientConstructionResult = 0;
|
||||
ExileClientConstructionStartPosition = getPosASL player;
|
||||
_boundingBox = boundingBoxReal ExileClientConstructionObject;
|
||||
_boundingBoxMinimum = _boundingBox select 0;
|
||||
_boundingBoxMaximum = _boundingBox select 1;
|
||||
_boundingBoxPointsTop =
|
||||
[
|
||||
[_boundingBoxMinimum select 0, _boundingBoxMinimum select 1, _boundingBoxMaximum select 2],
|
||||
[_boundingBoxMinimum select 0, _boundingBoxMaximum select 1, _boundingBoxMaximum select 2],
|
||||
[_boundingBoxMaximum select 0, _boundingBoxMinimum select 1, _boundingBoxMaximum select 2],
|
||||
[_boundingBoxMaximum select 0, _boundingBoxMaximum select 1, _boundingBoxMaximum select 2]
|
||||
];
|
||||
_boundingBoxPointsBottom =
|
||||
[
|
||||
[_boundingBoxMinimum select 0, _boundingBoxMinimum select 1, _boundingBoxMinimum select 2],
|
||||
[_boundingBoxMinimum select 0, _boundingBoxMaximum select 1, _boundingBoxMinimum select 2],
|
||||
[_boundingBoxMaximum select 0, _boundingBoxMinimum select 1, _boundingBoxMinimum select 2],
|
||||
[_boundingBoxMaximum select 0, _boundingBoxMaximum select 1, _boundingBoxMinimum select 2],
|
||||
[0, 0, _boundingBoxMinimum select 2]
|
||||
];
|
||||
ExileClientConstructionBoundingRadius = 1 + 0.5 * ([_boundingBoxMaximum select 0, _boundingBoxMaximum select 1, 0] distance [_boundingBoxMinimum select 0, _boundingBoxMinimum select 1, 0]);
|
||||
ExileClientConstructionOffset set [1, 5 max ExileClientConstructionBoundingRadius];
|
||||
_objectColor = "#(argb,2,2,1)color(0.7,0.93,0,0.6,ca)";
|
||||
_materialColor = _objectColor;
|
||||
_simulatePhysics = false;
|
||||
_position = [0, 0, 0];
|
||||
_rotation = 0;
|
||||
_vectorDirection = [0, 0, 0];
|
||||
_isFlag = ExileClientConstructionKitClassName isEqualTo "Exile_Item_Flag";
|
||||
if (_isFlag) then
|
||||
{
|
||||
ExileClientConstructionModePhysx = false;
|
||||
};
|
||||
[] call ExileClient_gui_constructionMode_update;
|
||||
while {ExileClientConstructionResult isEqualTo 0} do
|
||||
{
|
||||
if (ExileClientConstructionProcess isEqualTo 1) then
|
||||
{
|
||||
if !(ExileClientConstructionKitClassName in (magazines player)) then
|
||||
{
|
||||
ExileClientConstructionResult = 2;
|
||||
};
|
||||
};
|
||||
if !(ExileClientConstructionLock) then
|
||||
{
|
||||
_vectorUp = [0, 0, 1];
|
||||
ExileClientConstructionCanPlaceObject = false;
|
||||
switch (ExileClientConstructionMode) do
|
||||
{
|
||||
case 1:
|
||||
{
|
||||
_newDirAndUp = [[sin BuildVecYaw * cos BuildVecPitch, cos BuildVecYaw * cos BuildVecPitch, sin BuildVecPitch],[[ sin BuildVecRoll,-sin BuildVecPitch,cos BuildVecRoll * cos BuildVecPitch],-BuildVecYaw] call BIS_fnc_rotateVector2D];
|
||||
_vectorDirection = _newDirAndUp select 0;
|
||||
_vectorUp = _newDirAndUp select 1;
|
||||
ExileClientConstructionObject setVectorDirAndUp [_vectorDirection,_vectorUp];
|
||||
_position = ASLtoATL (AGLtoASL (player modelToWorld ExileClientConstructionOffset));
|
||||
ExileClientConstructionObject setPosATL _position;
|
||||
ExileClientConstructionObject attachTo [player,ExileClientConstructionOffset];
|
||||
|
||||
//_position = ASLtoATL (AGLtoASL (player modelToWorld ExileClientConstructionOffset));
|
||||
//_rotation = (ExileClientConstructionRotation + (getDir player) + 360) % 360;
|
||||
//_vectorDirection = [sin(_rotation), cos(_rotation), 0];
|
||||
};
|
||||
case 2:
|
||||
{
|
||||
_newDirAndUp = [[sin BuildVecYaw * cos BuildVecPitch, cos BuildVecYaw * cos BuildVecPitch, sin BuildVecPitch],[[ sin BuildVecRoll,-sin BuildVecPitch,cos BuildVecRoll * cos BuildVecPitch],-BuildVecYaw] call BIS_fnc_rotateVector2D];
|
||||
_vectorDirection = _newDirAndUp select 0;
|
||||
_vectorUp = _newDirAndUp select 1;
|
||||
ExileClientConstructionObject setVectorDirAndUp [_vectorDirection,_vectorUp];
|
||||
|
||||
_position = ASLtoATL (AGLtoASL (player modelToWorld ExileClientConstructionOffset));
|
||||
_position =
|
||||
[
|
||||
(_position select 0) - ((_position select 0) % (ExileClientConstructionGrid select 0)),
|
||||
(_position select 1) - ((_position select 1) % (ExileClientConstructionGrid select 1)),
|
||||
(_position select 2) - ((_position select 2) % (ExileClientConstructionGrid select 2))
|
||||
];
|
||||
|
||||
|
||||
//_rotation = (ExileClientConstructionRotation + 360) % 360;
|
||||
//_vectorDirection = [sin(_rotation), cos(_rotation), 0];
|
||||
};
|
||||
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;
|
||||
{
|
||||
_snapPosition = getArray (_snapToConfig >> "SnapPositions" >> _x);
|
||||
_possibleSnapPosition = ASLtoATL (AGLtoASL (_potentionalSnapObject modelToWorld _snapPosition));
|
||||
ExileClientConstructionPossibleSnapPositions pushBack _possibleSnapPosition;
|
||||
}
|
||||
forEach getArray (ExileClientConstructionConfig >> "SnapObjects" >> _snapToClassName >> "positions");
|
||||
};
|
||||
};
|
||||
};
|
||||
}
|
||||
else
|
||||
{
|
||||
_newDirAndUp = [[sin BuildVecYaw * cos BuildVecPitch, cos BuildVecYaw * cos BuildVecPitch, sin BuildVecPitch],[[ sin BuildVecRoll,-sin BuildVecPitch,cos BuildVecRoll * cos BuildVecPitch],-BuildVecYaw] call BIS_fnc_rotateVector2D];
|
||||
_vectorDirection = _newDirAndUp select 0;
|
||||
_vectorUp = _newDirAndUp select 1;
|
||||
ExileClientConstructionObject setVectorDirAndUp [_vectorDirection,_vectorUp];
|
||||
_position = ASLtoATL (AGLtoASL (player modelToWorld ExileClientConstructionOffset));
|
||||
ExileClientConstructionObject setPosATL _position;
|
||||
ExileClientConstructionObject attachTo [ExileClientConstructionCurrentSnapToObject,ExileClientConstructionOffset];
|
||||
{
|
||||
if (_x distance _position < 1) exitWith
|
||||
{
|
||||
_position = _x;
|
||||
_rotation = (ExileClientConstructionRotation + (getDir ExileClientConstructionCurrentSnapToObject) + 360) % 360;
|
||||
_vectorDirection = [sin(_rotation), cos(_rotation), 0];
|
||||
_vectorUp = vectorUp ExileClientConstructionCurrentSnapToObject;
|
||||
ExileClientConstructionIsSnapped = true;
|
||||
};
|
||||
}
|
||||
forEach ExileClientConstructionPossibleSnapPositions;
|
||||
};
|
||||
};
|
||||
};
|
||||
ExileClientConstructionObject setVectorDirAndUp [_vectorDirection,_vectorUp];
|
||||
ExileClientConstructionObject setPosATL _position;
|
||||
};
|
||||
_contactThreshold = 0.1;
|
||||
_isBelowTerrain = true;
|
||||
{
|
||||
_worldPosition = ASLtoATL (AGLtoASL (ExileClientConstructionObject modelToWorld _x));
|
||||
if ((_worldPosition select 2) > _contactThreshold) exitWith {_isBelowTerrain = false};
|
||||
}
|
||||
forEach _boundingBoxPointsTop;
|
||||
_isInAir = true;
|
||||
_numberOfContactsBottom = 0;
|
||||
{
|
||||
_worldPosition = ASLtoATL (AGLtoASL (ExileClientConstructionObject modelToWorld _x));
|
||||
if ((_worldPosition select 2) < _contactThreshold) then
|
||||
{
|
||||
_isInAir = false
|
||||
};
|
||||
_startPosition = ATLtoASL[_worldPosition select 0, _worldPosition select 1, (_worldPosition select 2) + _contactThreshold];
|
||||
_endPosition = ATLtoASL [_worldPosition select 0, _worldPosition select 1, (_worldPosition select 2) - _contactThreshold];
|
||||
if (count lineIntersectsObjs[_startPosition, _endPosition, ExileClientConstructionObject, objNull, false, 2] > 0) then
|
||||
{
|
||||
_numberOfContactsBottom = _numberOfContactsBottom + 1;
|
||||
};
|
||||
}
|
||||
forEach _boundingBoxPointsBottom;
|
||||
if (_isBelowTerrain) then
|
||||
{
|
||||
ExileClientConstructionCanPlaceObject = false;
|
||||
_simulatePhysics = false;
|
||||
_objectColor = "#(argb,2,2,1)color(0.91,0,0,0.6,ca)";
|
||||
}
|
||||
else
|
||||
{
|
||||
ExileClientConstructionCanPlaceObject = true;
|
||||
if !(ExileClientConstructionModePhysx) then
|
||||
{
|
||||
_objectColor = "#(argb,2,2,1)color(0.7,0.93,0,0.6,ca)";
|
||||
_simulatePhysics = false;
|
||||
}
|
||||
else
|
||||
{
|
||||
if (_isInAir) then
|
||||
{
|
||||
if (_numberOfContactsBottom >= 3) then
|
||||
{
|
||||
_objectColor = "#(argb,2,2,1)color(0.7,0.93,0,0.6,ca)";
|
||||
_simulatePhysics = false;
|
||||
}
|
||||
else
|
||||
{
|
||||
_objectColor = "#(argb,2,2,1)color(1,0.79,0.07,0.6,ca)";
|
||||
_simulatePhysics = true;
|
||||
};
|
||||
}
|
||||
else
|
||||
{
|
||||
_objectColor = "#(argb,2,2,1)color(0.7,0.93,0,0.6,ca)";
|
||||
_simulatePhysics = false;
|
||||
};
|
||||
};
|
||||
};
|
||||
if (ExileClientConstructionMode isEqualTo 3) then
|
||||
{
|
||||
if (!ExileClientConstructionIsSnapped) then
|
||||
{
|
||||
ExileClientConstructionCanPlaceObject = false;
|
||||
_simulatePhysics = false;
|
||||
_objectColor = "#(argb,2,2,1)color(0.91,0,0,0.6,ca)";
|
||||
};
|
||||
};
|
||||
if !(([configName ExileClientConstructionConfig, ASLtoAGL (getPosASL ExileClientConstructionObject), getPlayerUID player] call ExileClient_util_world_canBuildHere) isEqualTo 0) then
|
||||
{
|
||||
ExileClientConstructionCanPlaceObject = false;
|
||||
_simulatePhysics = false;
|
||||
_objectColor = "#(argb,2,2,1)color(0.91,0,0,0.6,ca)";
|
||||
};
|
||||
if (_isFlag) then
|
||||
{
|
||||
if (((getPos ExileClientConstructionObject) select 2) > 0.2) then
|
||||
{
|
||||
ExileClientConstructionCanPlaceObject = false;
|
||||
_simulatePhysics = false;
|
||||
_objectColor = "#(argb,2,2,1)color(0.91,0,0,0.6,ca)";
|
||||
};
|
||||
};
|
||||
if (_objectColor != _materialColor) then
|
||||
{
|
||||
ExileClientConstructionObject setObjectTextureGlobal[0, _objectColor];
|
||||
ExileClientConstructionObject setObjectTextureGlobal[1, _objectColor];
|
||||
ExileClientConstructionObject setObjectTextureGlobal[2, _objectColor];
|
||||
ExileClientConstructionObject setObjectTextureGlobal[3, _objectColor];
|
||||
_materialColor = _objectColor;
|
||||
};
|
||||
if (ExileClientConstructionStartPosition distance (getPosASL player) > 20) then
|
||||
{
|
||||
ExileClientConstructionResult = 3;
|
||||
};
|
||||
if (ExileClientPlayerIsInCombat) then
|
||||
{
|
||||
ExileClientConstructionModePhysx = true;
|
||||
ExileClientConstructionResult = 2;
|
||||
};
|
||||
uiSleep 0.001;
|
||||
};
|
||||
if !(ExileClientConstructionModePhysx) then
|
||||
{
|
||||
_simulatePhysics = false;
|
||||
};
|
||||
_simulatePhysics call ExileClient_construction_handleAbort;
|
||||
ExileClientConstructionObject = objNull;
|
||||
ExileClientIsInConstructionMode = false;
|
||||
ExileClientConstructionResult = 0;
|
||||
ExileClientConstructionProcess = 0;
|
||||
ExileClientConstructionLock = false;
|
||||
("ExileClientConstructionModeLayer" call BIS_fnc_rscLayer) cutText ["", "PLAIN"];
|
||||
true
|
@ -0,0 +1,28 @@
|
||||
/**
|
||||
* ExileClient_object_construction_network_constructionResponse
|
||||
*
|
||||
* Exile Mod
|
||||
* www.exilemod.com
|
||||
* <20> 2015 Exile Mod Team
|
||||
*
|
||||
* This work is licensed under the Creative Commons Attribution-NonCommercial-NoDerivatives 4.0 International License.
|
||||
* To view a copy of this license, visit http://creativecommons.org/licenses/by-nc-nd/4.0/.
|
||||
*
|
||||
eXpochClient_FREE_vectorBuilding
|
||||
|
||||
Made for Anarchy, adapted to eXpoch and ported into Altis Life and Operation BlockHead by DirtySanchez
|
||||
|
||||
and NOW EXILE WILL FEEL THE FREE VECTOR, go get a job sellers of scripts, this is a modding community.
|
||||
Sharing is caring and douchebaggery is a bannable offense
|
||||
|
||||
http://DonkeyPunch.INFO
|
||||
*/
|
||||
|
||||
private["_objectNetID","_object"];
|
||||
_objectNetID = _this select 0;
|
||||
_object = objectFromNetId _objectNetID;
|
||||
ExileClientConstructionObject = _object;
|
||||
ExileClientConstructionCanPlaceObject = false;
|
||||
[] spawn ExileClient_construction_thread;
|
||||
[] call freeVectorBuilding;
|
||||
true
|
@ -0,0 +1,164 @@
|
||||
/*
|
||||
eXpochClient_FREE_vectorBuilding
|
||||
|
||||
Made for Anarchy, adapted to eXpoch and ported into Altis Life and Operation BlockHead by DirtySanchez
|
||||
|
||||
and NOW EXILE WILL FEEL THE FREE VECTOR, go get a job sellers of scripts, this is a modding community.
|
||||
Sharing is caring and douchebaggery is a bannable offense
|
||||
|
||||
http://DonkeyPunch.INFO
|
||||
|
||||
The contents of this file are under the following license:
|
||||
Creative Commons Attribution-NonCommercial-NoDerivatives 4.0 International License
|
||||
http://creativecommons.org/licenses/by-nc-nd/4.0/
|
||||
*/
|
||||
|
||||
keyDownEHId = (findDisplay 46) displayAddEventHandler ["KeyDown", {
|
||||
params ["_dikCodeKey", "_dikCode", "_shift", "_ctrl", "_alt"];
|
||||
private _handled = false;
|
||||
private _newDirAndUp = [[ sin BuildVecYaw * cos BuildVecPitch,cos BuildVecYaw * cos BuildVecPitch,sin BuildVecPitch], [[ sin BuildVecRoll,-sin BuildVecPitch,cos BuildVecRoll * cos BuildVecPitch],-BuildVecYaw] call BIS_fnc_rotateVector2D];
|
||||
private _adjust = 1;
|
||||
|
||||
switch(_dikCode)do
|
||||
{
|
||||
case 71: {
|
||||
_adjust = 1;
|
||||
if(_shift)then{_adjust = 3;};
|
||||
if(_ctrl)then{_adjust = 0.5;};
|
||||
if(_alt)then{ _adjust = 0.25;};
|
||||
BuildVecYaw = BuildVecYaw - _adjust;
|
||||
_newDirAndUp = [[ sin BuildVecYaw * cos BuildVecPitch,cos BuildVecYaw * cos BuildVecPitch,sin BuildVecPitch], [[ sin BuildVecRoll,-sin BuildVecPitch,cos BuildVecRoll * cos BuildVecPitch],-BuildVecYaw] call BIS_fnc_rotateVector2D];
|
||||
ExileClientConstructionObject setVectorDirAndUp _newDirAndUp;
|
||||
_handled = true;
|
||||
};
|
||||
case 73: {
|
||||
_adjust = 1;
|
||||
if(_shift)then{_adjust = 3;};
|
||||
if(_ctrl)then{_adjust = 0.5;};
|
||||
if(_alt)then{ _adjust = 0.25;};
|
||||
BuildVecYaw = BuildVecYaw + _adjust;
|
||||
_newDirAndUp = [[ sin BuildVecYaw * cos BuildVecPitch,cos BuildVecYaw * cos BuildVecPitch,sin BuildVecPitch], [[ sin BuildVecRoll,-sin BuildVecPitch,cos BuildVecRoll * cos BuildVecPitch],-BuildVecYaw] call BIS_fnc_rotateVector2D];
|
||||
ExileClientConstructionObject setVectorDirAndUp _newDirAndUp;
|
||||
_handled = true;
|
||||
};
|
||||
case 16: {
|
||||
_adjust = 1;
|
||||
if(_shift)then{_adjust = 3;};
|
||||
if(_ctrl)then{_adjust = 0.5;};
|
||||
if(_alt)then{ _adjust = 0.25;};
|
||||
BuildVecYaw = BuildVecYaw - _adjust;
|
||||
_newDirAndUp = [[ sin BuildVecYaw * cos BuildVecPitch,cos BuildVecYaw * cos BuildVecPitch,sin BuildVecPitch], [[ sin BuildVecRoll,-sin BuildVecPitch,cos BuildVecRoll * cos BuildVecPitch],-BuildVecYaw] call BIS_fnc_rotateVector2D];
|
||||
ExileClientConstructionObject setVectorDirAndUp _newDirAndUp;
|
||||
_handled = true;
|
||||
};
|
||||
case 18: {
|
||||
_adjust = 1;
|
||||
if(_shift)then{_adjust = 3;};
|
||||
if(_ctrl)then{_adjust = 0.5;};
|
||||
if(_alt)then{ _adjust = 0.25;};
|
||||
BuildVecYaw = BuildVecYaw + _adjust;
|
||||
_newDirAndUp = [[ sin BuildVecYaw * cos BuildVecPitch,cos BuildVecYaw * cos BuildVecPitch,sin BuildVecPitch], [[ sin BuildVecRoll,-sin BuildVecPitch,cos BuildVecRoll * cos BuildVecPitch],-BuildVecYaw] call BIS_fnc_rotateVector2D];
|
||||
ExileClientConstructionObject setVectorDirAndUp _newDirAndUp;
|
||||
_handled = true;
|
||||
};
|
||||
case 72: {
|
||||
_adjust = 0.5;
|
||||
if(_shift)then{_adjust = 1.5;};
|
||||
if(_ctrl)then{_adjust = 0.1;};
|
||||
if(_alt)then{ _adjust = 0.01;};
|
||||
BuildPosY = BuildPosY + _adjust;
|
||||
ExileClientConstructionOffset = [BuildPosX,BuildPosY,BuildPosZ];
|
||||
_newDirAndUp = [[ sin BuildVecYaw * cos BuildVecPitch,cos BuildVecYaw * cos BuildVecPitch,sin BuildVecPitch], [[ sin BuildVecRoll,-sin BuildVecPitch,cos BuildVecRoll * cos BuildVecPitch],-BuildVecYaw] call BIS_fnc_rotateVector2D];
|
||||
ExileClientConstructionObject setVectorDirAndUp _newDirAndUp;
|
||||
_handled = true;
|
||||
};
|
||||
case 80: {
|
||||
_adjust = 0.5;
|
||||
if(_shift)then{_adjust = 1.5;};
|
||||
if(_ctrl)then{_adjust = 0.1;};
|
||||
if(_alt)then{ _adjust = 0.01;};
|
||||
BuildPosY = BuildPosY - _adjust;
|
||||
ExileClientConstructionOffset = [BuildPosX,BuildPosY,BuildPosZ];
|
||||
_newDirAndUp = [[ sin BuildVecYaw * cos BuildVecPitch,cos BuildVecYaw * cos BuildVecPitch,sin BuildVecPitch], [[ sin BuildVecRoll,-sin BuildVecPitch,cos BuildVecRoll * cos BuildVecPitch],-BuildVecYaw] call BIS_fnc_rotateVector2D];
|
||||
ExileClientConstructionObject setVectorDirAndUp _newDirAndUp;
|
||||
_handled = true;
|
||||
};
|
||||
case 75: {
|
||||
_adjust = 0.5;
|
||||
if(_shift)then{_adjust = 1.5;};
|
||||
if(_ctrl)then{_adjust = 0.1;};
|
||||
if(_alt)then{ _adjust = 0.01;};
|
||||
BuildPosX = BuildPosX - _adjust;
|
||||
ExileClientConstructionOffset = [BuildPosX,BuildPosY,BuildPosZ];
|
||||
_newDirAndUp = [[ sin BuildVecYaw * cos BuildVecPitch,cos BuildVecYaw * cos BuildVecPitch,sin BuildVecPitch], [[ sin BuildVecRoll,-sin BuildVecPitch,cos BuildVecRoll * cos BuildVecPitch],-BuildVecYaw] call BIS_fnc_rotateVector2D];
|
||||
ExileClientConstructionObject setVectorDirAndUp _newDirAndUp;
|
||||
_handled = true;
|
||||
};
|
||||
case 77: {
|
||||
_adjust = 0.5;
|
||||
if(_shift)then{_adjust = 1.5;};
|
||||
if(_ctrl)then{_adjust = 0.1;};
|
||||
if(_alt)then{ _adjust = 0.01;};
|
||||
BuildPosX = BuildPosX + _adjust;
|
||||
ExileClientConstructionOffset = [BuildPosX,BuildPosY,BuildPosZ];
|
||||
_newDirAndUp = [[ sin BuildVecYaw * cos BuildVecPitch,cos BuildVecYaw * cos BuildVecPitch,sin BuildVecPitch], [[ sin BuildVecRoll,-sin BuildVecPitch,cos BuildVecRoll * cos BuildVecPitch],-BuildVecYaw] call BIS_fnc_rotateVector2D];
|
||||
ExileClientConstructionObject setVectorDirAndUp _newDirAndUp;
|
||||
_handled = true;
|
||||
};
|
||||
case 76: {
|
||||
BuildPosX = 0;BuildPosY = 5;BuildPosZ = 0;BuildVecYaw = 0;BuildVecPitch = 0;BuildVecRoll = 0;
|
||||
ExileClientConstructionOffset = [BuildPosX,BuildPosY,BuildPosZ];
|
||||
_newDirAndUp = [[ sin BuildVecYaw * cos BuildVecPitch,cos BuildVecYaw * cos BuildVecPitch,sin BuildVecPitch], [[ sin BuildVecRoll,-sin BuildVecPitch,cos BuildVecRoll * cos BuildVecPitch],-BuildVecYaw] call BIS_fnc_rotateVector2D];
|
||||
ExileClientConstructionObject setVectorDirAndUp _newDirAndUp;
|
||||
_handled = true;
|
||||
};
|
||||
case 14: {
|
||||
BuildPosX = 0;BuildPosY = 5;BuildPosZ = 0;BuildVecYaw = 0;BuildVecPitch = 0;BuildVecRoll = 0;
|
||||
ExileClientConstructionOffset = [BuildPosX,BuildPosY,BuildPosZ];
|
||||
_newDirAndUp = [[ sin BuildVecYaw * cos BuildVecPitch,cos BuildVecYaw * cos BuildVecPitch,sin BuildVecPitch], [[ sin BuildVecRoll,-sin BuildVecPitch,cos BuildVecRoll * cos BuildVecPitch],-BuildVecYaw] call BIS_fnc_rotateVector2D];
|
||||
ExileClientConstructionObject setVectorDirAndUp _newDirAndUp;
|
||||
_handled = true;
|
||||
};
|
||||
case 208: {
|
||||
_adjust = 0.5;
|
||||
if(_shift)then{_adjust = 1.5;};
|
||||
if(_ctrl)then{_adjust = 0.1;};
|
||||
if(_alt)then{ _adjust = 0.01;};
|
||||
BuildVecPitch = BuildVecPitch + _adjust;BuildVecYaw = BuildVecYaw;BuildVecRoll = BuildVecRoll;
|
||||
_newDirAndUp = [[ sin BuildVecYaw * cos BuildVecPitch,cos BuildVecYaw * cos BuildVecPitch,sin BuildVecPitch], [[ sin BuildVecRoll,-sin BuildVecPitch,cos BuildVecRoll * cos BuildVecPitch],-BuildVecYaw] call BIS_fnc_rotateVector2D];
|
||||
ExileClientConstructionObject setVectorDirAndUp _newDirAndUp;
|
||||
_handled = true;
|
||||
};
|
||||
case 200: {
|
||||
_adjust = 0.5;
|
||||
if(_shift)then{_adjust = 1.5;};
|
||||
if(_ctrl)then{_adjust = 0.1;};
|
||||
if(_alt)then{ _adjust = 0.01;};
|
||||
BuildVecPitch = BuildVecPitch - _adjust;BuildVecYaw = BuildVecYaw;BuildVecRoll = BuildVecRoll;
|
||||
_newDirAndUp = [[ sin BuildVecYaw * cos BuildVecPitch,cos BuildVecYaw * cos BuildVecPitch,sin BuildVecPitch], [[ sin BuildVecRoll,-sin BuildVecPitch,cos BuildVecRoll * cos BuildVecPitch],-BuildVecYaw] call BIS_fnc_rotateVector2D];
|
||||
ExileClientConstructionObject setVectorDirAndUp _newDirAndUp;
|
||||
_handled = true;
|
||||
};
|
||||
case 203: {
|
||||
_adjust = 0.5;
|
||||
if(_shift)then{_adjust = 1.5;};
|
||||
if(_ctrl)then{_adjust = 0.1;};
|
||||
if(_alt)then{ _adjust = 0.01;};
|
||||
BuildVecRoll = BuildVecRoll - _adjust;
|
||||
_newDirAndUp = [[ sin BuildVecYaw * cos BuildVecPitch,cos BuildVecYaw * cos BuildVecPitch,sin BuildVecPitch], [[ sin BuildVecRoll,-sin BuildVecPitch,cos BuildVecRoll * cos BuildVecPitch],-BuildVecYaw] call BIS_fnc_rotateVector2D];
|
||||
ExileClientConstructionObject setVectorDirAndUp _newDirAndUp;
|
||||
_handled = true;
|
||||
};
|
||||
case 205: {
|
||||
_adjust = 0.5;
|
||||
if(_shift)then{_adjust = 1.5;};
|
||||
if(_ctrl)then{_adjust = 0.1;};
|
||||
if(_alt)then{ _adjust = 0.01;};
|
||||
BuildVecRoll = BuildVecRoll + _adjust;
|
||||
_newDirAndUp = [[ sin BuildVecYaw * cos BuildVecPitch,cos BuildVecYaw * cos BuildVecPitch,sin BuildVecPitch], [[ sin BuildVecRoll,-sin BuildVecPitch,cos BuildVecRoll * cos BuildVecPitch],-BuildVecYaw] call BIS_fnc_rotateVector2D];
|
||||
ExileClientConstructionObject setVectorDirAndUp _newDirAndUp;
|
||||
_handled = true;
|
||||
};
|
||||
};
|
||||
_handled;
|
||||
}];
|
3
eXile.MAPNAME/initPlayerLocal.sqf
Normal file
3
eXile.MAPNAME/initPlayerLocal.sqf
Normal file
@ -0,0 +1,3 @@
|
||||
if (!hasInterface || isServer) exitWith {};
|
||||
|
||||
missionNamespace setVariable ["freeVectorBuilding",(compileFinal preprocessFile "eXpochVectorBldg\eXpochClient_FREE_vectorbuilding.sqf")];
|
Reference in New Issue
Block a user