mirror of
https://github.com/acemod/ACE3.git
synced 2024-08-30 18:23:18 +00:00
parent
5dcb8707dd
commit
cb33666091
@ -149,6 +149,9 @@ if (isServer) then {
|
||||
["setSpeaker", {(_this select 0) setSpeaker (_this select 1)}] call FUNC(addEventhandler);
|
||||
["selectLeader", {(_this select 0) selectLeader (_this select 1)}] call FUNC(addEventHandler);
|
||||
["setVelocity", {(_this select 0) setVelocity (_this select 1)}] call FUNC(addEventHandler);
|
||||
["playMove", {(_this select 0) playMove (_this select 1)}] call FUNC(addEventHandler);
|
||||
["playMoveNow", {(_this select 0) playMoveNow (_this select 1)}] call FUNC(addEventHandler);
|
||||
["switchMove", {(_this select 0) switchMove (_this select 1)}] call FUNC(addEventHandler);
|
||||
|
||||
if (isServer) then {
|
||||
["hideObjectGlobal", {(_this select 0) hideObjectGlobal (_this select 1)}] call FUNC(addEventHandler);
|
||||
|
@ -253,6 +253,7 @@ GVAR(eventsLocation) setText QGVAR(eventsLocation);
|
||||
PREP(globalEvent);
|
||||
PREP(_handleNetEvent);
|
||||
PREP(addEventHandler);
|
||||
PREP(objectEvent);
|
||||
PREP(targetEvent);
|
||||
PREP(serverEvent);
|
||||
PREP(localEvent);
|
||||
|
@ -1,6 +1,5 @@
|
||||
/*
|
||||
* Author: commy2
|
||||
*
|
||||
* Execute an animation. This is used to not break things like the unconsciousness animation.
|
||||
*
|
||||
* Arguments:
|
||||
@ -10,15 +9,20 @@
|
||||
* 0 = PlayMove
|
||||
* 1 = PlayMoveNow
|
||||
* 2 = SwitchMove (no transitional animation, doesn't overwrite priority 1)
|
||||
* 3: Force overwritting unconscious (default: false) <BOOL>
|
||||
*
|
||||
* Return Value:
|
||||
* None
|
||||
*
|
||||
* Example:
|
||||
* [player, "AmovPercMstpSnonWnonDnon_exerciseKata", 1] call ace_common_fnc_doAnimation
|
||||
*
|
||||
* Public: Yes
|
||||
*/
|
||||
#include "script_component.hpp"
|
||||
|
||||
params ["_unit", "_animation", ["_priority", 0], ["_force", false]];
|
||||
TRACE_4("params",_unit,_animation,_priority,_force);
|
||||
|
||||
// don't overwrite more important animations
|
||||
if (_unit getVariable ["ACE_isUnconscious", false] && {(_animation != "Unconscious")} && {!_force}) exitWith {};
|
||||
@ -33,36 +37,38 @@ if (_animation == "") then {
|
||||
|
||||
//if (_animation == animationState _unit) exitWith {};
|
||||
|
||||
TRACE_2("",local _unit,vehicle _unit);
|
||||
switch (_priority) do {
|
||||
case 0: {
|
||||
if (_unit == vehicle _unit) then {
|
||||
[_unit, format ["{_this playMove '%1'}", _animation], _unit] call FUNC(execRemoteFnc);
|
||||
["playMove", _unit, [_unit, _animation]] call FUNC(objectEvent);
|
||||
} else {
|
||||
// Execute on all machines. PlayMove and PlayMoveNow are bugged: They have no global effects when executed on remote machines inside vehicles.
|
||||
[_unit, format ["{_this playMove '%1'}", _animation]] call FUNC(execRemoteFnc);
|
||||
["playMove", [_unit, _animation]] call FUNC(globalEvent);
|
||||
};
|
||||
};
|
||||
case 1: {
|
||||
if (_unit == vehicle _unit) then {
|
||||
[_unit, format ["{_this playMoveNow '%1'}", _animation], _unit] call FUNC(execRemoteFnc);
|
||||
["playMoveNow", _unit, [_unit, _animation]] call FUNC(objectEvent);
|
||||
} else {
|
||||
// Execute on all machines. PlayMove and PlayMoveNow are bugged: They have no global effects when executed on remote machines inside vehicles.
|
||||
[_unit, format ["{_this playMoveNow '%1'}", _animation]] call FUNC(execRemoteFnc);
|
||||
// Execute on all machines. PlayMove and PlayMoveNow are bugged: They have no global effects when executed on remote machines inside vehicles.
|
||||
["playMoveNow", [_unit, _animation]] call FUNC(globalEvent);
|
||||
};
|
||||
};
|
||||
case 2: {
|
||||
// try playMoveNow first
|
||||
if (_unit == vehicle _unit) then {
|
||||
[_unit, format ["{_this playMoveNow '%1'}", _animation], _unit] call FUNC(execRemoteFnc);
|
||||
["playMoveNow", _unit, [_unit, _animation]] call FUNC(objectEvent);
|
||||
} else {
|
||||
// Execute on all machines. PlayMove and PlayMoveNow are bugged: They have no global effects when executed on remote machines inside vehicles.
|
||||
[_unit, format ["{_this playMoveNow '%1'}", _animation]] call FUNC(execRemoteFnc);
|
||||
// Execute on all machines. PlayMove and PlayMoveNow are bugged: They have no global effects when executed on remote machines inside vehicles.
|
||||
["playMoveNow", [_unit, _animation]] call FUNC(globalEvent);
|
||||
};
|
||||
|
||||
// if animation doesn't respond, do switchMove
|
||||
if (animationState _unit != _animation) then {
|
||||
TRACE_1("did not respond to playMoveNow",animationState _unit);
|
||||
// Execute on all machines. SwitchMove has local effects.
|
||||
[_unit, format ["{_this switchMove '%1'}", _animation]] call FUNC(execRemoteFnc);
|
||||
["switchMove", [_unit, _animation]] call FUNC(globalEvent);
|
||||
};
|
||||
};
|
||||
default {};
|
||||
|
34
addons/common/functions/fnc_objectEvent.sqf
Normal file
34
addons/common/functions/fnc_objectEvent.sqf
Normal file
@ -0,0 +1,34 @@
|
||||
/*
|
||||
* Author: PabstMirror
|
||||
* Execute an event where object is local.
|
||||
* If local there is no network traffic/delay (Unlike targetEvent)
|
||||
*
|
||||
* Arguments:
|
||||
* 0: Event name (STRING)
|
||||
* 1: Event target <OBJECT>
|
||||
* 2: Event args <ANY>
|
||||
*
|
||||
* Return Value:
|
||||
* None
|
||||
*
|
||||
* Example:
|
||||
* ["doThing", vehicle player, []] call ace_common_fnc_objectEvent
|
||||
*
|
||||
* Public: Yes
|
||||
*/
|
||||
#include "script_component.hpp"
|
||||
|
||||
params ["_eventName", "_eventTarget", "_eventArgs"];
|
||||
|
||||
#ifdef DEBUG_EVENTS
|
||||
ACE_LOGINFO_2("* Object Event: %1 - %2",_eventName,_eventTarget);
|
||||
ACE_LOGINFO_1(" args=%1",_eventArgs);
|
||||
#endif
|
||||
|
||||
if (local _eventTarget) then {
|
||||
[_eventName, _eventArgs] call FUNC(localEvent);
|
||||
} else {
|
||||
_this call FUNC(targetEvent);
|
||||
};
|
||||
|
||||
nil
|
Loading…
Reference in New Issue
Block a user