Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Spikestrip rework #647

Open
wants to merge 16 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 6 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
787 changes: 394 additions & 393 deletions Altis_Life.Altis/Functions.hpp

Large diffs are not rendered by default.

491 changes: 247 additions & 244 deletions Altis_Life.Altis/config/Config_Master.hpp

Large diffs are not rendered by default.

28 changes: 28 additions & 0 deletions Altis_Life.Altis/core/actions/fn_deploySpikes.sqf
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
/*
File: fn_deploySpikes.sqf
Author: DomT602

Description:
Deploys a spike strip
*/

if (isNull life_spikeStrip) exitWith {};
private _spikeStrip = life_spikeStrip;
life_spikeStrip = objNull;

detach _spikeStrip;
private _pos = getPosASL _spikeStrip;
private _intersects = lineIntersectsSurfaces [_pos,_pos vectorAdd [0,0,-50],_spikeStrip,objNull,true,1,"GEOM","NONE"];
_intersects params ["_firstObjectData"];
_firstObjectData params ["_posASL","_surfaceNormal"];
_spikeStrip setPosASL _posASL;
_spikeStrip setVectorUp _surfaceNormal;

player removeAction life_action_spikeStripDeploy;
life_action_spikeStripDeploy = nil;

if (life_HC_isActive) then {
[_spikeStrip] remoteExec ["HC_fnc_spikeStrip",HC_Life]; //Send it to the HeadlessClient for monitoring.
} else {
[_spikeStrip] remoteExec ["TON_fnc_spikeStrip",RSERV]; //Send it to the server for monitoring.
};
33 changes: 16 additions & 17 deletions Altis_Life.Altis/core/actions/fn_packupSpikes.sqf
Original file line number Diff line number Diff line change
@@ -1,17 +1,16 @@
/*
File: fn_packupSpikes.sqf
Author: Bryan "Tonic" Boardwine

Description:
Packs up a deployed spike strip.
*/
private ["_spikes"];
_spikes = nearestObjects[getPos player,["Land_Razorwire_F"],8] select 0;
if (isNil "_spikes") exitWith {};

if ([true,"spikeStrip",1] call life_fnc_handleInv) then {
titleText[localize "STR_NOTF_SpikeStrip","PLAIN"];
player removeAction life_action_spikeStripPickup;
life_action_spikeStripPickup = nil;
deleteVehicle _spikes;
};
/*
File: fn_packupSpikes.sqf
Author: Bryan "Tonic" Boardwine

Description:
Packs up a deployed spike strip.
*/
(nearestObjects[getPosATL player,["Land_Razorwire_F"],8]) params [["_spikes", objNull]];
if (isNull _spikes) exitWith {};

if ([true,"spikeStrip",1] call life_fnc_handleInv) then {
private _index = life_spikesDeployed findIf {_x select 0 isEqualTo _spikes};
life_spikesDeployed deleteAt _index; //remove spikes from spike array
titleText[localize "STR_NOTF_SpikeStrip","PLAIN"];
deleteVehicle _spikes;
};
205 changes: 103 additions & 102 deletions Altis_Life.Altis/core/configuration.sqf
Original file line number Diff line number Diff line change
@@ -1,102 +1,103 @@
#include "..\script_macros.hpp"
/*
File: configuration.sqf
Author:

Description:
Master Life Configuration File
This file is to setup variables for the client, there are still other configuration files in the system

*****************************
****** Backend Variables *****
*****************************
*/
life_action_delay = time;
life_trunk_vehicle = objNull;
life_session_completed = false;
life_garage_store = false;
life_session_tries = 0;
life_siren_active = false;
life_clothing_filter = 0;
life_redgull_effect = time;
life_is_processing = false;
life_bail_paid = false;
life_impound_inuse = false;
life_action_inUse = false;
life_spikestrip = objNull;
life_knockout = false;
life_interrupted = false;
life_respawned = false;
life_removeWanted = false;
life_action_gathering = false;
life_god = false;
life_frozen = false;
life_save_gear = [];
life_container_activeObj = objNull;
life_disable_getIn = false;
life_disable_getOut = false;
life_admin_debug = false;
life_civ_position = [];
life_markers = false;
life_markers_active = false;
life_canpay_bail = true;
life_storagePlacing = scriptNull;
life_hideoutBuildings = [];
life_firstSpawn = true;

