Random spontaneous cleanup PR (#25131)
* Use new Subs.CVar helper Removes manual config OnValueChanged calls, removes need to remember to manually unsubscribe. This both reduces boilerplate and fixes many issues where subscriptions weren't removed on entity system shutdown. * Fix a bunch of warnings * More warning fixes * Use new DateTime serializer to get rid of ISerializationHooks in changelog code. * Get rid of some more ISerializationHooks for enums * And a little more * Apply suggestions from code review Co-authored-by: 0x6273 <0x40@keemail.me> --------- Co-authored-by: 0x6273 <0x40@keemail.me>
This commit is contained in:
committed by
GitHub
parent
d0c174388c
commit
68ce53ae17
@@ -10,6 +10,7 @@ namespace Content.Client.CardboardBox;
|
||||
public sealed class CardboardBoxSystem : SharedCardboardBoxSystem
|
||||
{
|
||||
[Dependency] private readonly EntityLookupSystem _entityLookup = default!;
|
||||
[Dependency] private readonly TransformSystem _transform = default!;
|
||||
|
||||
public override void Initialize()
|
||||
{
|
||||
@@ -29,7 +30,7 @@ public sealed class CardboardBoxSystem : SharedCardboardBoxSystem
|
||||
if (!xformQuery.TryGetComponent(source, out var xform))
|
||||
return;
|
||||
|
||||
var sourcePos = xform.MapPosition;
|
||||
var sourcePos = _transform.GetMapCoordinates(source, xform);
|
||||
|
||||
//Any mob that can move should be surprised?
|
||||
//God mind rework needs to come faster so it can just check for mind
|
||||
@@ -53,16 +54,17 @@ public sealed class CardboardBoxSystem : SharedCardboardBoxSystem
|
||||
//Play the effect for the mobs as long as they can see the box and are in range.
|
||||
foreach (var mob in mobMoverEntities)
|
||||
{
|
||||
if (!xformQuery.TryGetComponent(mob, out var moverTransform) || !ExamineSystemShared.InRangeUnOccluded(sourcePos, moverTransform.MapPosition, box.Distance, null))
|
||||
var mapPos = _transform.GetMapCoordinates(mob);
|
||||
if (!ExamineSystemShared.InRangeUnOccluded(sourcePos, mapPos, box.Distance, null))
|
||||
continue;
|
||||
|
||||
var ent = Spawn(box.Effect, moverTransform.MapPosition);
|
||||
var ent = Spawn(box.Effect, mapPos);
|
||||
|
||||
if (!xformQuery.TryGetComponent(ent, out var entTransform) || !TryComp<SpriteComponent>(ent, out var sprite))
|
||||
continue;
|
||||
|
||||
sprite.Offset = new Vector2(0, 1);
|
||||
entTransform.AttachParent(mob);
|
||||
_transform.SetParent(ent, entTransform, mob);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user