-
Notifications
You must be signed in to change notification settings - Fork 122
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
16 changed files
with
401 additions
and
22 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
using Content.Shared.Vehicle; | ||
using Robust.Client.GameObjects; | ||
using Robust.Shared.GameObjects; | ||
using Robust.Shared.IoC; | ||
|
||
namespace Content.Client.Vehicle | ||
{ | ||
public sealed class ClientVehicleSystem : EntitySystem | ||
{ | ||
[Dependency] private readonly IEntityManager _entityManager = default!; | ||
|
||
public override void Initialize() | ||
{ | ||
base.Initialize(); | ||
SubscribeLocalEvent<RiddenVehicleComponent, ComponentHandleState>(OnHandleState); | ||
} | ||
|
||
private void OnHandleState(EntityUid uid, RiddenVehicleComponent component, ref ComponentHandleState args) | ||
{ | ||
if (args.Current is not RiddenVehicleComponentState state) | ||
return; | ||
|
||
component.Riders.Clear(); | ||
component.Riders.AddRange(state.Riders); | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,19 +1,26 @@ | ||
// /Content.Server/Vehicles/Components/VehicleComponent.cs | ||
using Robust.Shared.GameObjects; | ||
using Robust.Shared.Serialization.Manager.Attributes; | ||
|
||
namespace Content.Server.Vehicles.Components | ||
namespace Content.Shared.Vehicle | ||
{ | ||
[RegisterComponent] | ||
public sealed class VehicleComponent : Component | ||
{ | ||
public override string Name => "Vehicle"; | ||
|
||
[DataField("maxOccupants")] | ||
public int MaxOccupants { get; set; } = 4; | ||
public int MaxOccupants = 1; | ||
|
||
[DataField("maxDrivers")] | ||
public int MaxDrivers { get; set; } = 1; | ||
public int MaxDrivers = 1; | ||
|
||
[DataField("canMove")] | ||
public bool CanMove = true; | ||
|
||
[DataField("keyType")] | ||
public string? KeyType; | ||
|
||
public List<EntityUid> Occupants { get; set; } = new(); | ||
public EntityUid? Driver { get; set; } | ||
[ViewVariables] | ||
public List<EntityUid> Occupants = new(); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
using Robust.Shared.GameObjects; | ||
using Robust.Shared.Serialization.Manager.Attributes; | ||
|
||
namespace Content.Shared.Key | ||
{ | ||
[RegisterComponent] | ||
public partial class KeyComponent : Component | ||
{ | ||
public override string Name => "Key"; | ||
|
||
[DataField("keyId")] | ||
public string KeyId = string.Empty; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
using Robust.Shared.GameObjects; | ||
using Robust.Shared.Serialization.Manager.Attributes; | ||
|
||
namespace Content.Shared.Key | ||
{ | ||
[RegisterComponent] | ||
public partial class KeyRequiredComponent : Component | ||
{ | ||
public override string Name => "KeyRequired"; | ||
|
||
[DataField("requiredKeyId")] | ||
public string RequiredKeyId = string.Empty; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
using Robust.Shared.GameObjects; | ||
using Robust.Shared.IoC; | ||
|
||
namespace Content.Shared.Key | ||
{ | ||
public sealed class KeySystem : EntitySystem | ||
{ | ||
public override void Initialize() | ||
{ | ||
base.Initialize(); | ||
SubscribeLocalEvent<KeyRequiredComponent, ComponentStartup>(OnKeyRequiredStartup); | ||
} | ||
|
||
private void OnKeyRequiredStartup(EntityUid uid, KeyRequiredComponent component, ComponentStartup args) | ||
{ | ||
// Logic to handle key requirements | ||
} | ||
|
||
public bool HasValidKey(EntityUid uid, string requiredKeyId) | ||
{ | ||
if (EntityManager.TryGetComponent(uid, out KeyComponent? keyComp)) | ||
{ | ||
return keyComp.KeyId == requiredKeyId; | ||
} | ||
return false; | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
using Robust.Shared.GameObjects; | ||
using Robust.Shared.Serialization.Manager.Attributes; | ||
using Robust.Shared.ViewVariables; | ||
|
||
namespace Content.Shared.Vehicle | ||
{ | ||
[RegisterComponent] | ||
public sealed class KeyRequiredComponent : Component | ||
{ | ||
public override string Name => "KeyRequired"; | ||
|
||
[DataField("keyType")] | ||
public string KeyType = string.Empty; | ||
|
||
[ViewVariables] | ||
public EntityUid? InsertedKey; | ||
} | ||
} |
18 changes: 18 additions & 0 deletions
18
Content.Shared/Vehicles/Components/RiddenVehicleComponent.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
using Robust.Shared.GameObjects; | ||
using Robust.Shared.Serialization.Manager.Attributes; | ||
using Robust.Shared.ViewVariables; | ||
|
||
namespace Content.Shared.Vehicle | ||
{ | ||
[RegisterComponent] | ||
public partial class RiddenVehicleComponent : Component | ||
{ | ||
public override string Name => "RiddenVehicle"; | ||
|
||
[DataField("maxRiders")] | ||
public int MaxRiders = 1; | ||
|
||
[ViewVariables] | ||
public List<EntityUid> Riders = new(); | ||
} | ||
} |
Oops, something went wrong.