-
Notifications
You must be signed in to change notification settings - Fork 397
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'master' into lavaland-ops
Signed-off-by: deltanedas <[email protected]>
- Loading branch information
Showing
85 changed files
with
3,147 additions
and
1,097 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
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
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 |
---|---|---|
@@ -1,13 +1,15 @@ | ||
using Robust.Shared.Serialization.TypeSerializers.Implementations.Custom; | ||
|
||
namespace Content.Server.DeltaV.AACTablet; | ||
|
||
[RegisterComponent] | ||
[RegisterComponent, AutoGenerateComponentPause] | ||
public sealed partial class AACTabletComponent : Component | ||
{ | ||
// Minimum time between each phrase, to prevent spam | ||
[DataField] | ||
public TimeSpan Cooldown = TimeSpan.FromSeconds(1); | ||
|
||
// Time that the next phrase can be sent. | ||
[DataField] | ||
[DataField(customTypeSerializer: typeof(TimeOffsetSerializer)), AutoPausedField] | ||
public TimeSpan NextPhrase; | ||
} |
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,4 @@ | ||
namespace Content.Server.DeltaV.Cabinet; | ||
|
||
[RegisterComponent] | ||
public sealed partial class SpareIDSafeComponent : Component; |
14 changes: 14 additions & 0 deletions
14
Content.Server/DeltaV/Cargo/Components/PriceModifierComponent.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,14 @@ | ||
namespace Content.Server.DeltaV.Cargo.Components; | ||
|
||
/// <summary> | ||
/// This is used for modifying the sell price of an entity. | ||
/// </summary> | ||
[RegisterComponent] | ||
public sealed partial class PriceModifierComponent : Component | ||
{ | ||
/// <summary> | ||
/// The price modifier. | ||
/// </summary> | ||
[DataField] | ||
public float Modifier; | ||
} |
41 changes: 41 additions & 0 deletions
41
Content.Server/DeltaV/Cargo/Systems/PricingSystem.Modifier.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,41 @@ | ||
using Content.Server.DeltaV.Cargo.Components; | ||
using Robust.Shared.Prototypes; | ||
|
||
namespace Content.Server.Cargo.Systems; | ||
|
||
public sealed partial class PricingSystem | ||
{ | ||
/// <summary> | ||
/// Applies any price modifiers defined in the entity prototype. | ||
/// </summary> | ||
/// <param name="prototype">The entity prototype.</param> | ||
/// <param name="basePrice">The base price before modification.</param> | ||
/// <returns>The modified price.</returns> | ||
private double ApplyPrototypePriceModifier(EntityPrototype prototype, double basePrice) | ||
{ | ||
if (prototype.Components.TryGetValue(_factory.GetComponentName(typeof(PriceModifierComponent)), | ||
out var modProto)) | ||
{ | ||
var priceModifier = (PriceModifierComponent)modProto.Component; | ||
return basePrice * priceModifier.Modifier; | ||
} | ||
|
||
return basePrice; | ||
} | ||
|
||
/// <summary> | ||
/// Applies any price modifiers to the calculated price. | ||
/// </summary> | ||
/// <param name="uid">The entity whose price is being modified.</param> | ||
/// <param name="basePrice">The base price before modification.</param> | ||
/// <returns>The modified price.</returns> | ||
private double ApplyPriceModifier(EntityUid uid, double basePrice) | ||
{ | ||
if (TryComp<PriceModifierComponent>(uid, out var modifier)) | ||
{ | ||
return basePrice * modifier.Modifier; | ||
} | ||
|
||
return basePrice; | ||
} | ||
} |
Oops, something went wrong.