Added cse_sys_logistics source

This commit is contained in:
Thomas Kooi 2015-01-12 23:29:12 +01:00
parent f100d563e0
commit aa9320c157
20 changed files with 466 additions and 0 deletions

View File

@ -0,0 +1,14 @@
class CfgFunctions {
class CSE {
class Logistics {
file = "cse\cse_sys_logistics\functions";
class hideObjCargo_LOG { recompile = 1; };
class findVehicle_LOG { recompile = 1; };
class loadObject_LOG { recompile = 1; };
class unloadObject_LOG { recompile = 1; };
class canCarryObj_LOG { recompile = 1; };
class canDragObj_LOG { recompile = 1; };
class dragObject_LOG { recompile = 1; };
};
};
};

View File

@ -0,0 +1,35 @@
class CfgVehicles
{
class Logic;
class Module_F: Logic
{
class ArgumentsBaseUnits
{
};
};
class cse_sys_logistics: Module_F
{
scope = 2;
displayName = "Logistics [CSE]";
icon = "\cse\cse_main\data\cse_basic_module.paa";
category = "cseModules";
function = "cse_fnc_initalizeModule_F";
functionPriority = 1;
isGlobal = 1;
isTriggerActivated = 0;
class Arguments
{
};
};
/* class NATO_Box_Base;
class cse_logisticCrate : NATO_Box_Base {
scope = 2;
accuracy = 1000;
displayName = "Logistic Crate";
model = "\cse\cse_sys_logistics\data\crate\crate.p3d";
author = "Combat Space Enhancement";
};*/
};

View File

@ -0,0 +1,8 @@
class Combat_Space_Enhancement {
class cfgModules {
class cse_sys_logistics {
init = "call compile preprocessFile 'cse\cse_sys_logistics\init_sys_logistics.sqf';";
name = "Logistics Module";
};
};
};

View File

View File

@ -0,0 +1,26 @@
#define _ARMA_
class CfgPatches
{
class cse_sys_logistics
{
units[] = {};
weapons[] = {};
requiredVersion = 0.1;
requiredAddons[] = {"cse_gui","cse_main","cse_f_modules"};
version = "0.10.0_rc";
author[] = {"Combat Space Enhancement"};
authorUrl = "http://csemod.com";
};
};
class CfgAddons {
class PreloadAddons {
class cse_sys_logistics {
list[] = {"cse_sys_logistics"};
};
};
};
#include "CfgVehicles.h"
#include "CfgFunctions.h"
#include "Combat_Space_Enhancement.h"
#include "GUI.h"

Binary file not shown.

View File

@ -0,0 +1,32 @@
ambient[]={1,1,1,1};
diffuse[]={0.5,0.5,0.5,1};
forcedDiffuse[]={0.5,0.5,0.5,0};
emmisive[]={0,0,0,1};
specular[]={0.30000001,0.30000001,0.30000001,0};
specularPower=57.799999;
PixelShaderID="NormalMapSpecularDIMap";
VertexShaderID="NormalMap";
class Stage1
{
texture="cse\cse_sys_medical\equipment\crate\crate_nohq.paa";
uvSource="tex";
class uvTransform
{
aside[]={1,0,0};
up[]={0,1,0};
dir[]={0,0,1};
pos[]={0,0,0};
};
};
class Stage2
{
texture="cse\cse_sys_medical\equipment\crate\crate_smdi.paa";
uvSource="tex";
class uvTransform
{
aside[]={1,0,0};
up[]={0,1,0};
dir[]={0,0,1};
pos[]={0,0,0};
};
};

Binary file not shown.

Binary file not shown.

Binary file not shown.

View File

@ -0,0 +1,26 @@
/**
* fn_canCarryObj_LOG.sqf
* @Descr:
* @Author: Glowbal
*
* @Arguments: []
* @Return:
* @PublicAPI: true
*/
#define MIN_DISTANCE 4
private ["_caller", "_object", "_log"];
_caller = _this select 0;
_object = _this select 1;
if (!(isNull ([_caller] call cse_fnc_getCarriedObj)) || !((_object distance _caller) < MIN_DISTANCE)) exitwith {
false;
};
_log = (_object getvariable "CSE_Logistics_Enable");
if !(isnil "_log") exitwith {
(_object getVariable ["CSE_Logistics_Enable", false])
};
false;

View File

