mirror of
https://github.com/acemod/ACE3.git
synced 2024-08-30 18:23:18 +00:00
Added: Result parsing, ext->sqf dispatch to localEvents
Fixed: Bullet build Fixed: results are all 0=true, -1=failure, otherwise its a dispatch message.
This commit is contained in:
parent
5e7b24c657
commit
fdf0ff2d24
@ -3,9 +3,5 @@
|
||||
// Handle damage to local vehicles
|
||||
[QGVAR(hp), FUNC(dispatchHitPart)] call EFUNC(common,addEventHandler);
|
||||
|
||||
/*
|
||||
"ace_vd" callExtension "reset:";
|
||||
"ace_vd" callExtension "init:";
|
||||
|
||||
[FUNC(monitorResultsPFH), 0, []] call CBA_fnc_addPerFrameHandler;
|
||||
*/
|
||||
[] call FUNC(initializeExtension);
|
||||
[FUNC(monitorResultsPFH), 0, []] call CBA_fnc_addPerFrameHandler;
|
@ -3,8 +3,9 @@
|
||||
ADDON = false;
|
||||
|
||||
// Core engine functions
|
||||
|
||||
PREP(initializeExtension);
|
||||
PREP(monitorResultsPFH);
|
||||
PREP(parseResult);
|
||||
|
||||
PREP(registerVehicleDamageHandler);
|
||||
PREP(registerVehicleWithExtension);
|
||||
@ -14,12 +15,6 @@ PREP(dispatchHitPart);
|
||||
PREP(dispatchDamage);
|
||||
PREP(doHit);
|
||||
|
||||
// Extension calling functionality
|
||||
PREP(initializeExtension);
|
||||
|
||||
// VD specific effects middlemen
|
||||
|
||||
|
||||
// Unique local vehicle ID
|
||||
GVAR(vehicle_id) = 0;
|
||||
|
||||
|
@ -1,4 +1,5 @@
|
||||
#include "script_component.hpp"
|
||||
|
||||
GVAR(ready) = false;
|
||||
CALL_EXT "init:";
|
||||
|
||||
|
@ -3,8 +3,17 @@
|
||||
PARAMS_2(_args,_handle);
|
||||
private["_result"];
|
||||
|
||||
//_result = "ace_vd" callExtension "fetch_result:1";
|
||||
_result = "ace_vd" callExtension "fetch_result:1";
|
||||
while { _result != "" && {_result != "-1"} } do {
|
||||
//diag_log text format["result={%1}", _result];
|
||||
//_result = "ace_vd" callExtension "fetch_result:1";
|
||||
TRACE_1("", _result);
|
||||
_result = "ace_vd" callExtension "fetch_result:1";
|
||||
|
||||
_resultArgs = [_result] call FUNC(parseResult);
|
||||
if(!isNil "_resultArgs") then {
|
||||
if((_resultArgs select 0) == "exec") then {
|
||||
[] call (_resultArgs select 1);
|
||||
} else {
|
||||
[format["ace_vehicledamage_%1", (_result select 0)], (_result select 1)] call EFUNC(common,localEvent);
|
||||
};
|
||||
};
|
||||
};
|
24
addons/vehicledamage/functions/fnc_parseResult.sqf
Normal file
24
addons/vehicledamage/functions/fnc_parseResult.sqf
Normal file
@ -0,0 +1,24 @@
|
||||
//#define DEBUG_MODE_FULL
|
||||
|
||||
#include "script_component.hpp"
|
||||
PARAMS_1(_resultString);
|
||||
private["_values", "_result", "_strings", "_command", "_arguments"];
|
||||
TRACE_1("", _resultString);
|
||||
|
||||
if(!(_resultString find ":") ) exitWith { nil };
|
||||
|
||||
_strings = [_resultString, ":"] call CBA_fnc_split;
|
||||
TRACE_1("", _strings);
|
||||
// Invalid comman
|
||||
|
||||
// Command with no parameters
|
||||
_command = _strings select 0;
|
||||
if((count _strings) < 2) exitWith { [_command, []] };
|
||||
|
||||
if(_command == "exec") exitWith {
|
||||
_code = compile (_strings select 1);
|
||||
[_command, _code]
|
||||
};
|
||||
|
||||
_arguments = [(_strings select 1), ","] call CBA_fnc_split;
|
||||
[(_strings select 0), _arguments]
|
@ -30,7 +30,7 @@ include_directories("common")
|
||||
|
||||
if(USE_BULLET)
|
||||
add_definitions(-DUSE_BULLET)
|
||||
include_directories(BEFORE "lib/bullet3/include")
|
||||
include_directories(BEFORE "lib/bullet3/src")
|
||||
link_directories("lib/bullet3/lib")
|
||||
set(BULLET_LIBS_DEBUG "BulletCollision_vs2010_debug.lib;LinearMath_vs2010_debug.lib;BulletDynamics_vs2010_debug.lib")
|
||||
set(BULLET_LIBS "BulletCollision_vs2010.lib;LinearMath_vs2010.lib;BulletDynamics_vs2010.lib")
|
||||
|
@ -51,6 +51,14 @@ void __stdcall RVExtension(char *output, int outputSize, const char *function) {
|
||||
result = function;
|
||||
}
|
||||
|
||||
if (command == "ready") {
|
||||
if (ace::model_collection::get().ready() && ace::model_collection::get().ready()) {
|
||||
result = "0";
|
||||
} else {
|
||||
result = "-1";
|
||||
}
|
||||
}
|
||||
|
||||
/*************************/
|
||||
// Real functionality goes here
|
||||
if (command == "init") { // init:
|
||||
@ -58,7 +66,7 @@ void __stdcall RVExtension(char *output, int outputSize, const char *function) {
|
||||
ace::model_collection::get().init();
|
||||
}
|
||||
ace::vehicledamage::controller::get();
|
||||
result = "1";
|
||||
result = "0";
|
||||
EXTENSION_RETURN();
|
||||
} else {
|
||||
ace::vehicledamage::controller::get().call(command, _args, result);
|
||||
|
@ -58,14 +58,14 @@ namespace ace {
|
||||
controller::~controller() { }
|
||||
|
||||
bool controller::get_ready(const arguments &_args, std::string & result) {
|
||||
result = "1";
|
||||
result = "0";
|
||||
|
||||
if (!ace::model_collection::get().ready()) {
|
||||
result = "0";
|
||||
result = "-1";
|
||||
}
|
||||
|
||||
if (!_ready)
|
||||
result = "0";
|
||||
result = "-1";
|
||||
|
||||
return true;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user