//Settings
life_settings_enableNewsBroadcast = profileNamespace getVariable ["life_enableNewsBroadcast", true];
life_settings_enableSidechannel = profileNamespace getVariable ["life_enableSidechannel", true];
life_settings_viewDistanceFoot = profileNamespace getVariable ["life_viewDistanceFoot", 1250];
life_settings_viewDistanceCar = profileNamespace getVariable ["life_viewDistanceCar", 1250];
life_settings_viewDistanceAir = profileNamespace getVariable ["life_viewDistanceAir", 1250];

//Uniform price (0),Hat Price (1),Glasses Price (2),Vest Price (3),Backpack Price (4)
life_clothing_purchase = [-1, -1, -1, -1, -1];
/*
*****************************
****** Weight Variables *****
*****************************
*/
life_maxWeight = LIFE_SETTINGS(getNumber, "total_maxWeight");
life_carryWeight = 0; //Represents the players current inventory weight (MUST START AT 0).

/*
*****************************
****** Life Variables *******
*****************************
*/
life_net_dropped = false;
life_use_atm = true;
life_is_arrested = false;
life_is_alive = false;
life_delivery_in_progress = false;
life_thirst = 100;
life_hunger = 100;
CASH = 0;

life_istazed = false;
life_isknocked = false;
life_vehicles = [];

/*
Master Array of items?
*/
//Setup variable inv vars.
{
missionNamespace setVariable [ITEM_VARNAME(configName _x), 0];
} forEach ("true" configClasses (missionConfigFile >> "VirtualItems"));

/* Setup the BLAH! */
{
_varName = getText(_x >> "variable");
_sideFlag = getText(_x >> "side");

missionNamespace setVariable [LICENSE_VARNAME(_varName,_sideFlag), false];
} forEach ("true" configClasses (missionConfigFile >> "Licenses"));

/* Setup life_hideoutBuildings */
{
_building = nearestBuilding getMarkerPos _x;
life_hideoutBuildings pushBack _building
} forEach (LIFE_SETTINGS(getArray,"gang_area"));
#include "..\script_macros.hpp"
/*
File: configuration.sqf
Author:

Description:
Master Life Configuration File
This file is to setup variables for the client, there are still other configuration files in the system

*****************************
****** Backend Variables *****
*****************************
*/
life_action_delay = time;
life_trunk_vehicle = objNull;
life_session_completed = false;
life_garage_store = false;
life_session_tries = 0;
life_siren_active = false;
life_clothing_filter = 0;
life_redgull_effect = time;
life_is_processing = false;
life_bail_paid = false;
life_impound_inuse = false;
life_action_inUse = false;
life_spikestrip = objNull;
life_spikesDeployed = [];
life_knockout = false;
life_interrupted = false;
life_respawned = false;
life_removeWanted = false;
life_action_gathering = false;
life_god = false;
life_frozen = false;
life_save_gear = [];
life_container_activeObj = objNull;
life_disable_getIn = false;
life_disable_getOut = false;
life_admin_debug = false;
life_civ_position = [];
life_markers = false;
life_markers_active = false;
life_canpay_bail = true;
life_storagePlacing = scriptNull;
life_hideoutBuildings = [];
life_firstSpawn = true;

