Skip to content

Commit

Permalink
Add space debris to salvage magnet (#31113)
Browse files Browse the repository at this point in the history
* add space debris to salvage magnet

* multiplication

* necessary mercy for NPCs

* back and forth on mercy
  • Loading branch information
EmoGarbage404 authored and sleepyyapril committed Dec 28, 2024
1 parent 54583f5 commit 3db9e75
Show file tree
Hide file tree
Showing 6 changed files with 73 additions and 43 deletions.
10 changes: 10 additions & 0 deletions Content.Client/Lathe/UI/LatheMenu.xaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -90,6 +90,16 @@ public void SetEntity(EntityUid uid)
MaterialsList.SetOwner(Entity);
}

protected override void Opened()
{
base.Opened();

if (_entityManager.TryGetComponent<LatheComponent>(Entity, out var latheComp))
{
AmountLineEdit.SetText(latheComp.DefaultProductionAmount.ToString());
}
}

/// <summary>
/// DeltaV: Updates the UI elements for mining points.
/// </summary>
Expand Down
9 changes: 7 additions & 2 deletions Content.Server/Lathe/LatheSystem.cs
Original file line number Diff line number Diff line change
Expand Up @@ -198,11 +198,11 @@ public bool TryStartProducing(EntityUid uid, LatheComponent? component = null)
var recipe = component.Queue.First();
component.Queue.RemoveAt(0);

var time = _reagentSpeed.ApplySpeed(uid, recipe.CompleteTime);
var time = _reagentSpeed.ApplySpeed(uid, recipe.CompleteTime) * component.TimeMultiplier;

var lathe = EnsureComp<LatheProducingComponent>(uid);
lathe.StartTime = _timing.CurTime;
lathe.ProductionLength = time * component.TimeMultiplier;
lathe.ProductionLength = time;
component.CurrentRecipe = recipe;

var ev = new LatheStartPrintingEvent(recipe);
Expand All @@ -211,6 +211,11 @@ public bool TryStartProducing(EntityUid uid, LatheComponent? component = null)
_audio.PlayPvs(component.ProducingSound, uid);
UpdateRunningAppearance(uid, true);
UpdateUserInterfaceState(uid, component);

if (time == TimeSpan.Zero)
{
FinishProducing(uid, component, lathe);
}
return true;
}

Expand Down
6 changes: 6 additions & 0 deletions Content.Shared/Lathe/LatheComponent.cs
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,12 @@ public sealed partial class LatheComponent : Component
[DataField]
public string? ReagentOutputSlotId;

/// <summary>
/// The default amount that's displayed in the UI for selecting the print amount.
/// </summary>
[DataField, AutoNetworkedField]
public int DefaultProductionAmount = 1;

