Buildable wall light (#2644)
* Added empty light * Can build light fixture * Can construct and deconstruct small light * You can build bulbs only on walls * Playing with placement conditions * Refactored code a bit * Added check for north direction and snapping * Fixed all small light sprites (wrong directions order) * Fixed weird problem with bulb lights * Fixed rotation on all stations * Fixed map again * Much better placement mode * Deleted shared wall component and moved all logic to raycasts * Missing bracket * Better texture * Moved wallmount condition to tags * Removed station station * Added suffix and fixed on map init bug
This commit is contained in:
@@ -38,6 +38,7 @@ namespace Content.Server.GameObjects.Components.Power.ApcNetComponents.PowerRece
|
||||
|
||||
private static readonly TimeSpan _thunkDelay = TimeSpan.FromSeconds(2);
|
||||
private TimeSpan _lastThunk;
|
||||
private bool _hasLampOnSpawn;
|
||||
|
||||
[ViewVariables] private bool _on;
|
||||
|
||||
@@ -148,6 +149,7 @@ namespace Content.Server.GameObjects.Components.Power.ApcNetComponents.PowerRece
|
||||
{
|
||||
serializer.DataField(ref BulbType, "bulb", LightBulbType.Tube);
|
||||
serializer.DataField(ref _on, "on", true);
|
||||
serializer.DataField(ref _hasLampOnSpawn, "hasLampOnSpawn", true);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@@ -229,15 +231,19 @@ namespace Content.Server.GameObjects.Components.Power.ApcNetComponents.PowerRece
|
||||
|
||||
void IMapInit.MapInit()
|
||||
{
|
||||
var prototype = BulbType switch
|
||||
if (_hasLampOnSpawn)
|
||||
{
|
||||
LightBulbType.Bulb => "LightBulb",
|
||||
LightBulbType.Tube => "LightTube",
|
||||
_ => throw new ArgumentOutOfRangeException()
|
||||
};
|
||||
var prototype = BulbType switch
|
||||
{
|
||||
LightBulbType.Bulb => "LightBulb",
|
||||
LightBulbType.Tube => "LightTube",
|
||||
_ => throw new ArgumentOutOfRangeException()
|
||||
};
|
||||
|
||||
var entity = Owner.EntityManager.SpawnEntity(prototype, Owner.Transform.Coordinates);
|
||||
_lightBulbContainer.Insert(entity);
|
||||
var entity = Owner.EntityManager.SpawnEntity(prototype, Owner.Transform.Coordinates);
|
||||
_lightBulbContainer.Insert(entity);
|
||||
UpdateLight();
|
||||
}
|
||||
}
|
||||
|
||||
public void TriggerSignal(bool signal)
|
||||
|
||||
Reference in New Issue
Block a user