@ -0,0 +1,26 @@
/**
* fn_canDragObj_LOG.sqf
* @Descr:
* @Author: Glowbal
*
* @Arguments: []
* @Return:
* @PublicAPI: true
*/
#define MIN_DISTANCE 4
private ["_caller", "_object", "_check"];
_caller = _this select 0;
_object = _this select 1;
if (!(isNull ([_caller] call cse_fnc_getCarriedObj)) || !((_object distance _caller) < MIN_DISTANCE)) exitwith {
false;
};
_check = _object getvariable "CSE_Logistics_Enable_drag";
if !(isnil "_check") exitwith {
_check;
};
((_object iskindof "StaticWeapon") || ((_object iskindof "ReammoBox") || (_object iskindof "ReammoBox_F")));

View File

@ -0,0 +1,27 @@
/**
* fn_dragObject_LOG.sqf
* @Descr: N/A
* @Author: Glowbal
*
* @Arguments: []
* @Return:
* @PublicAPI: false
*/
#define DISTANCE_OBJECT 1.3
private ["_caller", "_object", "_attachToPos"];
_caller = _this select 0;
_object = _this select 1;
_attachToPos = [0, DISTANCE_OBJECT, (_caller worldToModel (_object modelToWorld [0,0,0])) select 2];
if ([_caller, _object, _attachToPos, false] call cse_fnc_carryObj) then {
closeDialog 0;
[player, "STR_CSE_LOG_DRAG_OBJECT","STR_CSE_LOG_START_DRAGGING"] call cse_fnc_sendDisplayMessageTo;
if (currentWeapon _caller == primaryWeapon _caller) then {
[_caller, "AcinPknlMstpSrasWrflDnon", true] call cse_fnc_localAnim;
} else {
[_caller, "AcinPknlMstpSnonWnonDnon", true] call cse_fnc_localAnim;
};
};

View File

@ -0,0 +1,33 @@
/**
* fn_findVehicle_LOG.sqf
* @Descr: N/A
* @Author: Glowbal
*
* @Arguments: []
* @Return:
* @PublicAPI: false
*/
private ["_unit","_loadcar","_loadhelicopter", "_loadtank", "_vehicle"];
_unit = _this select 0;
_loadcar = nearestObject [_unit, "car"];
_loadhelicopter = nearestObject [_unit, "air"];
_loadtank = nearestObject [_unit, "tank"];
_vehicle = ObjNull;
if (_unit distance _loadcar <= 10) then {
_vehicle = _loadcar;
} else {
if (_unit distance _loadhelicopter <= 10) then
{
_vehicle = _loadhelicopter;
} else {
if (_unit distance _loadtank <= 10) then
{
_vehicle = _loadtank;
} else {
};
};
};
_vehicle

View File

@ -0,0 +1,22 @@
/**
* fn_hideObjCargo_LOG.sqf
* @Descr: N/A
* @Author: Glowbal
*
* @Arguments: []
* @Return:
* @PublicAPI: false
*/
private ["_obj","_veh"];
_obj = _this select 0;
_veh = _this select 1;
_hide = _this select 2;
if (_hide) then {
_obj enableSimulation false;
_obj hideObject true;
} else {
_obj enableSimulation true;
_obj hideObject false;
};

View File

@ -0,0 +1,36 @@
/**
* fn_loadObject_LOG.sqf
* @Descr: N/A
* @Author: Glowbal
*
* @Arguments: []
* @Return:
* @PublicAPI: false
*/
private ["_obj","_veh","_loaded","_numberLoaded"];
_obj = _this select 0;
_veh = _this select 1;
if (isNull _veh) exitwith {
hintSilent "Cannot load object in vehicle";
false;
};
if (speed _veh > 1) exitwith {false};
if (((getPos _veh) select 2) > 3) exitwith {false};
_loaded = _veh getvariable ["cse_logistics_loadedCargo_LOG",[]];
_numberLoaded = count _loaded;
if (_numberLoaded > 5) exitwith {
// we need to properly implement a check for amount of cargo in vehicle
hintSilent "This vehicle is full!";
false;
};
_loaded set[ _numberLoaded, _obj];
_veh setvariable ["cse_logistics_loadedCargo_LOG",_loaded,true];
detach _obj;
_obj attachTo [_veh,[0,0,100]];
[[_obj, _veh, true], "cse_fnc_hideObjCargo_LOG", true, false] spawn BIS_fnc_MP;
[[_obj, _veh], "logistics_ObjectLoaded"] call cse_fnc_customEventHandler_F;
true;

View File

