Skip to content

Commit

Permalink
Merge branch 'master' into 2024-06-Wizard-NPCs-Rework
Browse files Browse the repository at this point in the history
  • Loading branch information
ErhardSteinhauer authored Sep 6, 2024
2 parents 29f5ead + 17781a9 commit 7eab6b3
Show file tree
Hide file tree
Showing 206 changed files with 16,425 additions and 4,616 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ protected override void Open()
Index = index,
});
};
_window.FinishMission += () => SendMessage(new FinishSalvageMessage()); // Frontier
_window.OnClose += Close;
_window?.OpenCenteredLeft();
}
Expand Down
3 changes: 3 additions & 0 deletions Content.Client/Salvage/UI/SalvageExpeditionWindow.xaml
Original file line number Diff line number Diff line change
Expand Up @@ -19,5 +19,8 @@
<BoxContainer Name="Container"
Orientation="Horizontal"
Margin="5 0 5 0"/>
<Button Name="Finish"
Text="{Loc 'salvage-expedition-window-finish'}"
HorizontalAlignment="Right"/>
</BoxContainer>
</controls:FancyWindow>
11 changes: 11 additions & 0 deletions Content.Client/Salvage/UI/SalvageExpeditionWindow.xaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ public sealed partial class SalvageExpeditionWindow : FancyWindow,
private readonly SharedSalvageSystem _salvage;

public event Action<ushort>? ClaimMission;
public event Action? FinishMission; // Frontier
private bool _claimed;
private bool _cooldown;
private TimeSpan _nextOffer;
Expand Down Expand Up @@ -266,6 +267,16 @@ public void UpdateState(SalvageExpeditionConsoleState state)

Container.AddChild(box);
}

// Frontier
Finish.OnPressed += _ =>
{
Finish.Disabled = true;
FinishMission?.Invoke();
};

Finish.Disabled = !state.CanFinish;
// Frontier
}

protected override void FrameUpdate(FrameEventArgs args)
Expand Down
2 changes: 1 addition & 1 deletion Content.Client/Shuttles/UI/ShuttleDockControl.xaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -272,7 +272,7 @@ protected override void Draw(DrawingHandleScreen handle)
var canDock = distance < SharedDockingSystem.DockRange && inAlignment;

if (dockButton != null)
dockButton.Disabled = !canDock || !canDockChange;
dockButton.Disabled = !canDock && dock.GridDockedWith == null || !canDockChange; // Frontier: add "&& dock.GridDockedWith == null"

var lineColor = inAlignment ? Color.Lime : Color.Red;
handle.DrawDottedLine(viewedDockPos.Value, collisionCenter, lineColor, offset: lineOffset);
Expand Down
2 changes: 1 addition & 1 deletion Content.Client/StatusIcon/StatusIconOverlay.cs
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ protected override void Draw(in OverlayDrawArgs args)

var countL = 0;
var countR = 0;
var accOffsetL = 0;
var accOffsetL = 8; // Frontier: 0<8 - do not overlap the speech bubble
var accOffsetR = 0;
icons.Sort();

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
using Content.Client.UserInterface.Systems.Gameplay;
using Content.Client.UserInterface.Systems.Ghost.Widgets;
using Content.Shared.CCVar;
using Content.Shared.NF14.CCVar;
using Content.Shared._NF.CCVar; // Frontier
using Content.Shared.Ghost;
using Robust.Client.Console;
using Robust.Client.UserInterface;
Expand Down Expand Up @@ -76,8 +76,8 @@ public void UpdateGui()
Gui.Visible = _system?.IsGhost ?? false;
Gui.Update(_system?.AvailableGhostRoleCount, _system?.Player?.CanReturnToBody,
_system?.Player?.TimeOfDeath,
_cfg.GetCVar(NF14CVars.RespawnTime),
_canUncryo && _cfg.GetCVar(NF14CVars.CryoReturnEnabled));
_cfg.GetCVar(NFCCVars.RespawnTime), // Frontier
_canUncryo && _cfg.GetCVar(NFCCVars.CryoReturnEnabled)); // Frontier
}

private void UpdateRespawn(TimeSpan? timeOfDeath)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,7 @@
using Robust.Client.UserInterface.XAML;
using Robust.Shared.Timing;
using Robust.Shared.Configuration;
using Content.Shared.CCVar;
using Content.Shared.NF14.CCVar;
using Content.Shared._NF.CCVar; // Frontier

namespace Content.Client.UserInterface.Systems.Ghost.Widgets;

