-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
18 changed files
with
247 additions
and
74 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
41 changes: 41 additions & 0 deletions
41
Client Side/Framework/Functions/Placeables/CfgPlaceables.hpp
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
class CfgPlaceables { | ||
maxPlaceables = 20; | ||
|
||
class Objects { | ||
class SpikeStrip { | ||
displayName = "Stinger"; | ||
className = "Land_Razorwire_F"; | ||
positioning[] = { { 0, 5.5, 0 }, 90 }; | ||
placementTime = 2; | ||
onPlaced = "(_this select 0) setDamage 1; _this remoteExecCall [""ULP_SRV_fnc_registerStinger"", 2];"; | ||
}; | ||
|
||
class RoadCone { | ||
displayName = "Road Cone"; | ||
className = "RoadCone_F"; | ||
positioning[] = { { 0, 3, 0.5 }, 0 }; | ||
placementTime = 2; | ||
onPlaced = ""; | ||
}; | ||
|
||
class RoadConeWithLight : RoadCone { | ||
displayName = "Road Cone With Light"; | ||
className = "RoadCone_L_F"; | ||
}; | ||
|
||
class SinglePortableLight : RoadCone { | ||
displayName = "Portable Light (Single)"; | ||
className = "Land_PortableLight_single_F"; | ||
}; | ||
|
||
class DoublePortableLight : RoadCone { | ||
displayName = "Portable Light (Double)"; | ||
className = "Land_PortableLight_double_F"; | ||
}; | ||
|
||
class TapeSign : RoadCone { | ||
displayName = "Red-White Tape"; | ||
className = "TapeSign_F"; | ||
}; | ||
}; | ||
}; |
10 changes: 10 additions & 0 deletions
10
Client Side/Framework/Functions/Placeables/fn_isPlaceable.sqf
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
/* | ||
** Author: Jack "Scarso" Farhall | ||
** Description: Returns count of all objects placed by a certain player | ||
*/ | ||
#include "..\..\script_macros.hpp" | ||
scopeName "fn_isPlaceable"; | ||
|
||
private _object = _this param [0, objNull, [objNull]]; | ||
|
||
!(isNull _object && { isNil { _object getVariable "object_owner" } }) |
91 changes: 91 additions & 0 deletions
91
Client Side/Framework/Functions/Placeables/fn_placeObject.sqf
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,91 @@ | ||
/* | ||
** Author: Jack "Scarso" Farhall | ||
** Description: | ||
*/ | ||
#include "..\..\script_macros.hpp" | ||
scopeName "fn_placeObject"; | ||
|
||
if (canSuspend) exitWith { _this call ULP_fnc_placeObject; }; | ||
|
||
_this params [ | ||
["_placeable", "", [""]], | ||
["_item", "", [""]] | ||
]; | ||
|
||
private _cfg = missionConfigFile >> "CfgPlaceables" >> "Objects" >> _placeable; | ||
if !(isClass _cfg) exitWith { false }; | ||
|
||
if !(isNull (objectParent player)) exitWith { | ||
["You must be outside of a vehicle..."] call ULP_fnc_hint; | ||
false | ||
}; | ||
|
||
if !(isNull (missionNamespace getVariable ["ULP_PlaceableObject", objNull])) exitWith { | ||
["You must place your current object before you can place another..."] call ULP_fnc_hint; | ||
false | ||
}; | ||
|
||
private _maxPlaceables = getNumber (missionConfigFile >> "CfgPlaceables" >> "maxPlaceables"); | ||
if (([] call ULP_fnc_placedObjects) >= _maxPlaceables) exitWith { | ||
[format ["You've got %1 objects still active, please delete some to place more...", _maxPlaceables]] call ULP_fnc_hint; | ||
false | ||
}; | ||
|
||
// Ensure no ui is open for this step | ||
[] spawn ULP_UI_fnc_closeDialogs; | ||
|
||
[{ !dialog }, [_cfg, _item], { | ||
_this params [ "_cfg", "_item" ]; | ||
|
||
private _className = getText(_cfg >> "className"); | ||
private _positioning = getArray(_cfg >> "positioning") params [ | ||
"_attachPoint", "_rot" | ||
]; | ||
|
||
private _object = createVehicle [_className, [0, 0, 0]]; | ||
_object attachTo [player, _attachPoint]; | ||
_object setDir _rot; | ||
_object setVariable ["object_owner", [getPlayerUID player, profileName], true]; | ||
|
||
ULP_PlaceableObject = _object; | ||
|
||
ULP_PlaceableObjectAction = player addAction [format ["Place %1", getText(_cfg >> "displayName")], { | ||
_this params ["", "", "_actionId", "_params"]; | ||
_params params [ "_cfg", "_item" ]; | ||
|
||
private _object = missionNamespace getVariable ["ULP_PlaceableObject", objNull]; | ||
player removeAction _actionId; | ||
|
||
if (isNull _object) exitWith { | ||
["An error occured while attempting to place this object..."] call ULP_fnc_hint; | ||
}; | ||
|
||
[format ["Placing %1", getText(_cfg >> "displayName")], getNumber(_cfg >> "placementTime"), | ||
[_object, _item, _cfg], { !(isNull (_this select 0)) && { ([(_this select 1)] call ULP_fnc_hasItem) > 0 } }, { | ||
_this params [ "_object", "_item", "_cfg" ]; | ||
|
||
if (isNull _object) exitWith {}; | ||
|
||
if !([_item, 1, true] call ULP_fnc_handleItem) exitWith { | ||
deleteVehicle _object; | ||
}; | ||
|
||
detach _object; | ||
|
||
private _pos = getPosATL _object; | ||
_pos set[2, 0]; | ||
|
||
_object setPosATL _pos; | ||
_object setVectorUp surfaceNormal _pos; | ||
|
||
[_object] call compile getText(_cfg >> "onPlaced"); | ||
|
||
[format["You have placed a %1...", getText(_cfg >> "displayName")]] call ULP_fnc_hint; | ||
[false] call ULP_fnc_stopPlacement; | ||
}, { | ||
[] call ULP_fnc_stopPlacement; | ||
}, ["GRAB", "CROUCH"]] call ULP_UI_fnc_startProgress; | ||
}, [_cfg, _item], 10, false, false, "", "!(isNull (missionNamespace getVariable [""ULP_PlaceableObject"", objNull]))"]; | ||
}] call ULP_fnc_waitUntilExecute; | ||
|
||
true |
15 changes: 15 additions & 0 deletions
15
Client Side/Framework/Functions/Placeables/fn_placedObjects.sqf
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
/* | ||
** Author: Jack "Scarso" Farhall | ||
** Description: Returns count of all objects placed by a certain player | ||
*/ | ||
#include "..\..\script_macros.hpp" | ||
scopeName "fn_placedObjects"; | ||
|
||
_this params [ | ||
["_steamId", getPlayerUID player, [""]] | ||
]; | ||
|
||
if (_steamId isEqualTo "") exitWith { 0 }; | ||
|
||
// Semi-Intensive - Will be a good idea to look into alternatives but only runs once when initially placing an objects so not high prio | ||
count (vehicles select { ((_x getVariable ["object_owner", [""]]) param [0, "", [""]]) isEqualTo _steamId }) |
19 changes: 19 additions & 0 deletions
19
Client Side/Framework/Functions/Placeables/fn_removeObject.sqf
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
/* | ||
** Author: Jack "Scarso" Farhall | ||
** Description: | ||
*/ | ||
#include "..\..\script_macros.hpp" | ||
scopeName "fn_removeObject"; | ||
|
||
if (canSuspend) exitWith { | ||
[ULP_fnc_removeObject, _this] call ULP_fnc_directCall; | ||
}; | ||
|
||
_this params [ | ||
["_object", objNull, [objNull]] | ||
]; | ||
|
||
if !([_object] call ULP_fnc_isPlaceable) exitWith { false }; | ||
|
||
deleteVehicle _object; | ||
true |
Oops, something went wrong.