@ -0,0 +1,48 @@
/**
* fn_unloadObject_LOG.sqf
* @Descr: N/A
* @Author: Glowbal
*
* @Arguments: []
* @Return:
* @PublicAPI: false
*/
private ["_obj","_veh","_loaded","_numberLoaded","_position","_mTw"];
_obj = _this select 0;
_veh = _this select 1;
if (speed _veh > 5) exitwith {
hintSilent "Vehicle is moving to fast";
};
if (((getPos _veh) select 2) > 5) exitwith {
hintSilent "Vehicle is to high";
};
_position = position _veh findEmptyPosition [0, 50, typeOf _obj];
if (count _position < 1) exitwith {
hintSilent "No empty space available - cannot unload cargo!";
};
_loaded = _veh getvariable ["cse_logistics_loadedCargo_LOG",[]];
_numberLoaded = count _loaded;
_loaded = _loaded - [_obj];
_veh setvariable ["cse_logistics_loadedCargo_LOG",_loaded,true];
detach _obj;
_obj setPos _position;
//_obj setPos [((getPos _veh) select 0), ((getPos _veh) select 1), (getPos _veh ) select 2];
[[_obj, _veh, false], "cse_fnc_hideObjCargo_LOG", true, false] spawn BIS_fnc_MP;
if ([player, _obj] call cse_fnc_canCarryObj_LOG) then {
if ([player,_obj,[0,1.5,1],false] call cse_fnc_carryObj) then {
hint format["Object unloaded / moving"];
};
} else {
if ([player, _obj] call cse_fnc_canDragObj_LOG) then {
[player, _obj] call cse_fnc_dragObject_LOG;
};
};
[[_obj, _veh], "logistics_ObjectUnloaded"] call cse_fnc_customEventHandler_F;

View File

@ -0,0 +1,49 @@
/*
NAME: init
USAGE: CSE SYS Logistics init file
AUTHOR: Glowbal
RETURN: void
*/
waituntil{!isnil "cse_gui"};
[format["LOG - Logistics Module initialised"],2] call cse_fnc_debug;
_entries = [
[localize "STR_CSE_LOG_CARRY", cse_fnc_canCarryObj_LOG, CSE_ICON_PATH + "icon_movement.paa",
{
if ([_this select 0,_this select 1,[0,1.5,1],false] call cse_fnc_carryObj) then {
closeDialog 0;
[player, "STR_CSE_LOG_MOVE_OBJECT","STR_CSE_LOG_OBJECT_PICKED_UP"] call cse_fnc_sendDisplayMessageTo;
[player, 10] call cse_fnc_limitSpeed;
};
}, localize "STR_CSE_LOG_CARRY_OBJECT"],
[localize "STR_CSE_LOG_DRAG", cse_fnc_canDragObj_LOG, CSE_ICON_PATH + "icon_movement.paa", cse_fnc_dragObject_LOG, localize "STR_CSE_LOG_DRAG_OBJECT"],
[localize "STR_CSE_LOG_DROP",{(!isNull ([(_this select 0)] call cse_fnc_getCarriedObj)) && !(([(_this select 0)] call cse_fnc_getCarriedObj) isKindOf "CaManBase")}, CSE_ICON_PATH + "icon_placedown.paa",
{
([_this select 0,ObjNull,[0,1,1]] call cse_fnc_carryObj);
[player, "STR_CSE_LOG_DROPPED_OBJECT","STR_CSE_LOG_PLACED_DOWN_OBJECT"] call cse_fnc_sendDisplayMessageTo;
closeDialog 0;
player switchMove "";
[player, -1] call cse_fnc_limitSpeed;
},localize "STR_CSE_LOG_DROP_OBJECT"],
[localize "STR_CSE_LOG_LOAD",{(!isNull ([(_this select 0)] call cse_fnc_getCarriedObj)) && !(([(_this select 0)] call cse_fnc_getCarriedObj) isKindOf "CaManBase")}, CSE_ICON_PATH + "icon_place_in.paa",
{
([_this select 0,ObjNull,[0,1,1]] call cse_fnc_carryObj);
if ([(_this select 1),[(_this select 1)] call cse_fnc_findVehicle_LOG] call cse_fnc_loadObject_LOG) then {
[player, "STR_CSE_LOG_LOAD_OBJECT","STR_CSE_LOG_LOADED_OBJECT"] call cse_fnc_sendDisplayMessageTo;
};
player switchMove "";
closeDialog 0;
[player, -1] call cse_fnc_limitSpeed;
}, localize "STR_CSE_LOG_LOAD_OBJECT"]
];
["ActionMenu","interaction", _entries ] call cse_fnc_addMultipleEntriesToRadialCategory_F;
//call compile preprocessFile "cse\cse_sys_logistics\scripts\addactions.sqf";

