Skip to content

Commit

Permalink
Fix anims (#113)
Browse files Browse the repository at this point in the history
* fix switchMove usages -> among other things, the shitty housework animations play again
* fix unconscious handling  -> probably fix #95 and #98 again
* add missing transition unconscious -> death (was preventing unconsciously dying civs from getting despawned)
* remove a `switchMove ""` after death that I ... cannot see to be useful (leftover from ooold code)
* reduce time to find neighbor for chat from 90s to 60s
  • Loading branch information
Fusselwurm authored Dec 17, 2020
1 parent 2de6f8d commit 6ada928
Show file tree
Hide file tree
Showing 14 changed files with 35 additions and 26 deletions.
1 change: 0 additions & 1 deletion addons/activities/XEH_PREP.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@ PREP(endCustomActivity);
PREP(findPositionOfInterest);
PREP(forceEmotionSpeed);
PREP(forcePanicSpeed);
PREP(handleAceUnconscious);
PREP(initCommonEventhandlers);
PREP(initConfig);
PREP(isInHouse);
Expand Down
9 changes: 0 additions & 9 deletions addons/activities/functions/fnc_handleAceUnconscious.sqf

This file was deleted.

8 changes: 0 additions & 8 deletions addons/activities/functions/fnc_initCommonEventhandlers.sqf
Original file line number Diff line number Diff line change
@@ -1,13 +1,5 @@
#include "..\script_component.hpp"

[QGVAR(switchMove), {
params ["_unit", "_animation"];
_unit switchMove _animation;
}
] call CBA_fnc_addEventHandler;

["ace_unconscious", FUNC(handleAceUnconscious)] call CBA_fnc_addEventHandler;

[QGVAR(doStop), FUNC(doStop)] call CBA_fnc_addEventHandler;
[QGVAR(doCarryOn), FUNC(doCarryOn)] call CBA_fnc_addEventHandler;
[QGVAR(doReverse), FUNC(doReverse)] call CBA_fnc_addEventHandler;
2 changes: 1 addition & 1 deletion addons/activities/functions/fnc_sm_activities.sqf
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ assert ([
_act_panic, _act_business,
["grad_civs_panicking_end"],
{true},
{[QGVAR(switchMove), [_this, ""]] call CBA_fnc_globalEvent;},
{[QEGVAR(common,switchMove), [_this, ""]] call CBA_fnc_globalEvent;},
_act_panic + _act_business
] call CBA_statemachine_fnc_addEventTransition);

Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
#include "..\script_component.hpp"

_this enableDynamicSimulation false; // prevent from freezing mid-flight (?)
[QGVAR(switchMove), [_this, ""]] call CBA_fnc_globalEvent; // leave everything
[QEGVAR(common,switchMove), [_this, ""]] call CBA_fnc_globalEvent; // leave everything
_this forceSpeed -1;
6 changes: 6 additions & 0 deletions addons/common/XEH_postInit.sqf
Original file line number Diff line number Diff line change
@@ -1,3 +1,9 @@
#include "script_component.hpp"

if (!(EGVAR(main,enabled))) exitWith {};

[QGVAR(switchMove), {
params ["_unit", "_animation"];
_unit switchMove _animation;
}
] call CBA_fnc_addEventHandler;
12 changes: 12 additions & 0 deletions addons/lifecycle/XEH_postInit.sqf
Original file line number Diff line number Diff line change
Expand Up @@ -25,3 +25,15 @@ if (isServer || CBA_isHeadlessClient) then {
};
}
] call CBA_fnc_addEventHandler;


["ace_unconscious", {
params [
["_unit", objNull, [objNull]],
["_isUnconscious", true, [true]]
];

private _eventName = if (_isUnconscious) then {QGVAR(unconscious)} else {QGVAR(conscious)};
[_eventName, [_unit], _unit] call CBA_fnc_targetEvent;

}] call CBA_fnc_addEventHandler;
9 changes: 9 additions & 0 deletions addons/lifecycle/functions/fnc_sm_lifecycle.sqf
Original file line number Diff line number Diff line change
Expand Up @@ -90,6 +90,15 @@ assert ([
_lifecycle_unconscious + _lifecycle_life
] call CBA_statemachine_fnc_addEventTransition);

assert ([
_lifecycle,
_lifecycle_unconscious, _lifecycle_death,
["killed"],
{ true },
{},
_lifecycle_unconscious + _lifecycle_death
] call CBA_statemachine_fnc_addEventTransition);

EGVAR(common,stateMachines) setVariable ["lifecycle", _lifecycle];

_lifecycle
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,6 @@ _unit addEventHandler [

_unit removeAllEventHandlers "Killed";
_unit removeAllEventHandlers "FiredNear";
[QGVAR(switchMove), [_unit, ""]] call CBA_fnc_globalEvent; // TODO: is that really necessary?
}
];

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ _this call EFUNC(activities,forceEmotionSpeed);
if (isNull _house) exitWith {};

if (random 4 > 1) then { // in 2 of 3 cases , do change position
[QGVAR(switchMove), [_this, ""]] call CBA_fnc_globalEvent;
[QEGVAR(common,switchMove), [_this, ""]] call CBA_fnc_globalEvent;
doStop _this;

// add one random really close position to house positions
Expand All @@ -19,7 +19,7 @@ if (random 4 > 1) then { // in 2 of 3 cases , do change position
_this moveTo _pos;
} else {
private _anim = selectRandom ["Acts_B_M05_briefing", "Acts_JetsOfficerSpilling", "acts_miller_knockout", "InBaseMoves_HandsBehindBack1"];
[QGVAR(switchMove), [_this, _anim]] call CBA_fnc_globalEvent;
[QEGVAR(common,switchMove), [_this, _anim]] call CBA_fnc_globalEvent;
};

/*
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
#include "..\script_component.hpp"

[QGVAR(switchMove), [_this, ""]] call CBA_fnc_globalEvent;
[QEGVAR(common,switchMove), [_this, ""]] call CBA_fnc_globalEvent;
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#include "..\script_component.hpp"

[QGVAR(switchMove), [_this, ""]] call CBA_fnc_globalEvent;
[QEGVAR(common,switchMove), [_this, ""]] call CBA_fnc_globalEvent;
doStop _this;
_this setVariable ["grad_civs_stopDistance", random [3, 7, 20]];
private _neighborToMeet = _this getVariable ["grad_civs_neighborToMeet", objNull];
Original file line number Diff line number Diff line change
Expand Up @@ -5,4 +5,4 @@ if (isNull _neighbor) exitWith {true}; // go to chat only so that chat can lead
if (!(alive _neighbor)) exitWith {true};

/*get closer than 2m to have a conversation*/
(_this distance _neighbor) < 2 || ((_thisStateTime + 90) < CBA_missionTime)
(_this distance _neighbor) < 2 || ((_thisStateTime + 60) < CBA_missionTime)
1 change: 1 addition & 0 deletions docs/states.gv
Original file line number Diff line number Diff line change
Expand Up @@ -74,4 +74,5 @@ digraph lifecycle {
cluster_life_node -> cyc_death [ltail=cluster_life color=blue];
cluster_life_node -> cyc_unconscious [ltail=cluster_life color=blue];
cyc_unconscious -> cluster_life_node [ltail=cluster_life color=blue];
cyc_unconscious -> cyc_death [ltail=cluster_life color=blue];
}

0 comments on commit 6ada928

Please sign in to comment.