mirror of
https://github.com/acemod/ACE3.git
synced 2024-08-30 18:23:18 +00:00
Merge branch 'master' of https://github.com/KoffeinFlummi/ACE3
This commit is contained in:
commit
1b578b8835
@ -22,6 +22,13 @@ private ["_target","_player","_fullPath","_activeChildren","_dynamicChildren","_
|
||||
_target = _object;
|
||||
_player = ACE_player;
|
||||
|
||||
// Check if the function should be modified first
|
||||
if !((_origActionData select 10) isEqualTo {}) then {
|
||||
// It should, so make a copy and pass it to the modifierFunction
|
||||
_origActionData = +_origActionData;
|
||||
[_target, ACE_player, _origActionData select 6, _origActionData] call (_origActionData select 10);
|
||||
};
|
||||
|
||||
// Return nothing if the action itself is not active
|
||||
if !([_target, ACE_player, _origActionData select 6] call (_origActionData select 4)) exitWith {
|
||||
[]
|
||||
|
@ -27,7 +27,7 @@ if !(isNil {missionNamespace getVariable [_actionsVarName, nil]}) exitWith {};
|
||||
private "_recurseFnc";
|
||||
_recurseFnc = {
|
||||
private ["_actions", "_displayName", "_distance", "_icon", "_statement", "_selection", "_condition", "_showDisabled",
|
||||
"_enableInside", "_canCollapse", "_runOnHover", "_children", "_entry", "_entryCfg", "_insertChildren"];
|
||||
"_enableInside", "_canCollapse", "_runOnHover", "_children", "_entry", "_entryCfg", "_insertChildren", "_modifierFunction"];
|
||||
EXPLODE_1_PVT(_this,_actionsCfg);
|
||||
_actions = [];
|
||||
|
||||
@ -56,6 +56,7 @@ _recurseFnc = {
|
||||
_condition = _condition + format [QUOTE( && {[ARR_3(ACE_player, _target, %1)] call EFUNC(common,canInteractWith)} ), getArray (_entryCfg >> "exceptions")];
|
||||
|
||||
_insertChildren = compile (getText (_entryCfg >> "insertChildren"));
|
||||
_modifierFunction = compile (getText (_entryCfg >> "modifierFunction"));
|
||||
|
||||
_showDisabled = (getNumber (_entryCfg >> "showDisabled")) > 0;
|
||||
_enableInside = (getNumber (_entryCfg >> "enableInside")) > 0;
|
||||
@ -76,7 +77,8 @@ _recurseFnc = {
|
||||
[],
|
||||
_selection,
|
||||
_distance,
|
||||
[_showDisabled,_enableInside,_canCollapse,_runOnHover]
|
||||
[_showDisabled,_enableInside,_canCollapse,_runOnHover],
|
||||
_modifierFunction
|
||||
],
|
||||
_children
|
||||
];
|
||||
|
@ -27,7 +27,7 @@ if !(isNil {missionNamespace getVariable [_actionsVarName, nil]}) exitWith {};
|
||||
private "_recurseFnc";
|
||||
_recurseFnc = {
|
||||
private ["_actions", "_displayName", "_distance", "_icon", "_statement", "_selection", "_condition", "_showDisabled",
|
||||
"_enableInside", "_canCollapse", "_runOnHover", "_children", "_entry", "_entryCfg", "_insertChildren"];
|
||||
"_enableInside", "_canCollapse", "_runOnHover", "_children", "_entry", "_entryCfg", "_insertChildren", "_modifierFunction"];
|
||||
EXPLODE_1_PVT(_this,_actionsCfg);
|
||||
_actions = [];
|
||||
|
||||
@ -46,6 +46,7 @@ _recurseFnc = {
|
||||
_condition = _condition + format [QUOTE( && {[ARR_3(ACE_player, _target, %1)] call EFUNC(common,canInteractWith)} ), getArray (_entryCfg >> "exceptions")];
|
||||
|
||||
_insertChildren = compile (getText (_entryCfg >> "insertChildren"));
|
||||
_modifierFunction = compile (getText (_entryCfg >> "modifierFunction"));
|
||||
|
||||
_showDisabled = (getNumber (_entryCfg >> "showDisabled")) > 0;
|
||||
_enableInside = (getNumber (_entryCfg >> "enableInside")) > 0;
|
||||
@ -66,7 +67,8 @@ _recurseFnc = {
|
||||
[],
|
||||
[0,0,0],
|
||||
10, //distace
|
||||
[_showDisabled,_enableInside,_canCollapse,_runOnHover]
|
||||
[_showDisabled,_enableInside,_canCollapse,_runOnHover],
|
||||
_modifierFunction
|
||||
],
|
||||
_children
|
||||
];
|
||||
|
@ -14,6 +14,7 @@
|
||||
* 7: Position (Position or Selection Name) <POSITION> or <STRING> (Optional)
|
||||
* 8: Distance <NUMBER> (Optional)
|
||||
* 9: Other parameters <ARRAY> (Optional)
|
||||
* 10: Modifier function <CODE> (Optional)
|
||||
*
|
||||
* Return value:
|
||||
* Action <ARRAY>
|
||||
@ -27,7 +28,7 @@
|
||||
|
||||
EXPLODE_5_PVT(_this,_actionName,_displayName,_icon,_statement,_condition);
|
||||
|
||||
private ["_insertChildren","_customParams","_position","_distance","_params"];
|
||||
private ["_insertChildren","_customParams","_position","_distance","_params", "_modifierFunction"];
|
||||
|
||||
_insertChildren = if (count _this > 5) then {
|
||||
_this select 5
|
||||
@ -59,6 +60,12 @@ _params = if (count _this > 9) then {
|
||||
[false,false,false,false]
|
||||
};
|
||||
|
||||
_modifierFunction = if (count _this > 10) then {
|
||||
_this select 10
|
||||
} else {
|
||||
{}
|
||||
};
|
||||
|
||||
[
|
||||
_actionName,
|
||||
_displayName,
|
||||
@ -70,5 +77,6 @@ _params = if (count _this > 9) then {
|
||||
_customParams,
|
||||
_position,
|
||||
_distance,
|
||||
_params
|
||||
_params,
|
||||
_modifierFunction
|
||||
]
|
||||
|
@ -35,7 +35,7 @@ _maxSpeed = speed _vehicle max 10;
|
||||
_speed = speed _vehicle;
|
||||
|
||||
if (_speed > _maxSpeed) then {
|
||||
_vehicle setVelocity ((velocity _vehicle) vectorMultiply (_maxSpeed / _speed));
|
||||
_vehicle setVelocity ((velocity _vehicle) vectorMultiply ((_maxSpeed / _speed) - 0.00001)); // fix 1.42-hotfix PhysX libraries applying force in previous direction when turning
|
||||
};
|
||||
|
||||
} , 0, [_driver, _vehicle, _maxSpeed]] call CBA_fnc_addPerFrameHandler;
|
||||
|
@ -19,13 +19,13 @@
|
||||
|
||||
#define MAXCHARACTERS 14
|
||||
|
||||
static char version[] = "1.0";
|
||||
static char VERSION[] = "1.0";
|
||||
|
||||
extern "C" {
|
||||
__declspec (dllexport) void __stdcall RVExtension(char *output, int outputSize, const char *function);
|
||||
};
|
||||
|
||||
std::vector<std::string> splitString(std::string input) {
|
||||
std::vector<std::string> splitString(const std::string & input) {
|
||||
std::istringstream ss(input);
|
||||
std::string token;
|
||||
|
||||
@ -38,10 +38,10 @@ std::vector<std::string> splitString(std::string input) {
|
||||
}
|
||||
|
||||
std::string addLineBreaks(const std::vector<std::string> &words) {
|
||||
|
||||
std::stringstream sstream;
|
||||
int numChar = 0;
|
||||
int i = 0;
|
||||
|
||||
while (i < words.size()) {
|
||||
if (numChar == 0) {
|
||||
sstream << words[i];
|
||||
@ -58,6 +58,7 @@ std::string addLineBreaks(const std::vector<std::string> &words) {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return sstream.str();
|
||||
}
|
||||
|
||||
@ -66,12 +67,10 @@ std::string addLineBreaks(const std::vector<std::string> &words) {
|
||||
#pragma warning( disable : 4996 )
|
||||
|
||||
void __stdcall RVExtension(char *output, int outputSize, const char *function) {
|
||||
//strncpy(output, function, outputSize);
|
||||
|
||||
if (!strcmp(function, "version")) {
|
||||
strncpy(output, version, outputSize);
|
||||
strncpy(output, VERSION, outputSize);
|
||||
} else {
|
||||
strcpy(output, addLineBreaks(splitString(function)).c_str());
|
||||
strncpy(output, addLineBreaks(splitString(function)).c_str(), outputSize);
|
||||
output[outputSize - 1] = '\0';
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user