View File

@ -0,0 +1,17 @@
/*
NAME: Addactions
USAGE: Adds the interaction options to objects
AUTHOR: gobbo
RETURN: void
*/
// == Carry system ==
//CSE_Logistics_Pickup = player addaction ["Pick up object", "cse\cse_sys_logistics\scripts\carry\pickup.sqf", [], 6, false, true, "","(alive cursorTarget) AND (cursorTarget distance player <= 5) AND (cursortarget getVariable [""CSE_Logistics_Enable"", true]) AND ((cursortarget iskindof ""ReammoBox"") OR (cursortarget iskindof ""ReammoBox_F"")) && (isNull ([player] call cse_fnc_getCarriedObj))"];
//CSE_Logistics_Drop = player addaction ["Drop object", "cse\cse_sys_logistics\scripts\carry\drop.sqf", [], 6, false, true, "","(!isNull ([player] call cse_fnc_getCarriedObj))"];
// == Load system ==
//CSE_Logistics_Load = player addaction ["Load object", "cse\cse_sys_logistics\scripts\load\load.sqf", [], 6, false, true, "","(!isNull ([player] call cse_fnc_getCarriedObj)) && !(([player] call cse_fnc_getCarriedObj) isKindof 'Man') "];
//CSE_Logistics_Unload = player addaction ["Unload object", "cse\cse_sys_logistics\scripts\load\unload.sqf", [], 6, false, true, "","(alive cursorTarget) AND (cursorTarget distance player <= 10) AND (cursortarget getVariable [""CSE_Logistics_Loaded"", 0] > 0) AND (player getVariable [""CSE_HandsFree"", true])"];

View File

@ -0,0 +1,67 @@
<?xml version="1.0" encoding="utf-8" ?>
<Project name="Combat Space Enhancement">
<Package name="cse_sys_logistics">
<Container ID="MovementActions">
<Key ID="STR_CSE_LOG_CARRY">
<Original>Carry</Original>
<Spanish>Transportar</Spanish>
</Key>
<Key ID="STR_CSE_LOG_CARRY_OBJECT">
<Original>Carry Object</Original>
<Spanish>Transportar Objeto</Spanish>
</Key>
<Key ID="STR_CSE_LOG_DRAG">
<Original>Drag</Original>
<Spanish>Arrastrar</Spanish>
</Key>
<Key ID="STR_CSE_LOG_DRAG_OBJECT">
<Original>Drag Object</Original>
<Spanish>Arrastrar Objeto</Spanish>
</Key>
<Key ID="STR_CSE_LOG_DROP">
<Original>Drop</Original>
<Spanish>Soltar</Spanish>
</Key>
<Key ID="STR_CSE_LOG_DROP_OBJECT">
<Original>Drop Object</Original>
<Spanish>Soltar Objeto</Spanish>
</Key>
<Key ID="STR_CSE_LOG_LOAD">
<Original>Load</Original>
<Spanish>Cargar</Spanish>
</Key>
<Key ID="STR_CSE_LOG_LOAD_OBJECT">
<Original>Load Object</Original>
<Spanish>Cargar Objeto</Spanish>
</Key>
<Key ID="STR_CSE_LOG_MOVE_OBJECT">
<Original>Moving Object</Original>
<Spanish>Moviendo Objeto</Spanish>
</Key>
<Key ID="STR_CSE_LOG_DROPPED_OBJECT">
<Original>Dropped Object</Original>
<Spanish>Objeto Liberado</Spanish>
</Key>
<Key ID="STR_CSE_LOG_OBJECT_PICKED_UP">
<Original>Object picked up</Original>
<Spanish>Objeto Tomado</Spanish>
</Key>
<Key ID="STR_CSE_LOG_START_DRAGGING">
<Original>You start dragging the object</Original>
<Spanish>Arrastrando Objeto</Spanish>
</Key>
<Key ID="STR_CSE_LOG_PLACED_DOWN_OBJECT">
<Original>You placed down the object</Original>
<Spanish>Objeto Liberado</Spanish>
</Key>
<Key ID="STR_CSE_LOG_LOADED_OBJECT">
<Original>You loaded the object in a vehicle</Original>
<Spanish>Objeto cargado en el vehículo</Spanish>
</Key>
</Container>
</Package>
</Project>