Expand Down Expand Up @@ -58,7 +57,7 @@ public void UpdateRespawn(TimeSpan? todd)
if (todd != null)
{
_timeOfDeath = todd;
_minTimeToRespawn = _configurationManager.GetCVar(NF14CVars.RespawnTime);
_minTimeToRespawn = _configurationManager.GetCVar(NFCCVars.RespawnTime); // Frontier
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -143,7 +143,7 @@ private bool IsHeater(GasThermoMachineComponent comp)

private void OnToggleMessage(EntityUid uid, GasThermoMachineComponent thermoMachine, GasThermomachineToggleMessage args)
{
var powerState = _power.TogglePower(uid);
var powerState = _power.TryTogglePower(uid); // Frontier: Upstream - #28984
_adminLogger.Add(LogType.AtmosPowerChanged, $"{ToPrettyString(args.Actor)} turned {(powerState ? "On" : "Off")} {ToPrettyString(uid)}");
DirtyUI(uid, thermoMachine);
}
Expand Down
2 changes: 1 addition & 1 deletion Content.Server/Atmos/Portable/SpaceHeaterSystem.cs
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,7 @@ private void OnToggle(EntityUid uid, SpaceHeaterComponent spaceHeater, SpaceHeat
if (!Resolve(uid, ref powerReceiver))
return;

_power.TogglePower(uid);
_power.TryTogglePower(uid); // Frontier: Upstream - #28984

UpdateAppearance(uid);
DirtyUI(uid, spaceHeater);
Expand Down
2 changes: 1 addition & 1 deletion Content.Server/Cargo/Systems/CargoSystem.Shuttle.cs
Original file line number Diff line number Diff line change
Expand Up @@ -278,7 +278,7 @@ private bool SellPallets(EntityUid consoleUid, EntityUid gridUid, out double amo
return false;


var ev = new EntitySoldEvent(toSell, gridUid);
var ev = new EntitySoldEvent(toSell, gridUid); // Frontier: add gridUid
RaiseLocalEvent(ref ev);

foreach (var ent in toSell)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -238,7 +238,7 @@ private void OnUiButtonPressed(EntityUid uid, SharedDisposalUnitComponent compon
_adminLogger.Add(LogType.Action, LogImpact.Low, $"{ToPrettyString(player):player} hit flush button on {ToPrettyString(uid)}, it's now {(component.Engaged ? "on" : "off")}");
break;
case SharedDisposalUnitComponent.UiButton.Power:
_power.TogglePower(uid, user: args.Actor);
_power.TryTogglePower(uid, user: args.Actor); // Frontier: Upstream - #28984
break;
default:
throw new ArgumentOutOfRangeException($"{ToPrettyString(player):player} attempted to hit a nonexistant button on {ToPrettyString(uid)}");
Expand Down
48 changes: 28 additions & 20 deletions Content.Server/Emp/EmpSystem.cs
Original file line number Diff line number Diff line change
@@ -1,15 +1,15 @@
using Content.Server.Entry;
using Content.Server.Explosion.EntitySystems;
using Content.Server.Power.Components;
using Content.Server.Power.EntitySystems;
using Content.Server.Radio;
using Content.Server.Station.Components;
using Content.Server.SurveillanceCamera;
using Content.Shared.Emp;
using Content.Shared.Examine;
using Content.Shared.Tiles; // Frontier
using Robust.Server.GameObjects;
using Robust.Shared.Map;
using static Content.Server.Shuttles.Systems.ShuttleConsoleSystem;
using static Content.Server.Shuttles.Systems.ThrusterSystem;

namespace Content.Server.Emp;

Expand All @@ -28,10 +28,8 @@ public override void Initialize()

SubscribeLocalEvent<EmpDisabledComponent, RadioSendAttemptEvent>(OnRadioSendAttempt);
SubscribeLocalEvent<EmpDisabledComponent, RadioReceiveAttemptEvent>(OnRadioReceiveAttempt);
SubscribeLocalEvent<EmpDisabledComponent, ApcToggleMainBreakerAttemptEvent>(OnApcToggleMainBreaker);
SubscribeLocalEvent<EmpDisabledComponent, SurveillanceCameraSetActiveAttemptEvent>(OnCameraSetActive);
//SubscribeLocalEvent<EmpDisabledComponent, ThrusterToggleAttemptEvent>(OnThrusterToggle);
//SubscribeLocalEvent<EmpDisabledComponent, ShuttleToggleAttemptEvent>(OnShuttleConsoleToggle);
//SubscribeLocalEvent<EmpDisabledComponent, ApcToggleMainBreakerAttemptEvent>(OnApcToggleMainBreaker); // Frontier: Upstream - #28984
//SubscribeLocalEvent<EmpDisabledComponent, SurveillanceCameraSetActiveAttemptEvent>(OnCameraSetActive); // Frontier: Upstream - #28984
}

/// <summary>
Expand All @@ -48,7 +46,7 @@ public void EmpPulse(MapCoordinates coordinates, float range, float energyConsum
// Block EMP on grid
var gridUid = Transform(uid).GridUid;
var attemptEv = new EmpAttemptEvent();
if (HasComp<StationEmpImmuneComponent>(gridUid))
if (TryComp<ProtectedGridComponent>(gridUid, out var prot) && prot.PreventEmpEvents)
continue;

TryEmpEffects(uid, energyConsumption, duration);
Expand Down Expand Up @@ -88,8 +86,22 @@ public void DoEmpEffects(EntityUid uid, float energyConsumption, float duration)
}
if (ev.Disabled)
{
// Frontier: Upstream - #28984 start
//disabled.DisabledUntil = Timing.CurTime + TimeSpan.FromSeconds(duration);
var disabled = EnsureComp<EmpDisabledComponent>(uid);
disabled.DisabledUntil = Timing.CurTime + TimeSpan.FromSeconds(duration);
if (disabled.DisabledUntil == TimeSpan.Zero)
{
disabled.DisabledUntil = Timing.CurTime;
}
disabled.DisabledUntil = disabled.DisabledUntil + TimeSpan.FromSeconds(duration);

/// i tried my best to go through the Pow3r server code but i literally couldn't find in relation to PowerNetworkBatteryComponent that uses the event system
/// the code is otherwise too esoteric for my innocent eyes
if (TryComp<PowerNetworkBatteryComponent>(uid, out var powerNetBattery))
{
powerNetBattery.CanCharge = false;
}
// Frontier: Upstream - #28984 end
}
}

Expand All @@ -105,6 +117,11 @@ public override void Update(float frameTime)
RemComp<EmpDisabledComponent>(uid);
var ev = new EmpDisabledRemoved();
RaiseLocalEvent(uid, ref ev);

if (TryComp<PowerNetworkBatteryComponent>(uid, out var powerNetBattery)) // Frontier: Upstream - #28984
{
powerNetBattery.CanCharge = true;
}
}
}
}
Expand All @@ -130,25 +147,16 @@ private void OnRadioReceiveAttempt(EntityUid uid, EmpDisabledComponent component
args.Cancelled = true;
}

