mirror of https://github.com/OpenRCT2/OpenRCT2.git
Add railway crossing behaviour for staff (#18057)
This commit is contained in:
parent
6be41893a4
commit
6c6ea169f1
|
@ -11,6 +11,7 @@
|
|||
- Feature: [#17821] [Plugin] Add API for track subpositions and vehicle subposition.
|
||||
- Feature: [#17877] Add three real-life flying roller coaster colour schemes.
|
||||
- Feature: [#17900] Add “Classic Wooden Coaster” with shallow banked turns.
|
||||
- Feature: [#18057] Staff members now wait for passing or stalled vehicles before crossing railway tracks.
|
||||
- Feature: [objects#198] Add additional pirate roofs.
|
||||
- Feature: [objects#205] Add additional glass roofs.
|
||||
- Feature: [objects#209] Add the Steel Roller Coaster train and 2-across Inverted Train from RollerCoaster Tycoon 1.
|
||||
|
|
|
@ -5299,16 +5299,10 @@ void Guest::UpdateWalking()
|
|||
}
|
||||
}
|
||||
|
||||
// Check if vehicle is blocking the destination tile
|
||||
auto curPos = TileCoordsXYZ(GetLocation());
|
||||
auto dstPos = TileCoordsXYZ(CoordsXYZ{ GetDestination(), NextLoc.z });
|
||||
if (curPos.x != dstPos.x || curPos.y != dstPos.y)
|
||||
if (PathIsBlockedByVehicle())
|
||||
{
|
||||
if (footpath_is_blocked_by_vehicle(dstPos))
|
||||
{
|
||||
// Wait for vehicle to pass
|
||||
return;
|
||||
}
|
||||
// Wait for vehicle to pass
|
||||
return;
|
||||
}
|
||||
|
||||
uint8_t pathingResult;
|
||||
|
|
|
@ -321,6 +321,18 @@ bool Peep::CheckForPath()
|
|||
return false;
|
||||
}
|
||||
|
||||
bool Peep::PathIsBlockedByVehicle()
|
||||
{
|
||||
auto curPos = TileCoordsXYZ(GetLocation());
|
||||
auto dstPos = TileCoordsXYZ(CoordsXYZ{ GetDestination(), NextLoc.z });
|
||||
if ((curPos.x != dstPos.x || curPos.y != dstPos.y) && footpath_is_blocked_by_vehicle(dstPos))
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
PeepActionSpriteType Peep::GetActionSpriteType()
|
||||
{
|
||||
if (IsActionInterruptable())
|
||||
|
|
|
@ -412,6 +412,7 @@ public: // Peep
|
|||
// TODO: Make these private again when done refactoring
|
||||
public: // Peep
|
||||
[[nodiscard]] bool CheckForPath();
|
||||
bool PathIsBlockedByVehicle();
|
||||
void PerformNextAction(uint8_t& pathing_result);
|
||||
void PerformNextAction(uint8_t& pathing_result, TileElement*& tile_result);
|
||||
[[nodiscard]] int32_t GetZOnSlope(int32_t tile_x, int32_t tile_y);
|
||||
|
|
|
@ -862,6 +862,14 @@ bool Staff::DoMiscPathFinding()
|
|||
return false;
|
||||
}
|
||||
|
||||
bool Staff::IsMechanicHeadingToFixRideBlockingPath()
|
||||
{
|
||||
auto trackElement = map_get_track_element_at(CoordsXYZ{ GetDestination(), NextLoc.z });
|
||||
auto ride = get_ride(trackElement->GetRideIndex());
|
||||
return AssignedStaffType == StaffType::Mechanic && ride->id == CurrentRide
|
||||
&& ride->breakdown_reason == BREAKDOWN_SAFETY_CUT_OUT;
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* rct2: 0x006C086D
|
||||
|
@ -1323,6 +1331,9 @@ void Staff::UpdateHeadingToInspect()
|
|||
if (!CheckForPath())
|
||||
return;
|
||||
|
||||
if (PathIsBlockedByVehicle() && !IsMechanicHeadingToFixRideBlockingPath())
|
||||
return;
|
||||
|
||||
uint8_t pathingResult;
|
||||
TileElement* rideEntranceExitElement;
|
||||
PerformNextAction(pathingResult, rideEntranceExitElement);
|
||||
|
@ -1428,6 +1439,9 @@ void Staff::UpdateAnswering()
|
|||
if (!CheckForPath())
|
||||
return;
|
||||
|
||||
if (PathIsBlockedByVehicle() && !IsMechanicHeadingToFixRideBlockingPath())
|
||||
return;
|
||||
|
||||
uint8_t pathingResult;
|
||||
TileElement* rideEntranceExitElement;
|
||||
PerformNextAction(pathingResult, rideEntranceExitElement);
|
||||
|
@ -1760,6 +1774,9 @@ void Staff::UpdatePatrolling()
|
|||
if (!CheckForPath())
|
||||
return;
|
||||
|
||||
if (PathIsBlockedByVehicle() && !IsMechanicHeadingToFixRideBlockingPath())
|
||||
return;
|
||||
|
||||
uint8_t pathingResult;
|
||||
PerformNextAction(pathingResult);
|
||||
if (!(pathingResult & PATHING_DESTINATION_REACHED))
|
||||
|
|
|
@ -94,6 +94,7 @@ private:
|
|||
bool DoMechanicPathFinding();
|
||||
bool DoEntertainerPathFinding();
|
||||
bool DoMiscPathFinding();
|
||||
bool IsMechanicHeadingToFixRideBlockingPath();
|
||||
|
||||
Direction HandymanDirectionRandSurface(uint8_t validDirections) const;
|
||||
|
||||
|
|
|
@ -42,7 +42,7 @@
|
|||
// This string specifies which version of network stream current build uses.
|
||||
// It is used for making sure only compatible builds get connected, even within
|
||||
// single OpenRCT2 version.
|
||||
#define NETWORK_STREAM_VERSION "16"
|
||||
#define NETWORK_STREAM_VERSION "17"
|
||||
#define NETWORK_STREAM_ID OPENRCT2_VERSION "-" NETWORK_STREAM_VERSION
|
||||
|
||||
static Peep* _pickup_peep = nullptr;
|
||||
|
|
Loading…
Reference in New Issue