Salvage mining, ore processing, and material clean-up (#7406)
* adding stuff cuz new computer * removed unused materials * remove unused materials and such, lathe things * material volume no longer hardcoded * fixed mining system * add 5 stacks of materials, and add them to the ore processor * fix copyright for ores and handdrill * comma momma * whyyyyy * more fixes to make the yaml linter happy * i should get my eyes checked * silver proper * more cleanup * leftovers * remove more references to material doors * couldn't bear to be without bearhide * added uranium, added more lathe recipes * copyright fix, stack fix * ore processor sprite and such * ore processing some binches * MaterialCotton removal * 1 uranium ore means 1 sheet * fix merge conflict? idk * time to ketchup * lathe recognizes material volume again * yaml cleanup * forgot to remove adamantine lol * re-added diamond for now * diamond stacks * functional ore processor * added ignoreColor to lathe visuals * ore processor machine board * add board to industrial tech and circuit printer * provided lathes their whitelists * fix wonky ore spawning, added insert sound to lathe, adjusted ore chance * re-added ore processor * typos and cleanup * Update Content.Client/Lathe/LatheSystem.cs Co-authored-by: metalgearsloth <31366439+metalgearsloth@users.noreply.github.com> * Update Content.Server/Lathe/LatheSystem.cs Co-authored-by: metalgearsloth <31366439+metalgearsloth@users.noreply.github.com> * revert mapchange * VV ignorecolor, pass entitymanager, move canceltoken to pickaxe, removed foreach from orespawn * actually null canceltoken * remove five-stacks, ore processor produces full stacks or single sheets/ingots * VV proper * adjust ore chances * readd Cotton * Update Content.Server/Mining/MineableSystem.cs * tweaks * Material is now dict (material, volume) * removed unused property * Space crystal -> space quartz * forgor asteroid space quartz Co-authored-by: metalgearsloth <31366439+metalgearsloth@users.noreply.github.com> Co-authored-by: metalgearsloth <comedian_vs_clown@hotmail.com>
This commit is contained in:
@@ -102,7 +102,9 @@ namespace Content.Server.Lathe
|
||||
/// </summary>
|
||||
private void OnInteractUsing(EntityUid uid, LatheComponent component, InteractUsingEvent args)
|
||||
{
|
||||
if (!TryComp<MaterialStorageComponent>(uid, out var storage) || !TryComp<MaterialComponent>(args.Used, out var material))
|
||||
if (!TryComp<MaterialStorageComponent>(uid, out var storage)
|
||||
|| !TryComp<MaterialComponent>(args.Used, out var material)
|
||||
|| component.LatheWhitelist?.IsValid(args.Used) == false)
|
||||
return;
|
||||
|
||||
var multiplier = 1;
|
||||
@@ -113,24 +115,30 @@ namespace Content.Server.Lathe
|
||||
var totalAmount = 0;
|
||||
|
||||
// Check if it can insert all materials.
|
||||
foreach (var mat in material.MaterialIds)
|
||||
foreach (var (mat, vol) in material._materials)
|
||||
{
|
||||
// TODO: Change how MaterialComponent works so this is not hard-coded.
|
||||
if (!storage.CanInsertMaterial(mat, component.VolumePerSheet * multiplier))
|
||||
return;
|
||||
totalAmount += component.VolumePerSheet * multiplier;
|
||||
if (!storage.CanInsertMaterial(mat,
|
||||
vol * multiplier)) return;
|
||||
totalAmount += vol * multiplier;
|
||||
}
|
||||
|
||||
// Check if it can take ALL of the material's volume.
|
||||
if (storage.StorageLimit > 0 && !storage.CanTakeAmount(totalAmount))
|
||||
return;
|
||||
var lastMat = string.Empty;
|
||||
foreach (var mat in material.MaterialIds)
|
||||
foreach (var (mat, vol) in material._materials)
|
||||
{
|
||||
storage.InsertMaterial(mat, component.VolumePerSheet * multiplier);
|
||||
storage.InsertMaterial(mat, vol * multiplier);
|
||||
lastMat = mat;
|
||||
}
|
||||
/// We need the prototype to get the color
|
||||
|
||||
// Play a sound when inserting, if any
|
||||
if (component.InsertingSound != null)
|
||||
{
|
||||
SoundSystem.Play(Filter.Pvs(component.Owner, entityManager: EntityManager), component.InsertingSound.GetSound(), component.Owner);
|
||||
}
|
||||
|
||||
// We need the prototype to get the color
|
||||
_prototypeManager.TryIndex(lastMat, out MaterialPrototype? matProto);
|
||||
|
||||
EntityManager.QueueDeleteEntity(args.Used);
|
||||
|
||||
Reference in New Issue
Block a user