DNA basics (#14724)
* DNA component * Commit numba 2 * Added DNA into Station Records Computer * commit numba 3 * commit numba 4 * Vomit also contain DNA component now * fixed DNA field not clearing after scanning another item * commit numba 10 Drinking leaves DNA on an object. Breaking glasses, bottles and beakers leave DNA and leave fingerprints/fibers with 40% chance on glass shards. + lotta fixes * 11 * 12 * 14 * Added DNA guide entry * FIX
This commit is contained in:
@@ -1,7 +1,9 @@
|
||||
using Content.Server.Forensics;
|
||||
using Content.Server.Stack;
|
||||
using Content.Shared.Prototypes;
|
||||
using Content.Shared.Stacks;
|
||||
using Robust.Shared.Prototypes;
|
||||
using Robust.Shared.Random;
|
||||
using Robust.Shared.Serialization.TypeSerializers.Implementations.Custom.Prototype.Dictionary;
|
||||
|
||||
namespace Content.Server.Destructible.Thresholds.Behaviors
|
||||
@@ -19,6 +21,9 @@ namespace Content.Server.Destructible.Thresholds.Behaviors
|
||||
[DataField("offset")]
|
||||
public float Offset { get; set; } = 0.5f;
|
||||
|
||||
[DataField("transferForensics")]
|
||||
public bool DoTransferForensics = false;
|
||||
|
||||
public void Execute(EntityUid owner, DestructibleSystem system, EntityUid? cause = null)
|
||||
{
|
||||
var position = system.EntityManager.GetComponent<TransformComponent>(owner).MapPosition;
|
||||
@@ -37,15 +42,34 @@ namespace Content.Server.Destructible.Thresholds.Behaviors
|
||||
{
|
||||
var spawned = system.EntityManager.SpawnEntity(entityId, position.Offset(getRandomVector()));
|
||||
system.StackSystem.SetCount(spawned, count);
|
||||
|
||||
TransferForensics(spawned, system, owner);
|
||||
}
|
||||
else
|
||||
{
|
||||
for (var i = 0; i < count; i++)
|
||||
{
|
||||
system.EntityManager.SpawnEntity(entityId, position.Offset(getRandomVector()));
|
||||
var spawned = system.EntityManager.SpawnEntity(entityId, position.Offset(getRandomVector()));
|
||||
|
||||
TransferForensics(spawned, system, owner);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public void TransferForensics(EntityUid spawned, DestructibleSystem system, EntityUid owner)
|
||||
{
|
||||
if (!DoTransferForensics ||
|
||||
!system.EntityManager.TryGetComponent<ForensicsComponent>(owner, out var forensicsComponent))
|
||||
return;
|
||||
|
||||
var comp = system.EntityManager.EnsureComponent<ForensicsComponent>(spawned);
|
||||
comp.DNAs = forensicsComponent.DNAs;
|
||||
|
||||
if (!system.Random.Prob(0.4f))
|
||||
return;
|
||||
comp.Fingerprints = forensicsComponent.Fingerprints;
|
||||
comp.Fibers = forensicsComponent.Fibers;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user