Skip to content
Open
Show file tree
Hide file tree
Changes from 5 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 6 additions & 5 deletions Content.Client/Shuttles/UI/ShuttleConsoleWindow.xaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -182,17 +182,18 @@ public enum ShuttleConsoleMode : byte

public void UpdateState(EntityUid owner, ShuttleBoundUserInterfaceState cState)
{
var coordinates = _entManager.GetCoordinates(cState.NavState.Coordinates);
NavContainer.SetShuttle(coordinates?.EntityId);
//var coordinates = _entManager.GetCoordinates(cState.NavState.Coordinates); // Lua
var shuttle = _entManager.GetEntity(cState.Shuttle); // Lua
NavContainer.SetShuttle(shuttle); // Lua
NavContainer.SetConsole(owner);
MapContainer.SetShuttle(coordinates?.EntityId);
MapContainer.SetShuttle(shuttle); // Lua
MapContainer.SetConsole(owner);
StarMapContainer.SetShuttle(coordinates?.EntityId);
StarMapContainer.SetShuttle(shuttle); // Lua
StarMapContainer.SetConsole(owner);

NavContainer.UpdateState(cState.NavState);
MapContainer.UpdateState(cState.MapState);
StarMapContainer.UpdateState(cState.StarMapState);
DockContainer.UpdateState(coordinates?.EntityId, cState.DockState);
DockContainer.UpdateState(shuttle, cState.DockState);
}
}
123 changes: 120 additions & 3 deletions Content.Server/Shuttles/Systems/ShuttleConsoleSystem.cs
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,10 @@
using Content.Server.Shuttles.Components;
using Content.Server.Shuttles.Events;
using Content.Server.Station.Systems;
using Content.Server.PowerCell; // Lua
using Content.Server.Power.Components; // Lua
using Content.Shared.Containers.ItemSlots; // Lua
using Content.Shared._Lua.Tools.Components; // Lua
using Content.Shared._Lua.Starmap;
using Content.Shared._NF.Shipyard.Components;
using Content.Shared._NF.Shuttles.Events; // Frontier
Expand Down Expand Up @@ -55,6 +59,10 @@ public sealed partial class ShuttleConsoleSystem : SharedShuttleConsoleSystem
[Dependency] private readonly IConfigurationManager _cfg = default!; // Lua
[Dependency] private readonly ILogManager _log = default!;
[Dependency] private readonly CrewedShuttleSystem _crewedShuttle = default!;
[Dependency] private readonly PowerCellSystem _cell = default!; // Lua
[Dependency] private readonly ItemSlotsSystem _slots = default!; // Lua

private const string StructureTag = "Structure"; // Lua

private ISawmill _sawmill = default!;

