Skip to content
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

Contraband POI edits #2146

Merged
merged 26 commits into from
Oct 4, 2024
Merged
Show file tree
Hide file tree
Changes from all 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
4 changes: 2 additions & 2 deletions Content.Server/VendingMachines/VendingMachineSystem.cs
Original file line number Diff line number Diff line change
Expand Up @@ -560,11 +560,11 @@ public override void Update(float frameTime)
}

// Added block for charges
if (comp.EjectRandomCounter == comp.EjectRandomMax || _timing.CurTime < comp.NextChargeTime)
if (comp.EjectRandomCounter == comp.EjectRandomMax || _timing.CurTime < comp.EjectNextChargeTime)
continue;

AddCharges(uid, 1, comp);
comp.NextChargeTime = _timing.CurTime + comp.RechargeDuration;
comp.EjectNextChargeTime = _timing.CurTime + comp.EjectRechargeDuration;
// Added block for charges
}
var disabled = EntityQueryEnumerator<EmpDisabledComponent, VendingMachineComponent>();
Expand Down
Original file line number Diff line number Diff line change
@@ -1,9 +1,4 @@
/*
* New Frontiers - This file is licensed under AGPLv3
* Copyright (c) 2024 New Frontiers
* See AGPLv3.txt for details.
*/
namespace Content.Server._NF.GameRule;
namespace Content.Server._NF.GameRule.Components;

[RegisterComponent, Access(typeof(NfAdventureRuleSystem))]
public sealed partial class AdventureRuleComponent : Component
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
namespace Content.Server._NF.GameRule.Components;

[RegisterComponent]
public sealed partial class SyndicateFOBComponent : Component
{

}
21 changes: 7 additions & 14 deletions Content.Server/_NF/GameRule/NfAdventureRuleSystem.cs
Original file line number Diff line number Diff line change
@@ -1,8 +1,3 @@
/*
* New Frontiers - This file is licensed under AGPLv3
* Copyright (c) 2024 New Frontiers
* See AGPLv3.txt for details.
*/
using System.Linq;
using System.Net.Http;
using System.Numerics;
Expand All @@ -14,8 +9,6 @@
using Content.Server.Procedural;
using Content.Shared.Bank.Components;
using Content.Server._NF.GameTicking.Events;
using Content.Server.GameTicking.Events;
using Content.Server.GameTicking.Rules.Components;
using Content.Shared.Procedural;
using Robust.Server.GameObjects;
using Robust.Server.Maps;
Expand All @@ -26,7 +19,6 @@
using Robust.Shared.Random;
using Robust.Shared.Map.Components;
using Content.Shared.Shuttles.Components;
using Content.Server._NF.GameTicking.Events;
using Content.Server.Shuttles.Systems;
using Content.Server.Cargo.Components;
using Content.Server.GameTicking;
Expand All @@ -40,6 +32,7 @@
using Content.Server.Shuttles.Components;
using Content.Shared.Tiles;
using Content.Server._NF.PublicTransit.Components;
using Content.Server._NF.GameRule.Components;

namespace Content.Server._NF.GameRule;

