AI no longer destroys small light bulbs when using Light Synthesizer. (#4032)

* Added LightBulb prototype and added logic for it in StationAiShop.

* oops

---------

Co-authored-by: Jadennl <Jnleonard@hotmail.com>
This commit is contained in:
0vrseer 2025-07-03 10:08:41 -04:00 committed by GitHub
parent 98a16ed700
commit beeedb3abe
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
3 changed files with 18 additions and 3 deletions

View File

@ -1,10 +1,12 @@
using Content.Server.Fluids.EntitySystems;
using Content.Server.Light.EntitySystems;
using Content.Server.Light.Components;
using Content.Server.Spreader;
using Content.Server.Store.Systems;
using Content.Shared._DV.Silicons;
using Content.Shared.Chemistry.Components;
using Content.Shared.Coordinates.Helpers;
using Content.Shared.Light.Components;
using Content.Shared.Maps;
using Robust.Shared.GameObjects;
using Robust.Shared.Map;
@ -37,10 +39,20 @@ public sealed class StationAiShopSystem : SharedStationAiShopSystem
private void OnLightSynthesizer(Entity<StationAiShopComponent> ent, ref StationAiLightSynthesizerActionEvent args)
{
// Grab what light exists on the fixture, delete it. Then add light with respect to fixture.
var fixture = CompOrNull<PoweredLightComponent>(args.Target);
if (fixture is null) return;
var lightProto = fixture.BulbType switch
{
LightBulbType.Bulb => args.BulbPrototype,
LightBulbType.Tube => args.TubePrototype,
_ => args.BulbPrototype
};
if (_poweredLight.EjectBulb(args.Target) is { } oldBulb)
Del(oldBulb);
var bulb = Spawn(args.BulbPrototype);
var bulb = Spawn(lightProto);
if (!_poweredLight.InsertBulb(args.Target, bulb))
{
Del(bulb);

View File

@ -31,6 +31,8 @@ public sealed partial class StationAiLightSynthesizerActionEvent : EntityTargetA
{
[DataField(required: true)]
public EntProtoId BulbPrototype;
[DataField(required: true)]
public EntProtoId TubePrototype;
}
/// <summary>

View File

@ -48,7 +48,8 @@
checkCanInteract: false
useDelay: 300
event: !type:StationAiLightSynthesizerActionEvent
bulbPrototype: LightTube
bulbPrototype: LightBulb
tubePrototype: LightTube
- type: entity
id: ActionStationAiBikeHorn