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 all 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.

3 changes: 3 additions & 0 deletions Altis_Life.Altis/config/Config_Master.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -179,6 +179,9 @@ class Life_Settings {
disableCommanderView = true; //false - Group leaders can access the commander view. true [default] - Group leaders cannot access the commander view.
//Commander/tactical view is accessed via pressing . [NUM] by default. It raises the camera significantly higher and steeper above the player in order to give a boarder tactical view of the surrounding area.

maximumSpikestrips = -1; //Maximum number of spikes deployed per cop, -1 allows unlimited placement of spikestrips
minimumSpikeSpeed = 0; //Minimum speed for a spikestrip to take effect, a negative speed will allow stationary vehicles to be spiked

/* Wanted System Settings *
/* crimes[] = {String, Bounty, Code} */
crimes[] = {
Expand Down
30 changes: 30 additions & 0 deletions Altis_Life.Altis/core/actions/fn_deploySpikes.sqf
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
#include "..\..\script_macros.hpp"
/*
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;
_spikeStrip setVariable ["item","spikeDeployed",true]; //only set this once deployed to prevent others picking up

player removeAction life_action_spikeStripDeploy;
life_action_spikeStripDeploy = nil;

if (life_HC_isActive) then {
[_spikeStrip] remoteExec ["HC_fnc_spikeStrip",HC_Life];
} else {
[_spikeStrip] remoteExec ["TON_fnc_spikeStrip",RSERV];
};
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 = 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 [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 isEqualTo _spikes};
life_spikesDeployed deleteAt _index; //remove spikes from spike array
titleText [localize "STR_NOTF_SpikeStrip","PLAIN"];
deleteVehicle _spikes;
};
100 changes: 50 additions & 50 deletions Altis_Life.Altis/core/actions/fn_storeVehicle.sqf
Original file line number Diff line number Diff line change
@@ -1,50 +1,50 @@
#include "..\..\script_macros.hpp"
/*
File: fn_storeVehicle.sqf
Author: Bryan "Tonic" Boardwine
Description:
Stores the vehicle in the garage.
*/
params [
["_garage", objNull, [objNull]],
["_unit", objNull, [objNull]]
];
private _vehicle = objNull;
if !(isNull objectParent player) then {
_vehicle = vehicle player;
} else {
private _nearVehicles = nearestObjects[getPos _garage,["Car","Air","Ship"],30]; //Fetch vehicles within 30m.
if !(_nearVehicles isEqualTo []) then {
{
if (!isNull _vehicle) exitWith {}; //Kill the loop.
private _vehData = _x getVariable ["vehicle_info_owners",[]];
if (count _vehData > 0) then {
private _vehOwner = ((_vehData select 0) select 0);
if (getPlayerUID player isEqualTo _vehOwner) exitWith {
_vehicle = _x;
};
};
true
} count _nearVehicles;
};
};
if (isNull _vehicle) exitWith {
hint localize "STR_Garage_NoNPC"
};
if (!alive _vehicle) exitWith {
hint localize "STR_Garage_SQLError_Destroyed"
};
private _storetext = localize "STR_Garage_Store_Success";
if (life_HC_isActive) then {
[_vehicle,false,_unit,_storetext] remoteExec ["HC_fnc_vehicleStore",HC_Life];
} else {
[_vehicle,false,_unit,_storetext] remoteExec ["TON_fnc_vehicleStore",RSERV];
};
hint localize "STR_Garage_Store_Server";
life_garage_store = true;
#include "..\..\script_macros.hpp"
/*
File: fn_storeVehicle.sqf
Author: Bryan "Tonic" Boardwine

Description:
Stores the vehicle in the garage.
*/
params [
["_garage", objNull, [objNull]],
["_unit", objNull, [objNull]]
];

private _vehicle = objNull;
if !(isNull objectParent player) then {
_vehicle = vehicle player;
} else {
private _nearVehicles = nearestObjects[getPos _garage,["Car","Air","Ship"],30]; //Fetch vehicles within 30m.
if !(_nearVehicles isEqualTo []) then {
{
if !(isNull _vehicle) exitWith {}; //Kill the loop.
private _vehData = _x getVariable ["vehicle_info_owners",[]];
if (count _vehData > 0) then {
private _vehOwner = ((_vehData select 0) select 0);
if (getPlayerUID player isEqualTo _vehOwner) exitWith {
_vehicle = _x;
};
};
true
} count _nearVehicles;
};
};

if (isNull _vehicle) exitWith {
hint localize "STR_Garage_NoNPC"
};
if (!alive _vehicle) exitWith {
hint localize "STR_Garage_SQLError_Destroyed"
};

private _storetext = localize "STR_Garage_Store_Success";

if (life_HC_isActive) then {
[_vehicle,false,_unit,_storetext] remoteExec ["HC_fnc_vehicleStore",HC_Life];
} else {
[_vehicle,false,_unit,_storetext] remoteExec ["TON_fnc_vehicleStore",RSERV];
};

hint localize "STR_Garage_Store_Server";
life_garage_store = true;
203 changes: 102 additions & 101 deletions Altis_Life.Altis/core/configuration.sqf
Original file line number Diff line number Diff line change
@@ -1,101 +1,102 @@
#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_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_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"));
Loading