3 protected int m_CommandUIDPerCrewIdx[4];
4 protected bool m_IsOpening =
true;
7 string m_AnimSource =
"";
17 override void CreateConditionComponents()
26 string animSource =
"";
29 if (player && player.GetCommand_Vehicle())
31 if (
Class.CastTo(car, player.GetCommand_Vehicle().GetTransport()))
33 int crewIdx = car.CrewMemberIndex(player);
36 if (crewIdx < 0 || crewIdx > 3 || car.GetCarDoorsState(car.GetDoorInvSlotNameFromSeatPos(crewIdx)) ==
CarDoorState.DOORS_MISSING)
41 animSource = car.GetAnimSourceFromSelection(car.GetDoorSelectionNameFromSeatPos(crewIdx));
44 if (!car.CanReachDoorsFromSeat(animSource, crewIdx) || !car.IsAreaAtDoorFree(crewIdx))
49 m_CommandUID = m_CommandUIDPerCrewIdx[crewIdx];
51 float animationPhaseInside = car.GetAnimationPhase(animSource);
52 return (m_IsOpening && animationPhaseInside <= 0.5) || (!m_IsOpening && animationPhaseInside > 0.5);
59 override void OnStartServer(
ActionData action_data)
73 string animSource =
"";
76 if (player && player.GetCommand_Vehicle())
78 car =
CarScript.Cast(player.GetCommand_Vehicle().GetTransport());
81 int crewIdx = car.CrewMemberIndex(player);
82 animSource = car.GetAnimSourceFromSelection(car.GetDoorSelectionNameFromSeatPos(crewIdx));
88 car.ForceUpdateLightsStart();
89 car.SetAnimationPhase(animSource, phase);
93 override void OnEndServer(
ActionData action_data)
97 if (player && player.GetCommand_Vehicle())
99 car =
CarScript.Cast(player.GetCommand_Vehicle().GetTransport());
104 car.ForceUpdateLightsEnd();
110 if (
m_Car || m_AnimSource.Length() > 0)
112 Error(
"[WARNING] m_Car and m_AnimSource are left for backwards compatibility to not crash mods that are using it, but should no longer be used.");
116 override bool CanBeUsedInVehicle()
121 protected void FillCommandUIDPerCrewIdx(
int crewIdx0,
int crewIdx1,
int crewIdx2,
int crewIdx3)
123 m_CommandUIDPerCrewIdx[0] = crewIdx0;
124 m_CommandUIDPerCrewIdx[1] = crewIdx1;
125 m_CommandUIDPerCrewIdx[2] = crewIdx2;
126 m_CommandUIDPerCrewIdx[3] = crewIdx3;
129 protected void FillCommandUIDPerCrewIdx(
int evenCrewIdx0,
int unevenCrewIdx1)
131 FillCommandUIDPerCrewIdx(evenCrewIdx0, unevenCrewIdx1, evenCrewIdx0, unevenCrewIdx1);