Fix vehicle comments (#7777)

This commit is contained in:
metalgearsloth
2022-04-26 02:08:24 +10:00
committed by GitHub
parent 7678ea6a31
commit 819f4b30e5

View File

@@ -70,29 +70,29 @@ namespace Content.Server.Vehicle
{ {
if (args.Buckling) if (args.Buckling)
{ {
/// Add a virtual item to rider's hand, unbuckle if we can't. // Add a virtual item to rider's hand, unbuckle if we can't.
if (!_virtualItemSystem.TrySpawnVirtualItemInHand(uid, args.BuckledEntity)) if (!_virtualItemSystem.TrySpawnVirtualItemInHand(uid, args.BuckledEntity))
{ {
_riderSystem.UnbuckleFromVehicle(args.BuckledEntity); _riderSystem.UnbuckleFromVehicle(args.BuckledEntity);
return; return;
} }
/// Set up the rider and vehicle with each other // Set up the rider and vehicle with each other
EnsureComp<SharedPlayerInputMoverComponent>(uid); EnsureComp<SharedPlayerInputMoverComponent>(uid);
var rider = EnsureComp<RiderComponent>(args.BuckledEntity); var rider = EnsureComp<RiderComponent>(args.BuckledEntity);
component.Rider = args.BuckledEntity; component.Rider = args.BuckledEntity;
rider.Vehicle = component; rider.Vehicle = component;
component.HasRider = true; component.HasRider = true;
/// Handle pulling // Handle pulling
RemComp<SharedPullableComponent>(args.BuckledEntity); RemComp<SharedPullableComponent>(args.BuckledEntity);
RemComp<SharedPullableComponent>(uid); RemComp<SharedPullableComponent>(uid);
/// Let this open doors if it has the key in it // Let this open doors if it has the key in it
if (component.HasKey) if (component.HasKey)
{ {
_tagSystem.AddTag(uid, "DoorBumpOpener"); _tagSystem.AddTag(uid, "DoorBumpOpener");
} }
/// Update appearance stuff, add actions // Update appearance stuff, add actions
UpdateBuckleOffset(Transform(uid), component); UpdateBuckleOffset(Transform(uid), component);
UpdateDrawDepth(uid, GetDrawDepth(Transform(uid), component.NorthOnly)); UpdateDrawDepth(uid, GetDrawDepth(Transform(uid), component.NorthOnly));
if (TryComp<ActionsComponent>(args.BuckledEntity, out var actions) && TryComp<UnpoweredFlashlightComponent>(uid, out var flashlight)) if (TryComp<ActionsComponent>(args.BuckledEntity, out var actions) && TryComp<UnpoweredFlashlightComponent>(uid, out var flashlight))
@@ -113,9 +113,9 @@ namespace Content.Server.Vehicle
_tagSystem.RemoveTag(uid, "DoorBumpOpener"); _tagSystem.RemoveTag(uid, "DoorBumpOpener");
EnsureComp<SharedPullableComponent>(args.BuckledEntity); EnsureComp<SharedPullableComponent>(args.BuckledEntity);
EnsureComp<SharedPullableComponent>(uid); EnsureComp<SharedPullableComponent>(uid);
/// Entity is no longer riding // Entity is no longer riding
RemComp<RiderComponent>(args.BuckledEntity); RemComp<RiderComponent>(args.BuckledEntity);
/// Reset component // Reset component
component.HasRider = false; component.HasRider = false;
component.Rider = null; component.Rider = null;
_itemSlotsSystem.SetLock(uid, component.Name, false); _itemSlotsSystem.SetLock(uid, component.Name, false);
@@ -128,13 +128,13 @@ namespace Content.Server.Vehicle
/// </summary> /// </summary>
private void OnMove(EntityUid uid, VehicleComponent component, ref MoveEvent args) private void OnMove(EntityUid uid, VehicleComponent component, ref MoveEvent args)
{ {
/// This first check is just for safety // This first check is just for safety
if (!HasComp<SharedPlayerInputMoverComponent>(uid)) if (!HasComp<SharedPlayerInputMoverComponent>(uid))
{ {
UpdateAutoAnimate(uid, false); UpdateAutoAnimate(uid, false);
return; return;
} }
/// The random check means the vehicle will stop after a few tiles without a key or without a rider // The random check means the vehicle will stop after a few tiles without a key or without a rider
if ((!component.HasRider || !component.HasKey) && _random.Prob(0.015f)) if ((!component.HasRider || !component.HasKey) && _random.Prob(0.015f))
{ {
RemComp<SharedPlayerInputMoverComponent>(uid); RemComp<SharedPlayerInputMoverComponent>(uid);
@@ -155,16 +155,16 @@ namespace Content.Server.Vehicle
if (_tagSystem.HasTag(args.Entity, "VehicleKey")) if (_tagSystem.HasTag(args.Entity, "VehicleKey"))
{ {
/// Return if the slot is not the key slot // Return if the slot is not the key slot
/// That slot ID should be inherited from basevehicle in the .yml // That slot ID should be inherited from basevehicle in the .yml
if (args.Container.ID != "key_slot") if (args.Container.ID != "key_slot")
{ {
return; return;
} }
/// This lets the vehicle move // This lets the vehicle move
EnsureComp<SharedPlayerInputMoverComponent>(uid); EnsureComp<SharedPlayerInputMoverComponent>(uid);
/// This lets the vehicle open doors // This lets the vehicle open doors
if (component.HasRider) if (component.HasRider)
_tagSystem.AddTag(uid, "DoorBumpOpener"); _tagSystem.AddTag(uid, "DoorBumpOpener");
@@ -238,6 +238,7 @@ namespace Content.Server.Vehicle
} }
} }
/// <summary> /// <summary>
/// Set the draw depth for the sprite. /// Set the draw depth for the sprite.
/// </summary> /// </summary>
@@ -251,7 +252,7 @@ namespace Content.Server.Vehicle
/// <summary> /// <summary>
/// Set whether the vehicle's base layer is animating or not. /// Set whether the vehicle's base layer is animating or not.
/// </summmary> /// </summary>
private void UpdateAutoAnimate(EntityUid uid, bool autoAnimate) private void UpdateAutoAnimate(EntityUid uid, bool autoAnimate)
{ {
if (!TryComp<AppearanceComponent>(uid, out var appearance)) if (!TryComp<AppearanceComponent>(uid, out var appearance))