Untitled diff

Criado O diff nunca expira
51 remoções
330 linhas
10 adições
290 linhas
// ******************************************************************************************
// ******************************************************************************************
// * This project is licensed under the GNU Affero GPL v3. Copyright © 2014 A3Wasteland.com *
// * This project is licensed under the GNU Affero GPL v3. Copyright © 2014 A3Wasteland.com *
// ******************************************************************************************
// ******************************************************************************************
// @file Version: 1.0
// @file Version: 1.0
// @file Name: setupStoreNPC.sqf
// @file Name: setupStoreNPC.sqf
// @file Author: AgentRev
// @file Author: AgentRev
// @file Created: 12/10/2013 12:36
// @file Created: 12/10/2013 12:36
// @file Args:
// @file Args:
#define STORE_ACTION_CONDITION "(player distance _target < 3)"
#define STORE_ACTION_CONDITION "(player distance _target < 3)"
#define SELL_CRATE_CONDITION "(!isNil 'R3F_LOG_joueur_deplace_objet' && {R3F_LOG_joueur_deplace_objet isKindOf 'ReammoBox_F'})"
#define SELL_CRATE_CONDITION "(!isNil 'R3F_LOG_joueur_deplace_objet' && {R3F_LOG_joueur_deplace_objet isKindOf 'ReammoBox_F'})"
#define SELL_CONTENTS_CONDITION "(!isNil 'R3F_LOG_joueur_deplace_objet' && {{R3F_LOG_joueur_deplace_objet isKindOf _x} count ['ReammoBox_F','AllVehicles'] > 0})"
#define SELL_CONTENTS_CONDITION "(!isNil 'R3F_LOG_joueur_deplace_objet' && {{R3F_LOG_joueur_deplace_objet isKindOf _x} count ['ReammoBox_F','AllVehicles'] > 0})"
#define SELL_VEH_CONTENTS_CONDITION "{!isNull objectFromNetId (player getVariable ['lastVehicleRidden', ''])}"
#define SELL_VEH_CONTENTS_CONDITION "{!isNull objectFromNetId (player getVariable ['lastVehicleRidden', ''])}"
#define SELL_BIN_CONDITION "(cursorTarget == _target)"
#define SELL_BIN_CONDITION "(cursorTarget == _target)"
private ["_npc", "_npcName", "_startsWith", "_building"];
private ["_npc", "_npcName", "_startsWith", "_building"];
_npc = _this select 0;
_npc = _this select 0;
{ _npc disableAI _x } forEach ["MOVE","FSM","TARGET","AUTOTARGET"];
_npcName = vehicleVarName _npc;
_npcName = vehicleVarName _npc;
_npc setName [_npcName,"",""];
_npc setName [_npcName,"",""];
_npc allowDamage false;
_npc allowDamage false;
{ _npc disableAI _x } forEach ["MOVE","FSM","TARGET","AUTOTARGET"];
_npc enableSimulation false;
if (hasInterface) then
if (hasInterface) then
{
{
_startsWith =
_startsWith =
{
{
private ["_needle", "_testArr"];
private ["_needle", "_testArr"];
_needle = _this select 0;
_needle = _this select 0;
_testArr = toArray (_this select 1);
_testArr = toArray (_this select 1);
_testArr resize count toArray _needle;
_testArr resize count toArray _needle;
(toString _testArr == _needle)
(toString _testArr == _needle)
};
};
switch (true) do
switch (true) do
{
{
case (["GenStore", _npcName] call _startsWith):
case (["GenStore", _npcName] call _startsWith):
{
{
_npc addAction ["<img image='client\icons\store.paa'/> Open General Store", "client\systems\generalStore\loadGenStore.sqf", [], 1, true, true, "", STORE_ACTION_CONDITION];
_npc addAction ["<img image='client\icons\store.paa'/> Open General Store", "client\systems\generalStore\loadGenStore.sqf", [], 1, true, true, "", STORE_ACTION_CONDITION];
};
};
case (["GunStore", _npcName] call _startsWith):
case (["GunStore", _npcName] call _startsWith):
{
{
_npc addAction ["<img image='client\icons\store.paa'/> Open Gun Store", "client\systems\gunStore\loadgunStore.sqf", [], 1, true, true, "", STORE_ACTION_CONDITION];
_npc addAction ["<img image='client\icons\store.paa'/> Open Gun Store", "client\systems\gunStore\loadgunStore.sqf", [], 1, true, true, "", STORE_ACTION_CONDITION];
};
};
case (["VehStore", _npcName] call _startsWith):
case (["VehStore", _npcName] call _startsWith):
{
{
_npc addAction ["<img image='client\icons\store.paa'/> Open Vehicle Store", "client\systems\vehicleStore\loadVehicleStore.sqf", [], 1, true, true, "", STORE_ACTION_CONDITION];
_npc addAction ["<img image='client\icons\store.paa'/> Open Vehicle Store", "client\systems\vehicleStore\loadVehicleStore.sqf", [], 1, true, true, "", STORE_ACTION_CONDITION];
};
};
};
};
_npc addAction ["<img image='client\icons\money.paa'/> Sell crate", "client\systems\selling\sellCrateItems.sqf", [false, false, true], 0.99, false, true, "", STORE_ACTION_CONDITION + " && " + SELL_CRATE_CONDITION];
_npc addAction ["<img image='client\icons\money.paa'/> Sell crate", "client\systems\selling\sellCrateItems.sqf", [false, false, true], 0.99, false, true, "", STORE_ACTION_CONDITION + " && " + SELL_CRATE_CONDITION];
_npc addAction ["<img image='client\icons\money.paa'/> Sell contents", "client\systems\selling\sellCrateItems.sqf", [], 0.98, false, true, "", STORE_ACTION_CONDITION + " && " + SELL_CONTENTS_CONDITION];
_npc addAction ["<img image='client\icons\money.paa'/> Sell contents", "client\systems\selling\sellCrateItems.sqf", [], 0.98, false, true, "", STORE_ACTION_CONDITION + " && " + SELL_CONTENTS_CONDITION];
_npc addAction ["<img image='client\icons\money.paa'/> Sell last vehicle contents", "client\systems\selling\sellVehicleItems.sqf", [], 0.97, false, true, "", STORE_ACTION_CONDITION + " && " + SELL_VEH_CONTENTS_CONDITION];
_npc addAction ["<img image='client\icons\money.paa'/> Sell last vehicle contents", "client\systems\selling\sellVehicleItems.sqf", [], 0.97, false, true, "", STORE_ACTION_CONDITION + " && " + SELL_VEH_CONTENTS_CONDITION];
};
};
if (isServer) then
if (isServer) then
{
{
_building = nearestBuilding _npc;
_npc setVariable ["storeNPC_nearestBuilding", netId _building, true];
_facesCfg = configFile >> "CfgFaces" >> "Man_A3";
_facesCfg = configFile >> "CfgFaces" >> "Man_A3";
_faces = [];
_faces = [];
for "_i" from 0 to (count _facesCfg - 1) do
for "_i" from 0 to (count _facesCfg - 1) do
{
{
_faceCfg = _facesCfg select _i;
_faceCfg = _facesCfg select _i;
_faceTex = toArray getText (_faceCfg >> "texture");
_faceTex = toArray getText (_faceCfg >> "texture");
_faceTex resize 1;
_faceTex resize 1;
_faceTex = toString _faceTex;
_faceTex = toString _faceTex;
if (_faceTex == "\") then
if (_faceTex == "\") then
{
{
_faces pushBack configName _faceCfg;
_faces pushBack configName _faceCfg;
};
};
};
};
_face = _faces call BIS_fnc_selectRandom;
_face = _faces call BIS_fnc_selectRandom;
_npc setFace _face;
_npc setFace _face;
_npc setVariable ["storeNPC_face", _face, true];
_npc setVariable ["storeNPC_face", _face, true];
}
else
{
private "_nearestBuilding";
waitUntil
{
sleep 0.1;
_nearestBuilding = _npc getVariable "storeNPC_nearestBuilding";
!isNil "_nearestBuilding"
};
_building = objectFromNetId _nearestBuilding;
};
if (isNil "_building" || {isNull _building}) then
{
_building = nearestBuilding _npc;
};
};
_building allowDamage true;
for "_i" from 1 to 99 do { _building setHit ["glass_" + str _i, 1] }; // pre-break the windows so people can shoot thru them
_building allowDamage false; // disable building damage
if (isServer) then
if (isServer) then
{
{
removeAllWeapons _npc;
removeAllWeapons _npc;
waitUntil {!isNil "storeConfigDone"};
waitUntil {!isNil "storeConfigDone"};
{
{
if (_x select 0 == _npcName) exitWith
if (_x select 0 == _npcName) exitWith
{
{
private "_frontOffset";
private "_frontOffset";
//collect our arguments
//collect our arguments
_npcPos = _x select 1;
_npcPos = _x select 1;
_deskDirMod = _x select 2;
_deskDirMod = _x select 2;