get rid of config and use namespace for blood models

This commit is contained in:
commy2 2016-09-19 15:08:38 +02:00
parent f60b368c65
commit b1f726a1fe
9 changed files with 39 additions and 62 deletions

View File

@ -1,3 +1,10 @@
class Extended_PreStart_EventHandlers {
class ADDON {
init = QUOTE(call COMPILE_FILE(XEH_preStart));
};
};
class Extended_PreInit_EventHandlers {
class ADDON {
init = QUOTE(call COMPILE_FILE(XEH_preInit));

View File

@ -1,48 +0,0 @@
class CfgVehicles {
class Static;
class ACE_Blooddrop_1: Static {
htMin = 60;
htMax = 1800;
afMax = 200;
mfMax = 100;
mFact = 0;
tBody = 0;
simulation = "SeaGull";
armor = 0;
timeToLive = 1;
side = -1;
shadow = 0;
scope = 1;
vehicleClass = "";
displayName = "";
model = QPATHTOF(data\drop_1.p3d);
accuracy = 0;
camouflage = 0;
destrType = "DestructNo";
/* Simulation Seagull Additions */
minHeight = 0;
avgHeight = 0;
maxHeight = 0;
minSpeed = 0;
maxSpeed = 0;
acceleration = 0;
turning = 0;
straightDistance = 0;
flySound[] = { "", 0.0316228, 1, 1 };
singSound[] = { "", 0.0316228, 1, 1 };
canBeShot = 0;
airFriction2[] = { 25, 12, 2.5 };
airFriction1[] = { 1500, 700, 100 };
airFriction0[] = { 40, 20, 60 };
/* Simulation Seagull Additions */
};
class ACE_Blooddrop_2: ACE_Blooddrop_1 {
model = QPATHTOF(data\drop_2.p3d);
};
class ACE_Blooddrop_3: ACE_Blooddrop_1 {
model = QPATHTOF(data\drop_3.p3d);
};
class ACE_Blooddrop_4: ACE_Blooddrop_1 {
model = QPATHTOF(data\drop_4.p3d);
};
};

View File

@ -4,4 +4,25 @@ ADDON = false;
#include "XEH_PREP.hpp"
// blood object model namespace
GVAR(models) = [] call CBA_fnc_createNamespace;
{
_x params ["_name", "_model"];
// createSimpleObject expects a path without the leading slash
if ((_model select [0,1]) isEqualTo "\") then {
_model = _model select [1];
};
GVAR(models) setVariable [_name, _model];
} forEach [
["blooddrop_1", QPATHTOF(data\drop_1.p3d)],
["blooddrop_2", QPATHTOF(data\drop_2.p3d)],
["blooddrop_3", QPATHTOF(data\drop_3.p3d)],
["blooddrop_4", QPATHTOF(data\drop_4.p3d)],
["bloodsplat_1", QPATHTOF(data\splat_1.p3d)],
["bloodsplat_2", QPATHTOF(data\splat_2.p3d)]
];
ADDON = true;

View File

@ -3,17 +3,16 @@
class CfgPatches {
class ADDON {
name = COMPONENT_NAME;
units[] = {"ACE_Blooddrop_1", "ACE_Blooddrop_2", "ACE_Blooddrop_3", "ACE_Blooddrop_4"};
units[] = {};
weapons[] = {};
requiredVersion = REQUIRED_VERSION;
requiredAddons[] = {"ace_main"};
author = ECSTRING(common,ACETeam);
authors[] = {"Glowbal", "Sickboy"};
authors[] = {"Glowbal","Sickboy","commy2"};
url = ECSTRING(main,URL);
VERSION_CONFIG;
};
};
#include "CfgEventHandlers.hpp"
#include "CfgVehicles.hpp"
#include "state_machine.hpp"

View File

@ -1,6 +1,7 @@
/*
* Author: Glowbal
* Spawn a blood drop. Available blood drop classes are ACE_Blooddrop_1 through ACE_Blooddrop_4.
* Spawn a blood drop.
* Available blood drop classes are blooddrop_1 through blooddrop_4.
*
* Arguments:
* 0: classname of blood drop <OBJECT>
@ -10,7 +11,7 @@
* Created blood drop <OBJECT>
*
* Example:
* ["ACE_Blooddrop_2", getPos player] call ace_medical_blood_fnc_createBlood
* ["blooddrop_2", getPos player] call ace_medical_blood_fnc_createBlood
*
* Public: No
*/
@ -19,15 +20,12 @@
params ["_type", "_pos"];
private _p3dFile = getText (configFile >> "CfgVehicles" >> _type >> "model");
if (_p3dFile == "") exitWith {};
// createSimpleObject expects a path without the leading slash
if ((_p3dFile select [0,1]) == "\") then {_p3dFile = _p3dFile select [1];};
private _model = GVAR(models) getVariable _type;
private _object = createSimpleObject [_p3dFile, [0,0,0]];
private _object = createSimpleObject [_model, [0,0,0]];
_object setDir random 360;
_object setPos _pos;
[QGVAR(bloodDropCreated), [_object]] call CBA_fnc_serverEvent;
_object;
_object

View File

@ -33,6 +33,6 @@ if ((CBA_missionTime - _lastTime) + _bloodLoss >= 8 + random 2) then {
];
_position set [2, 0];
private _bloodDrop = ["ACE_Blooddrop_1", "ACE_Blooddrop_2", "ACE_Blooddrop_3", "ACE_Blooddrop_4"] select (floor (_bloodLoss max 3));
private _bloodDrop = ["blooddrop_1", "blooddrop_2", "blooddrop_3", "blooddrop_4"] select floor (_bloodLoss max 3);
[_bloodDrop, _position, getDir _unit] call FUNC(createBlood);
};

View File

@ -27,7 +27,7 @@ params ["_unit", "_dir", "_damage"];
private _distanceBetweenDrops = DISTANCE_BETWEEN_DROPS * _damage;
private _offset = OFFSET + _distanceBetweenDrops;
private _pos = _unit getPos [_offset, _dir];
["ACE_Blooddrop_2", _pos, _dir] call FUNC(createBlood);
["blooddrop_2", _pos, _dir] call FUNC(createBlood);
private _dropAmount = ceil (MAXIMUM_DROPS * _damage);
if (_dropAmount > 1) then {
@ -36,6 +36,6 @@ if (_dropAmount > 1) then {
for "_i" from 2 to _dropAmount do {
_pos = _pos getPos [_offset, _dir];
["ACE_Blooddrop_1", _pos, _dir] call FUNC(createBlood);
["blooddrop_1", _pos, _dir] call FUNC(createBlood);
};
};