Biomass (#10313)
* Material * good prototype * Fix material storage * You can insert biomass into the cloner * ok, basic biomass subtraction works * amogus * ok chance works * Alright, the biomass and genetic stuff works * feedback for cloning * more reclaimer polish * ship it * starting biomass + fix lathes * I changed my mind on rat mass and these guys are definitely getting ground up * Doafter * clean up, sync the two * fix naming, fix mass * technology + construction * additional logging, stop unanchoring when active * fix event / logs * dont gib dead salvage * auto eject * fix deconstruction behavior * make warning message better, temporarily disable cancer scanner * fix biomass stacks * add easy mode CVAR * stack cleanup, make biomass 2x as fast * bugfix * new sprite from hyenh * fix tests * hello? :smilethink: * :smilethink: * medical scanner gets antirotting * fix cloner and medical scanner Co-authored-by: Moony <moonheart08@users.noreply.github.com>
This commit is contained in:
@@ -83,6 +83,44 @@ namespace Content.Server.Stack
|
||||
return entity;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Say you want to spawn 97 stacks of something that has a max stack count of 30.
|
||||
/// This would spawn 3 stacks of 30 and 1 stack of 7.
|
||||
/// </summary>
|
||||
public void SpawnMultiple(int amount, int maxCountPerStack, StackPrototype prototype, EntityCoordinates spawnPosition)
|
||||
{
|
||||
while (amount > 0)
|
||||
{
|
||||
if (amount > maxCountPerStack)
|
||||
{
|
||||
var entity = Spawn("MaterialBiomass", spawnPosition);
|
||||
var stack = Comp<StackComponent>(entity);
|
||||
|
||||
SetCount(entity, maxCountPerStack, stack);
|
||||
amount -= maxCountPerStack;
|
||||
}
|
||||
else
|
||||
{
|
||||
var entity = Spawn("MaterialBiomass", spawnPosition);
|
||||
var stack = Comp<StackComponent>(entity);
|
||||
|
||||
SetCount(entity, amount, stack);
|
||||
amount = 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public void SpawnMultiple(int amount, int maxCountPerStack, string prototype, EntityCoordinates spawnPosition)
|
||||
{
|
||||
if (!_prototypeManager.TryIndex<StackPrototype>(prototype, out var stackType))
|
||||
{
|
||||
Logger.Error("Failed to index stack prototype " + prototype);
|
||||
return;
|
||||
}
|
||||
|
||||
SpawnMultiple(amount, maxCountPerStack, stackType, spawnPosition);
|
||||
}
|
||||
|
||||
private void OnStackAlternativeInteract(EntityUid uid, StackComponent stack, GetVerbsEvent<AlternativeVerb> args)
|
||||
{
|
||||
if (!args.CanAccess || !args.CanInteract || args.Hands == null)
|
||||
|
||||
Reference in New Issue
Block a user