private void OnApcToggleMainBreaker(EntityUid uid, EmpDisabledComponent component, ref ApcToggleMainBreakerAttemptEvent args)
{
args.Cancelled = true;
}

private void OnCameraSetActive(EntityUid uid, EmpDisabledComponent component, ref SurveillanceCameraSetActiveAttemptEvent args)
{
args.Cancelled = true;
}

//private void OnThrusterToggle(EntityUid uid, EmpDisabledComponent component, ref ThrusterToggleAttemptEvent args)
//private void OnApcToggleMainBreaker(EntityUid uid, EmpDisabledComponent component, ref ApcToggleMainBreakerAttemptEvent args) // Frontier: Upstream - #28984
//{
// args.Cancelled = true;
//}

//private void OnShuttleConsoleToggle(EntityUid uid, EmpDisabledComponent component, ref ShuttleToggleAttemptEvent args)
//private void OnCameraSetActive(EntityUid uid, EmpDisabledComponent component, ref SurveillanceCameraSetActiveAttemptEvent args) // Frontier: Upstream - #28984
//{
// args.Cancelled = true;
//}

}

/// <summary>
Expand Down
2 changes: 1 addition & 1 deletion Content.Server/Explosion/EntitySystems/ExplosionSystem.cs
Original file line number Diff line number Diff line change
Expand Up @@ -366,7 +366,7 @@ public void QueueExplosion(MapCoordinates epicenter,
var mapGrid = _mapManager.GetGrid(gridId.Value);
var gridUid = mapGrid.Owner;
var ev = new FloorTileAttemptEvent();
if (HasComp<ProtectedGridComponent>(gridUid) || ev.Cancelled)
if ((TryComp<ProtectedGridComponent>(gridUid, out var prot) && prot.PreventExplosions) || ev.Cancelled)
return null;
}
}
Expand Down
25 changes: 25 additions & 0 deletions Content.Server/Gravity/GravityGeneratorSystem.cs
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
using Content.Server.Audio;
using Content.Server.Construction;
using Content.Server.Power.Components;
using Content.Server.Emp; // Frontier: Upstream - #28984
using Content.Shared.Database;
using Content.Shared.Gravity;
using Content.Shared.Interaction;
Expand Down Expand Up @@ -30,6 +31,8 @@ public override void Initialize()
SubscribeLocalEvent<GravityGeneratorComponent, RefreshPartsEvent>(OnRefreshParts);
SubscribeLocalEvent<GravityGeneratorComponent, SharedGravityGeneratorComponent.SwitchGeneratorMessage>(
OnSwitchGenerator);

