-
Notifications
You must be signed in to change notification settings - Fork 154
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[PORT] clawling - Space-Cats #966
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change | ||||||||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
@@ -0,0 +1,33 @@ | ||||||||||||||||||||||||||
using Content.Client.SubFloor; | ||||||||||||||||||||||||||
using Content.Shared.VentCraw; | ||||||||||||||||||||||||||
using Robust.Client.Player; | ||||||||||||||||||||||||||
using Robust.Shared.Timing; | ||||||||||||||||||||||||||
|
||||||||||||||||||||||||||
namespace Content.Client.VentCraw; | ||||||||||||||||||||||||||
|
||||||||||||||||||||||||||
public sealed class VentCrawSystem : EntitySystem | ||||||||||||||||||||||||||
{ | ||||||||||||||||||||||||||
[Dependency] private readonly IGameTiming _timing = default!; | ||||||||||||||||||||||||||
[Dependency] private readonly IPlayerManager _player = default!; | ||||||||||||||||||||||||||
[Dependency] private readonly SubFloorHideSystem _subFloorHideSystem = default!; | ||||||||||||||||||||||||||
|
||||||||||||||||||||||||||
public override void Update(float frameTime) | ||||||||||||||||||||||||||
{ | ||||||||||||||||||||||||||
base.Update(frameTime); | ||||||||||||||||||||||||||
|
||||||||||||||||||||||||||
if (!_timing.IsFirstTimePredicted) | ||||||||||||||||||||||||||
return; | ||||||||||||||||||||||||||
|
||||||||||||||||||||||||||
var player = _player.LocalPlayer?.ControlledEntity; | ||||||||||||||||||||||||||
|
||||||||||||||||||||||||||
var ventCraslerQuery = GetEntityQuery<VentCrawlerComponent>(); | ||||||||||||||||||||||||||
|
||||||||||||||||||||||||||
if (!ventCraslerQuery.TryGetComponent(player, out var playerVentCrawlerComponent)) | ||||||||||||||||||||||||||
Comment on lines
+23
to
+25
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Исправьте опечатку в имени переменной Переменная Примените следующий дифф для исправления: - var ventCraslerQuery = GetEntityQuery<VentCrawlerComponent>();
+ var ventCrawlerQuery = GetEntityQuery<VentCrawlerComponent>(); 📝 Committable suggestion
Suggested change
Suggested change
|
||||||||||||||||||||||||||
{ | ||||||||||||||||||||||||||
_subFloorHideSystem.ShowVentPipe = false; | ||||||||||||||||||||||||||
return; | ||||||||||||||||||||||||||
} | ||||||||||||||||||||||||||
|
||||||||||||||||||||||||||
_subFloorHideSystem.ShowVentPipe = playerVentCrawlerComponent.InTube; | ||||||||||||||||||||||||||
} | ||||||||||||||||||||||||||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,106 @@ | ||
using Content.Server.Ghost; | ||
using Content.Server.Atmos.EntitySystems; | ||
using Content.Server.Body.Systems; | ||
using Content.Server.NodeContainer; | ||
using Content.Server.NodeContainer.EntitySystems; | ||
using Content.Server.NodeContainer.Nodes; | ||
using Content.Shared.Mind; | ||
using Content.Shared.Mobs; | ||
using Content.Shared.VentCraw.Components; | ||
using Robust.Shared.Player; | ||
|
||
namespace Content.Server.VentCraw; | ||
|
||
public sealed class BeingVentCrawSystem : EntitySystem | ||
{ | ||
[Dependency] private readonly NodeContainerSystem _nodeContainer = default!; | ||
[Dependency] private readonly IEntityManager _entities = default!; | ||
|
||
public override void Initialize() | ||
{ | ||
base.Initialize(); | ||
|
||
SubscribeLocalEvent<BeingVentCrawComponent, InhaleLocationEvent>(OnInhaleLocation); | ||
SubscribeLocalEvent<BeingVentCrawComponent, ExhaleLocationEvent>(OnExhaleLocation); | ||
SubscribeLocalEvent<BeingVentCrawComponent, AtmosExposedGetAirEvent>(OnGetAir); | ||
SubscribeLocalEvent<BeingVentCrawComponent, MobStateChangedEvent>(OnMobStateChanged); | ||
} | ||
|
||
private void OnMobStateChanged(EntityUid uid, BeingVentCrawComponent component, MobStateChangedEvent args) | ||
{ | ||
if (args.NewMobState != MobState.Dead || args.OldMobState != MobState.Critical) | ||
return; | ||
|
||
if (TryComp<ActorComponent>(uid, out var actor)) | ||
{ | ||
var session = actor.PlayerSession; | ||
|
||
var minds = _entities.System<SharedMindSystem>(); | ||
if (!minds.TryGetMind(session, out var mindId, out var mind)) | ||
{ | ||
mindId = minds.CreateMind(session.UserId); | ||
mind = _entities.GetComponent<MindComponent>(mindId); | ||
} | ||
|
||
_entities.System<GhostSystem>().OnGhostAttempt(mindId, true, true, mind); | ||
} | ||
} | ||
|
||
private void OnGetAir(EntityUid uid, BeingVentCrawComponent component, ref AtmosExposedGetAirEvent args) | ||
{ | ||
if (!TryComp<VentCrawHolderComponent>(component.Holder, out var holder)) | ||
return; | ||
|
||
if (holder.CurrentTube == null) | ||
return; | ||
|
||
if (!TryComp(holder.CurrentTube.Value, out NodeContainerComponent? nodeContainer)) | ||
return; | ||
foreach (var nodeContainerNode in nodeContainer.Nodes) | ||
{ | ||
if (!_nodeContainer.TryGetNode(nodeContainer, nodeContainerNode.Key, out PipeNode? pipe)) | ||
continue; | ||
args.Gas = pipe.Air; | ||
args.Handled = true; | ||
return; | ||
} | ||
} | ||
|
||
private void OnInhaleLocation(EntityUid uid, BeingVentCrawComponent component, InhaleLocationEvent args) | ||
{ | ||
if (!TryComp<VentCrawHolderComponent>(component.Holder, out var holder)) | ||
return; | ||
|
||
if (holder.CurrentTube == null) | ||
return; | ||
|
||
if (!TryComp(holder.CurrentTube.Value, out NodeContainerComponent? nodeContainer)) | ||
return; | ||
foreach (var nodeContainerNode in nodeContainer.Nodes) | ||
{ | ||
if (!_nodeContainer.TryGetNode(nodeContainer, nodeContainerNode.Key, out PipeNode? pipe)) | ||
continue; | ||
args.Gas = pipe.Air; | ||
return; | ||
} | ||
} | ||
|
||
private void OnExhaleLocation(EntityUid uid, BeingVentCrawComponent component, ExhaleLocationEvent args) | ||
{ | ||
if (!TryComp<VentCrawHolderComponent>(component.Holder, out var holder)) | ||
return; | ||
|
||
if (holder.CurrentTube == null) | ||
return; | ||
|
||
if (!TryComp(holder.CurrentTube.Value, out NodeContainerComponent? nodeContainer)) | ||
return; | ||
foreach (var nodeContainerNode in nodeContainer.Nodes) | ||
{ | ||
if (!_nodeContainer.TryGetNode(nodeContainer, nodeContainerNode.Key, out PipeNode? pipe)) | ||
continue; | ||
args.Gas = pipe.Air; | ||
return; | ||
} | ||
} | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
using Content.Shared.Clothing; | ||
using Content.Shared.VentCraw.Components; | ||
using Content.Shared.VentCraw; | ||
|
||
namespace Content.Server.VentCraw; | ||
|
||
public sealed class VentCrawClothingSystem : EntitySystem | ||
{ | ||
public override void Initialize() | ||
{ | ||
base.Initialize(); | ||
|
||
SubscribeLocalEvent<VentCrawClothingComponent, ClothingGotEquippedEvent>(OnClothingEquip); | ||
SubscribeLocalEvent<VentCrawClothingComponent, ClothingGotUnequippedEvent>(OnClothingUnequip); | ||
} | ||
|
||
private void OnClothingEquip(Entity<VentCrawClothingComponent> ent, ref ClothingGotEquippedEvent args) | ||
{ | ||
AddComp<VentCrawlerComponent>(args.Wearer); | ||
} | ||
|
||
private void OnClothingUnequip(Entity<VentCrawClothingComponent> ent, ref ClothingGotUnequippedEvent args) | ||
{ | ||
RemComp<VentCrawlerComponent>(args.Wearer); | ||
} | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Исправьте опечатку в названии переменной
ventCraslerQuery
На строке 23 переменная названа
ventCraslerQuery
, вероятно, имеется опечатка. Следует использоватьventCrawlerQuery
для согласованности и предотвращения ошибок.Примените этот дифф для исправления названия переменной:
📝 Committable suggestion