Expand Down Expand Up @@ -147,7 +140,7 @@ protected override void Started(EntityUid uid, AdventureRuleComponent component,
depotProtos.Add(location);
else if (location.SpawnGroup == "MarketStation")
marketProtos.Add(location);
else if (location.AlwaysSpawn == true)
else if (location.SpawnGroup == "Required")
requiredProtos.Add(location);
else if (location.SpawnGroup == "Optional")
optionalProtos.Add(location);
Expand Down Expand Up @@ -356,11 +349,11 @@ private bool TrySpawnPoiGrid(PointOfInterestPrototype proto, Vector2 offset, out
{
var meta = EnsureComp<MetaDataComponent>(grid);
_meta.SetEntityName(grid, stationName, meta);
_shuttle.SetIFFColor(grid, proto.IffColor);
if (proto.IsHidden)
{
_shuttle.AddIFFFlag(grid, IFFFlags.HideLabel);
}

EnsureComp<IFFComponent>(grid);
_shuttle.SetIFFColor(grid, proto.IFFColor);
_shuttle.AddIFFFlag(grid, proto.Flags);

if (!proto.AllowIFFChanges)
{
_shuttle.SetIFFReadOnly(grid, true);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ public TimeSpan NextDropVV
/// Location of the grid to spawn in as the dead drop.
/// </summary>
[DataField]
public string DropGrid = "/Maps/deaddrop.yml";
public string DropGrid = "/Maps/_NF/DeadDrop/deaddrop.yml";

/// <summary>
/// The color of your grid. the name should be set by the mapper when mapping.
Expand Down
6 changes: 3 additions & 3 deletions Content.Server/_NF/Smuggling/DeadDropSystem.cs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
using System.Linq;
using System.Linq;
using System.Text;
using Content.Server._NF.GameTicking.Events;
using Content.Server._NF.SectorServices;
Expand Down Expand Up @@ -364,7 +364,7 @@ private void OnStationsGenerated(StationsGeneratedEvent args)
}

// Hint generated, destroy component
RemComp<DeadDropHintComponent>(ent);
//RemComp<DeadDropHintComponent>(ent); // Removed so we can keep track of it
_sawmill.Debug($"Dead drop hint generated at {ent}.");
}

Expand Down Expand Up @@ -651,4 +651,4 @@ public string GenerateRandomHint(List<(EntityUid station, EntityUid ent)>? entit
}
return Loc.GetString("dead-drop-hint-note", ("drops", hintLines));
}
}
}
2 changes: 1 addition & 1 deletion Content.Shared/Shuttles/Components/IFFComponent.cs
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ public enum IFFFlags : byte
Hide = 2,

/// <summary>
/// Is this a player shuttle
/// Frontier - Is this a player shuttle
/// </summary>
IsPlayerShuttle = 4,

Expand Down
12 changes: 6 additions & 6 deletions Content.Shared/VendingMachines/VendingMachineComponent.cs
Original file line number Diff line number Diff line change
Expand Up @@ -36,26 +36,26 @@ public sealed partial class VendingMachineComponent : Component
/// <summary>
/// Used by the server to determine how many items the machine allowed to eject from random triggers.
/// </summary>
[DataField("ejectRandomMax"), ViewVariables(VVAccess.ReadWrite)]
[DataField]
public float EjectRandomMax = 2;

/// <summary>
/// Used by the server to determine how many items the machine ejected from random triggers.
/// </summary>
[DataField("ejectRandomCounter"), ViewVariables(VVAccess.ReadWrite)]
[DataField]
public float EjectRandomCounter = 2;

/// <summary>
/// The time it takes to regain a single charge
/// </summary>
[DataField("rechargeDuration"), ViewVariables(VVAccess.ReadWrite)]
public TimeSpan RechargeDuration = TimeSpan.FromSeconds(3600);
[DataField]
public TimeSpan EjectRechargeDuration = TimeSpan.FromSeconds(1800);

/// <summary>
/// The time when the next charge will be added
/// </summary>
[DataField("nextChargeTime", customTypeSerializer: typeof(TimeOffsetSerializer))]
public TimeSpan NextChargeTime;
[DataField(customTypeSerializer: typeof(TimeOffsetSerializer))]
public TimeSpan EjectNextChargeTime;
// End Frontier: random ejection

[DataField, AutoNetworkedField]
Expand Down
54 changes: 24 additions & 30 deletions Content.Shared/_NF/GameRule/PointOfInterestPrototype.cs
Original file line number Diff line number Diff line change
@@ -1,8 +1,7 @@
using Content.Shared.Guidebook;
using Robust.Shared.Prototypes;
using Robust.Shared.Serialization;
using Robust.Shared.Serialization.TypeSerializers.Implementations.Custom.Prototype;
using Robust.Shared.Utility;
using Content.Shared.Shuttles.Components;

namespace Content.Shared._NF.GameRule;