//Settings
life_settings_enableNewsBroadcast = profileNamespace getVariable ["life_enableNewsBroadcast", true];
life_settings_enableSidechannel = profileNamespace getVariable ["life_enableSidechannel", true];
life_settings_viewDistanceFoot = profileNamespace getVariable ["life_viewDistanceFoot", 1250];
life_settings_viewDistanceCar = profileNamespace getVariable ["life_viewDistanceCar", 1250];
life_settings_viewDistanceAir = profileNamespace getVariable ["life_viewDistanceAir", 1250];

//Uniform price (0),Hat Price (1),Glasses Price (2),Vest Price (3),Backpack Price (4)
life_clothing_purchase = [-1, -1, -1, -1, -1];
/*
*****************************
****** Weight Variables *****
*****************************
*/
life_maxWeight = LIFE_SETTINGS(getNumber, "total_maxWeight");
life_carryWeight = 0; //Represents the players current inventory weight (MUST START AT 0).

/*
*****************************
****** Life Variables *******
*****************************
*/
life_net_dropped = false;
life_use_atm = true;
life_is_arrested = false;
life_is_alive = false;
life_delivery_in_progress = false;
life_thirst = 100;
life_hunger = 100;
CASH = 0;

life_istazed = false;
life_isknocked = false;
life_vehicles = [];

/*
Master Array of items?
*/
//Setup variable inv vars.
{
missionNamespace setVariable [ITEM_VARNAME(configName _x), 0];
} forEach ("true" configClasses (missionConfigFile >> "VirtualItems"));

/* Setup the BLAH! */
{
_varName = getText(_x >> "variable");
_sideFlag = getText(_x >> "side");

missionNamespace setVariable [LICENSE_VARNAME(_varName,_sideFlag), false];
} forEach ("true" configClasses (missionConfigFile >> "Licenses"));

/* Setup life_hideoutBuildings */
{
_building = nearestBuilding getMarkerPos _x;
life_hideoutBuildings pushBack _building
} forEach (LIFE_SETTINGS(getArray,"gang_area"));
65 changes: 35 additions & 30 deletions Altis_Life.Altis/core/fn_setupActions.sqf
Original file line number Diff line number Diff line change
@@ -1,30 +1,35 @@
/*
File: fn_setupActions.sqf
Author:

Description:
Master addAction file handler for all client-based actions.
*/

life_actions = [];