Expand Down Expand Up @@ -136,6 +144,13 @@ private void OnStarMapVisibilityMessage(EntityUid uid, ShuttleConsoleComponent c

private void OnConsoleGetVerbs(EntityUid uid, ShuttleConsoleComponent comp, GetVerbsEvent<AlternativeVerb> args)
{
// Lua start
if (HasComp<ShuttleTabletComponent>(uid))
{
return;
}
// Lua end

AddPanicButtonVerb(uid, comp, args);
AddPreventRemoverVerb(uid, comp, args);
}
Expand Down Expand Up @@ -255,12 +270,43 @@ private bool TryPilot(EntityUid user, EntityUid uid)
if (!_tags.HasTag(user, CanPilotTag) ||
!TryComp<ShuttleConsoleComponent>(uid, out var component) ||
!this.IsPowered(uid, EntityManager) ||
!Transform(uid).Anchored ||
//!Transform(uid).Anchored || // Lua
!_blocker.CanInteract(user, uid))
{
return false;
}

// Lua start
if (_tags.HasTag(uid, StructureTag)
&& !Transform(uid).Anchored)
{
return false;
}

if (!_cell.TryUseActivatableCharge(uid))
{
return false;
}

if (TryComp<ShuttleTabletComponent>(uid, out var shuttleTabletComp))
{
var card = _slots.GetItemOrNull(uid, "id_container");

if (card == null)
{
_popup.PopupEntity(Loc.GetString("shuttle-tablet-no-id"), uid);
return false;
}

if (!TryComp<ShuttleDeedComponent>(card, out var deedComp)
|| deedComp == null)
{
_popup.PopupEntity(Loc.GetString("shuttle-tablet-no-deed"), uid);
return false;
}
}
// Lua end

if (!_access.IsAllowed(user, uid)) // Frontier: check access
return false; // Frontier

Expand Down Expand Up @@ -436,6 +482,33 @@ private void UpdateState(EntityUid consoleUid, ref DockingInterfaceState? dockSt
{
EntityUid? entity = consoleUid;

// Lua start
if (_cell.HasActivatableCharge(consoleUid)
&& !_cell.HasDrawCharge(consoleUid))
{
_ui.CloseUi(consoleUid, ShuttleConsoleUiKey.Key);
return;
}

if (TryComp<ShuttleTabletComponent>(consoleUid, out var shuttleTabletComp))
{
var card = _slots.GetItemOrNull(consoleUid, "id_container");

if (card == null)
{
_popup.PopupEntity(Loc.GetString("shuttle-tablet-no-id"), consoleUid);
return;
}

if (!TryComp<ShuttleDeedComponent>(card, out var deedComp)
|| deedComp == null)
{
_popup.PopupEntity(Loc.GetString("shuttle-tablet-no-deed"), consoleUid);
return;
}
}
// Lua end

var getShuttleEv = new ConsoleShuttleEvent
{
Console = entity,
Expand Down Expand Up @@ -470,7 +543,7 @@ private void UpdateState(EntityUid consoleUid, ref DockingInterfaceState? dockSt
{
var currentMap = consoleXform?.MapID ?? MapId.Nullspace;
var starMapState = GetStarMapState(currentMap, shuttleGridUid, consoleUid);
_ui.SetUiState(consoleUid, ShuttleConsoleUiKey.Key, new ShuttleBoundUserInterfaceState(navState, mapState, dockState, starMapState));
_ui.SetUiState(consoleUid, ShuttleConsoleUiKey.Key, new ShuttleBoundUserInterfaceState(navState, mapState, dockState, starMapState, GetNetEntity(shuttleGridUid))); // Lua
}
}

Expand Down Expand Up @@ -527,6 +600,8 @@ public void AddPilot(EntityUid uid, EntityUid entity, ShuttleConsoleComponent co
ActionBlockerSystem.UpdateCanMove(entity);
pilotComponent.Position = Comp<TransformComponent>(entity).Coordinates;
Dirty(entity, pilotComponent);
DockingInterfaceState? dockState = null; // Lua
UpdateState(uid, ref dockState); // Lua
}

public void RemovePilot(EntityUid pilotUid, PilotComponent pilotComponent)
Expand Down Expand Up @@ -584,10 +659,52 @@ public NavInterfaceState GetNavState(Entity<RadarConsoleComponent?, TransformCom
portNames = consoleComp.PortNames;
}

// Lua start
var coordinates = entity.Comp2.Coordinates;

if (TryComp<ShuttleTabletComponent>(entity.Owner, out _))
{
var consoleQuery = EntityQueryEnumerator<ShuttleConsoleComponent, TransformComponent, ApcPowerReceiverComponent>();
var consoleFound = false;

while (consoleQuery.MoveNext(out var consoleUid, out _, out var consoleTransform, out var receiverComp))
{
if (consoleTransform.GridUid == entity.Comp2.GridUid && receiverComp.Powered)
{
consoleFound = true;

if (!TryComp<ShuttleConsoleLockComponent>(consoleUid, out var lockComp)
|| !lockComp.EmergencyLocked)
{
coordinates = consoleTransform.Coordinates;
break;
}

if (consoleComp != null)
{
ClearPilots(consoleComp);
}

_popup.PopupEntity(Loc.GetString("shuttle-tablet-emergency-locked"), entity);
}
}

if (!consoleFound)
{
if (consoleComp != null)
{
ClearPilots(consoleComp);
}

_popup.PopupEntity(Loc.GetString("shuttle-tablet-no-remote-console"), entity);
}
}
// Lua end

return GetNavState(
entity,
docks,
entity.Comp2.Coordinates,
coordinates, // Lua
entity.Comp2.LocalRotation,
portNames);
}
Expand Down
43 changes: 43 additions & 0 deletions Content.Server/_Lua/Tools/Systems/ShuttleTabletSystem.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
// LuaWorld - This file is licensed under AGPLv3
// Copyright (c) 2026 LuaWorld Contributors
// See AGPLv3.txt for details.

using Robust.Server.GameObjects;
using Content.Shared.Containers.ItemSlots;
using Content.Shared._Lua.Tools.Components;
using Content.Shared._NF.Shipyard.Components;

namespace Content.Server._Lua.Tools.Systems;

public sealed class ShuttleTabletSystem : EntitySystem
{
[Dependency] private readonly TransformSystem _transformSystem = default!;
[Dependency] private readonly ItemSlotsSystem _slots = default!;

public override void Initialize()
{
base.Initialize();
}

public override void Update(float frameTime)
{
var query = EntityQueryEnumerator<ShuttleTabletComponent, TransformComponent>();

while (query.MoveNext(out var entity, out _, out var transformComp))
{
var card = _slots.GetItemOrNull(entity, "id_container");

if (card == null)
{
continue;
}

if (!TryComp<ShuttleDeedComponent>(card, out var deedComp))
{
continue;
}

_transformSystem.SetGridId(entity, transformComp, deedComp.ShuttleUid);
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -11,12 +11,20 @@ public sealed class ShuttleBoundUserInterfaceState : BoundUserInterfaceState
public ShuttleMapInterfaceState MapState;
public DockingInterfaceState DockState;
public StarmapConsoleBoundUserInterfaceState StarMapState;
public NetEntity? Shuttle; // Lua

public ShuttleBoundUserInterfaceState(NavInterfaceState navState, ShuttleMapInterfaceState mapState, DockingInterfaceState dockState, StarmapConsoleBoundUserInterfaceState starMapState)
public ShuttleBoundUserInterfaceState(
NavInterfaceState navState,
ShuttleMapInterfaceState mapState,
DockingInterfaceState dockState,
StarmapConsoleBoundUserInterfaceState starMapState,
NetEntity? shuttle // Lua
)
{
NavState = navState;
MapState = mapState;
DockState = dockState;
StarMapState = starMapState;
Shuttle = shuttle; // Lua
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
// LuaWorld - This file is licensed under AGPLv3
// Copyright (c) 2026 LuaWorld Contributors
// See AGPLv3.txt for details.

namespace Content.Shared._Lua.Tools.Components;

[RegisterComponent]
public sealed partial class ShuttleTabletComponent : Component;
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
ent-ShuttleControlTablet = планшет управления шаттлом
.desc = Портативный планшет для удалённого управления шаттлом. Имеет слот под ID карту. Для функционирования на шаттле должна находится хотя бы одна запитанная консоль.

ent-ShuttleControlTabletEmpty = {ent-ShuttleControlTablet}
.desc = {ent-ShuttleControlTablet.desc}
.suffix = Без батареи

ent-ShuttleControlTabletMicroreactor = {ent-ShuttleControlTablet}
.desc = {ent-ShuttleControlTablet.desc}
.suffix = Микрореакторная батарея

ent-ShuttleControlTabletSalvage = {ent-ShuttleControlTablet}
.desc = {ent-ShuttleControlTablet.desc}
.suffix = Утилизаторский

ent-ShuttleControlTabletSecurity = {ent-ShuttleControlTablet}
.desc = {ent-ShuttleControlTablet.desc}
.suffix = Служба безопасности

ent-ShuttleControlTabletSyndicate = {ent-ShuttleControlTablet}
.desc = {ent-ShuttleControlTablet.desc}
.suffix = Синдикат

shuttle-tablet-id-slot = Слот ID карты

shuttle-tablet-no-remote-console = На шаттле не найдена запитанная консоль.
shuttle-tablet-no-id = Вставьте ID карту.
shuttle-tablet-no-deed = На карте должен быть судовой акт на шаттл.
shuttle-tablet-no-power = Недостаточно питания.
shuttle-tablet-emergency-locked = Консоль аварийно заблокирована.
Loading
Loading