#region Visualizer info
[DataField]
public string? IdleState;
Expand Down
3 changes: 3 additions & 0 deletions Content.Shared/Stacks/SharedStackSystem.cs
Original file line number Diff line number Diff line change
Expand Up @@ -223,6 +223,9 @@ public bool TryMergeToContacts(EntityUid uid, StackComponent? stack = null, Tran
foreach (var otherStack in intersecting)
{
var otherEnt = otherStack.Owner;
// if you merge a ton of stacks together, you will end up deleting a few by accident.
if (TerminatingOrDeleted(otherEnt) || EntityManager.IsQueuedForDeletion(otherEnt))
continue;

if (!TryMergeStacks(uid, otherEnt, out _, stack, otherStack))
continue;
Expand Down
47 changes: 24 additions & 23 deletions Resources/Prototypes/Entities/Structures/Machines/lathe.yml
Original file line number Diff line number Diff line change
Expand Up @@ -1304,19 +1304,20 @@
- type: Lathe
idleState: icon
runningState: building
defaultProductionAmount: 10
staticRecipes:
- BluespaceCrystal
- NormalityCrystal
- SheetSteel30
- SheetGlass30
- SheetRGlass30
- SheetPlasma30
- SheetPGlass30
- SheetRPGlass30
- SheetUranium30
- IngotGold30
- IngotSilver30
- MaterialBananium10
- SheetSteel
- SheetGlass1
- SheetRGlass
- SheetPlasma1
- SheetPGlass1
- SheetRPGlass1
- SheetUranium1
- IngotGold1
- IngotSilver1
- MaterialBananium1
- type: MaterialStorageMagnetPickup # Delta V - Summary: Adds magnet pull from Frontier
magnetEnabled: True
range: 0.30 # Delta V - End Magnet Pull
Expand All @@ -1341,19 +1342,19 @@
staticRecipes:
- BluespaceCrystal
- NormalityCrystal
- SheetSteel30
- SheetGlass30
- SheetRGlass30
- SheetPlasma30
- SheetPGlass30
- SheetRPGlass30
- SheetPlasteel30
- SheetUranium30
- SheetUGlass30
- SheetRUGlass30
- IngotGold30
- IngotSilver30
- MaterialBananium10
- SheetSteel
- SheetGlass1
- SheetRGlass
- SheetPlasma1
- SheetPGlass1
- SheetRPGlass1
- SheetPlasteel1
- SheetUranium1
- SheetUGlass1
- SheetRUGlass1
- IngotGold1
- IngotSilver1
- MaterialBananium1
- MaterialDiamond

- type: entity
Expand Down
41 changes: 23 additions & 18 deletions Resources/Prototypes/Recipes/Lathes/sheet.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,10 @@
applyMaterialDiscount: false
completetime: 2
miningPoints: 1
completetime: 0
materials:
RawIron: 100
Coal: 30

- type: latheRecipe
id: SheetSteel30
Expand All @@ -21,6 +23,7 @@
applyMaterialDiscount: false
completetime: 2
miningPoints: 1
completetime: 0
materials:
RawQuartz: 100

Expand All @@ -37,9 +40,11 @@
applyMaterialDiscount: false
completetime: 2
miningPoints: 1
completetime: 0
materials:
Glass: 100
Steel: 50
Coal: 15

- type: latheRecipe
id: SheetRGlass30
Expand All @@ -53,7 +58,7 @@
- type: latheRecipe
id: SheetPGlass1
result: SheetPGlass1
completetime: 2
completetime: 0
miningPoints: 16
materials:
RawQuartz: 100
Expand All @@ -70,7 +75,7 @@
- type: latheRecipe
id: SheetRPGlass1
result: SheetRPGlass1
completetime: 2
completetime: 0
miningPoints: 16
materials:
RawQuartz: 100
Expand All @@ -91,7 +96,7 @@
- type: latheRecipe
id: SheetPlasma1
result: SheetPlasma1
completetime: 2
completetime: 0
miningPoints: 15
materials:
RawPlasma: 100
Expand All @@ -106,7 +111,7 @@
- type: latheRecipe
id: SheetPlasteel1
result: SheetPlasteel1
completetime: 2
completetime: 0
miningPoints: 17
materials:
RawPlasma: 100
Expand All @@ -132,7 +137,7 @@
- type: latheRecipe
id: SheetUGlass1
result: SheetUGlass1
completetime: 2
completetime: 0
miningPoints: 31
materials:
RawUranium: 100
Expand All @@ -149,7 +154,7 @@
- type: latheRecipe
id: SheetRUGlass1
result: SheetRUGlass1
completetime: 2
completetime: 0
miningPoints: 31
materials:
RawUranium: 100
Expand Down Expand Up @@ -191,50 +196,50 @@
- type: latheRecipe
id: MaterialDiamond
result: MaterialDiamond1
completetime: 3
completetime: 0
miningPoints: 50
materials:
RawDiamond: 1000
RawDiamond: 100

- type: latheRecipe
id: SheetUranium1
result: SheetUranium1
completetime: 2
completetime: 0
miningPoints: 30
materials:
RawUranium: 500
RawUranium: 100

- type: latheRecipe
id: IngotGold1
result: IngotGold1
completetime: 2
completetime: 0
miningPoints: 18
materials:
RawGold: 500
RawGold: 100

- type: latheRecipe
id: IngotSilver1
result: IngotSilver1
completetime: 2
miningPoints: 16 # DeltaV
completetime: 0
miningPoints: 16
materials:
RawSilver: 500
RawSilver: 100

- type: latheRecipe
id: SheetPlastic
result: SheetPlastic1
applyMaterialDiscount: false
completetime: 2
completetime: 0
materials:
Plastic: 100

- type: latheRecipe
id: MaterialBananium1
result: MaterialBananium1
completetime: 2
completetime: 0
miningPoints: 60
materials:
RawBananium: 500
RawBananium: 100

- type: latheRecipe
id: MaterialSheetMeat
Expand Down

0 comments on commit 3db9e75

Please sign in to comment.