Expand All @@ -20,88 +19,83 @@ public sealed partial class PointOfInterestPrototype : IPrototype
/// <summary>
/// The name of this point of interest
/// </summary>
[DataField("name")]
[DataField]
public string Name { get; private set; } = "";

/// <summary>
/// Minimum range to spawn this POI at
/// </summary>
[DataField("rangeMin")]
[DataField]
public int RangeMin { get; private set; } = 5000;

/// <summary>
/// Maximum range to spawn this POI at
/// </summary>
[DataField("rangeMax")]
[DataField]
public int RangeMax { get; private set; } = 10000;

/// <summary>
/// The color to display the grid and name tag as in the radar screen
/// </summary>
[DataField("iffColor")]
public Color IffColor { get; private set; } = (100, 100, 100, 100);

/// <summary>
/// Whether or not the POI itself should be able to move or be moved. Should be false for immobile POIs (static stations) and true for ship-like POIs.
/// </summary>
[DataField("canMove")]
public bool CanMove { get; private set; }
[DataField("IFFColor")]
public Color IFFColor { get; private set; } = (100, 100, 100, 100);

/// <summary>
/// Whether or not the POI is shown on IFF.
/// </summary>
[DataField("isHidden")]
public bool IsHidden { get; private set; }
[DataField("IFFFlags")]
public IFFFlags Flags = IFFFlags.None;

/// <summary>
/// Whether or not the POI permits IFF changes (i.e. from a console aboard it)
/// </summary>
[DataField("allowIFFChanges")]
[DataField]
public bool AllowIFFChanges { get; private set; }

/// <summary>
/// Whether or not the POI is shown on IFF.
/// Whether or not the POI itself should be able to move or be moved. Should be false for immobile POIs (static stations) and true for ship-like POIs.
/// </summary>
[DataField("gridProtection")]
public GridProtectionFlags GridProtection { get; private set; } = GridProtectionFlags.None;
[DataField]
public bool CanMove { get; private set; }

/// <summary>
/// Must this POI always spawn? This is independent of spawn chance. If it always spawns,
/// it will be excluded from any kind of random lists, for places like the sheriff's department etc.
/// Whether or not the POI is shown on IFF.
/// </summary>
[DataField("alwaysSpawn")]
public bool AlwaysSpawn { get; private set; }
[DataField]
public GridProtectionFlags GridProtection { get; private set; } = GridProtectionFlags.None;

/// <summary>
/// If the POI does not belong to a pre-defined group, it will default to the "unique" internal category and will
/// use this float from 0-1 as a raw chance to spawn each round.
/// </summary>
[DataField("spawnChance")]
[DataField]
public float SpawnChance { get; private set; } = 1;

/// <summary>
/// The group that this POI belongs to. Currently, the default groups are:
/// "CargoDepot"
/// "CargoDepot"
/// "MarketStation"
/// "Required"
/// "Optional"
/// These three have corresponding CVARS by default, that set an optional # of this group to spawn.
/// Each POI labeled in the Required group will be spawned in every round.
/// Apart from that, each of thesehave corresponding CVARS by default, that set an optional # of this group to spawn.
/// Traditionally, it is 2 cargo depots, 1 trade station, and 8 optional POIs.
/// Dynamically added groups will default to 1 option chosen in that group, using the SpawnChance as a weighted chance
/// for the entire group to spawn on a per-POI basis.
/// </summary>
[DataField("spawnGroup")]
[DataField]
public string SpawnGroup { get; private set; } = "Optional";

/// <summary>
/// the path to the grid
/// </summary>
[DataField("gridPath", required: true)]
[DataField(required: true)]
public ResPath GridPath { get; private set; } = default!;

/// <summary>
/// Should the public transit stop here? If true, this will be added to the list of bus stops.
/// </summary>
[DataField("busStop")]
[DataField]
public bool BusStop { get; private set; }
}

Expand All @@ -118,4 +112,4 @@ public enum GridProtectionFlags : byte
EmpEvents = 8,
Explosions = 16,
ArtifactTriggers = 32
}
}
Loading
Loading