switch (playerSide) do {

//Civilian
case civilian: {
//Drop fishing net
life_actions pushBack (player addAction[localize "STR_pAct_DropFishingNet",life_fnc_dropFishingNet,"",0,false,false,"",'
(surfaceisWater (getPos vehicle player)) && (vehicle player isKindOf "Ship") && life_carryWeight < life_maxWeight && speed (vehicle player) < 2 && speed (vehicle player) > -1 && !life_net_dropped ']);

//Rob person
life_actions pushBack (player addAction[localize "STR_pAct_RobPerson",life_fnc_robAction,"",0,false,false,"",'
!isNull cursorObject && player distance cursorObject < 3.5 && isPlayer cursorObject && animationState cursorObject == "Incapacitated" && !(cursorObject getVariable ["robbed",false]) ']);
};

//Cops
case west: { };

//EMS
case independent: { };

};
/*
File: fn_setupActions.sqf
Author:

Description:
Master addAction file handler for all client-based actions.
*/

life_actions = [];

switch (playerSide) do {

//Civilian
case civilian: {
//Drop fishing net
life_actions pushBack (player addAction[localize "STR_pAct_DropFishingNet",life_fnc_dropFishingNet,"",0,false,false,"",'
(surfaceisWater (getPos vehicle player)) && (vehicle player isKindOf "Ship") && life_carryWeight < life_maxWeight && speed (vehicle player) < 2 && speed (vehicle player) > -1 && !life_net_dropped ']);

//Rob person
life_actions pushBack (player addAction[localize "STR_pAct_RobPerson",life_fnc_robAction,"",0,false,false,"",'
!isNull cursorObject && player distance cursorObject < 3.5 && isPlayer cursorObject && animationState cursorObject == "Incapacitated" && !(cursorObject getVariable ["robbed",false]) ']);
};

//Cops
case west: {
//Pickup spikes
life_actions pushBack (player addAction[localize "STR_ISTR_Spike_Pack",life_fnc_packupSpikes,"",0,false,false,"",
'(nearestObjects[getPosATL player,["Land_Razorwire_F"],8]) params [["_spikes",objNull]]; !isNull _spikes && !isNil {(_spikes getVariable "item")} ']);

};

//EMS
case independent: { };

};
53 changes: 20 additions & 33 deletions Altis_Life.Altis/core/items/fn_spikeStrip.sqf
Original file line number Diff line number Diff line change
@@ -1,33 +1,20 @@
#include "..\..\script_macros.hpp"
/*
File: fn_spikeStrip.sqf
Author: Bryan "Tonic" Boardwine

Description:
Creates a spike strip and preps it.
*/
private ["_spikeStrip"];
if (!isNil "life_action_spikeStripPickup") exitWith {hint localize "STR_ISTR_SpikesDeployment"}; // avoid conflicts with addactions allowing duplication.
_spikeStrip = "Land_Razorwire_F" createVehicle [0,0,0];
_spikeStrip attachTo[player,[0,5.5,0]];
_spikeStrip setDir 90;
_spikeStrip setVariable ["item","spikeDeployed",true];

life_action_spikeStripDeploy = player addAction[localize "STR_ISTR_Spike_Place",{if (!isNull life_spikestrip) then {detach life_spikeStrip; life_spikeStrip = objNull;}; player removeAction life_action_spikeStripDeploy; life_action_spikeStripDeploy = nil;},"",999,false,false,"",'!isNull life_spikestrip'];
life_spikestrip = _spikeStrip;
waitUntil {isNull life_spikeStrip};

if (!isNil "life_action_spikeStripDeploy") then {player removeAction life_action_spikeStripDeploy;};
if (isNull _spikeStrip) exitWith {life_spikestrip = objNull;};

_spikeStrip setPos [(getPos _spikeStrip select 0),(getPos _spikeStrip select 1),0];
_spikeStrip setDamage 1;

life_action_spikeStripPickup = player addAction[localize "STR_ISTR_Spike_Pack",life_fnc_packupSpikes,"",0,false,false,"",
' _spikes = nearestObjects[getPos player,["Land_Razorwire_F"],8] select 0; !isNil "_spikes" && !isNil {(_spikes getVariable "item")}'];

if (life_HC_isActive) then {
[_spikeStrip] remoteExec ["HC_fnc_spikeStrip",HC_Life]; //Send it to the HeadlessClient for monitoring.
} else {
[_spikeStrip] remoteExec ["TON_fnc_spikeStrip",RSERV]; //Send it to the server for monitoring.
};
#include "..\..\script_macros.hpp"
/*
File: fn_spikeStrip.sqf
Author: Bryan "Tonic" Boardwine

Description:
Creates a spike strip and preps it.
*/
private _maxSpikeCount = LIFE_SETTINGS(getNumber,"maximumSpikestrips");
life_spikesDeployed = life_spikesDeployed - [objNull];
if (_maxSpikeCount != -1 && {(count life_spikesDeployed) isEqualTo _maxSpikeCount}) exitWith {hint format [localize "STR_ISTR_MaxSpikesDeployed", _maxSpikeCount]}; //max spikes placed

private _spikeStrip = "Land_Razorwire_F" createVehicle [0,0,0];
_spikeStrip attachTo [player,[0,5.5,0]];
_spikeStrip setDir 90;
_spikeStrip setVariable ["item","spikeDeployed",true];
life_spikeStrip = _spikeStrip;
life_spikesDeployed pushBack _spikeStrip;

life_action_spikeStripDeploy = player addAction[localize "STR_ISTR_Spike_Place",life_fnc_deploySpikes,"",0,false,false,"",'!isNull life_spikestrip'];
Loading