SubscribeLocalEvent<GravityGeneratorComponent, EmpPulseEvent>(OnEmpPulse); // Frontier: Upstream - #28984
}

private void OnParentChanged(EntityUid uid, GravityGeneratorComponent component, ref EntParentChangedMessage args)
Expand Down Expand Up @@ -294,5 +297,27 @@ private void OnSwitchGenerator(
{
SetSwitchedOn(uid, component, args.On, user: args.Actor);
}

private void OnEmpPulse(EntityUid uid, GravityGeneratorComponent component, EmpPulseEvent args) // Frontier: Upstream - #28984
{
/// i really don't think that the gravity generator should use normalised 0-1 charge
/// as opposed to watts charge that every other battery uses

if (!TryComp<ApcPowerReceiverComponent>(uid, out var powerReceiver))
return;

var ent = (uid, component, powerReceiver);

// convert from normalised energy to watts and subtract
float maxEnergy = component.ActivePowerUse / component.ChargeRate;
float currentEnergy = maxEnergy * component.Charge;
currentEnergy = Math.Max(0, currentEnergy - args.EnergyConsumption);

// apply renormalised energy to charge variable
component.Charge = currentEnergy / maxEnergy;

// update power state
UpdateState(ent);
}
}
}
12 changes: 7 additions & 5 deletions Content.Server/Paper/PaperSystem.cs
Original file line number Diff line number Diff line change
Expand Up @@ -101,14 +101,14 @@ private void OnExamined(EntityUid uid, PaperComponent paperComp, ExaminedEvent a
if (paperComp.StampedBy.Count > 0)
{
// BEGIN FRONTIER MODIFICATION - Make stamps and signatures render separately.
// Separate into stamps and signatures.
// Separate into stamps and signatures, display each name/stamp only once.
var stamps = paperComp.StampedBy.FindAll(s => s.Type == StampType.RubberStamp);
var signatures = paperComp.StampedBy.FindAll(s => s.Type == StampType.Signature);

// If we have stamps, render them.
if (stamps.Count > 0)
{
var joined = string.Join(", ", stamps.Select(s => Loc.GetString(s.StampedName)));
var joined = string.Join(", ", stamps.Select(s => Loc.GetString(s.StampedName)).Distinct());
args.PushMarkup(
Loc.GetString(
"paper-component-examine-detail-stamped-by",
Expand All @@ -121,7 +121,7 @@ private void OnExamined(EntityUid uid, PaperComponent paperComp, ExaminedEvent a
// Ditto for signatures.
if (signatures.Count > 0)
{
var joined = string.Join(", ", signatures.Select(s => s.StampedName));
var joined = string.Join(", ", signatures.Select(s => s.StampedName).Distinct());
args.PushMarkup(
Loc.GetString(
"paper-component-examine-detail-signed-by",
Expand Down Expand Up @@ -169,8 +169,10 @@ private void OnInteractUsing(EntityUid uid, PaperComponent paperComp, InteractUs
{
var stampInfo = GetStampInfo(stampComp); // Frontier: assign DisplayStampInfo before stamp
if (_tagSystem.HasTag(args.Used, "Write"))
stampInfo.Type = StampType.Signature;
if (TryStamp(uid, stampInfo, stampComp.StampState, paperComp))
{
TrySign(uid, args.User, args.Used, paperComp);
}
else if (TryStamp(uid, stampInfo, stampComp.StampState, paperComp))
{
// End of Frontier modifications
// successfully stamped, play popup
Expand Down
5 changes: 3 additions & 2 deletions Content.Server/Power/Components/ActiveChargerComponent.cs
Original file line number Diff line number Diff line change
@@ -1,10 +1,11 @@
using Content.Shared.Containers.ItemSlots;
/* using Content.Shared.Containers.ItemSlots;
using Content.Shared.Power;
namespace Content.Server.Power.Components
{
[RegisterComponent]
public sealed partial class ActiveChargerComponent : Component
public sealed partial class ActiveChargerComponent : Component // Frontier: Upstream - #28984 Not used anymore, swap to ChargingComponent
{
}
}
*/
19 changes: 19 additions & 0 deletions Content.Server/Power/Components/ChargingComponent.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
using Content.Shared.Containers.ItemSlots;
using Content.Shared.Power;

namespace Content.Server.Power.Components
{
[RegisterComponent]
public sealed partial class ChargingComponent : Component // Frontier: Upstream - #28984
{
///<summary>
///References the entity of the charger that is currently powering this battery
///</summary>
public EntityUid ChargerUid;

///<summary>
///References the component of the charger that is currently powering this battery
///</summary>
public ChargerComponent ChargerComponent;
}
}
Loading

0 comments on commit 7eab6b3

Please sign in to comment.