--- /dev/null
+namespace Content.Client.Holiday;
+
+/// <summary>
+/// This is used for a component that swaps an entity's RSI based on HolidayVisuals
+/// </summary>
+[RegisterComponent]
+public sealed partial class HolidayRsiSwapComponent : Component
+{
+ /// <summary>
+ /// A dictionary of arbitrary visual keys to an rsi to swap the sprite to.
+ /// </summary>
+ [DataField]
+ public Dictionary<string, string> Sprite = new();
+}
--- /dev/null
+using Content.Shared.Holiday;
+using Content.Shared.Item;
+using Robust.Client.GameObjects;
+using Robust.Client.Graphics;
+using Robust.Client.ResourceManagement;
+using Robust.Shared.Serialization.TypeSerializers.Implementations;
+
+namespace Content.Client.Holiday;
+
+public sealed class HolidaySystem : EntitySystem
+{
+ [Dependency] private readonly IResourceCache _rescache = default!;
+ [Dependency] private readonly SharedAppearanceSystem _appearance = default!;
+
+ /// <inheritdoc/>
+ public override void Initialize()
+ {
+ SubscribeLocalEvent<HolidayRsiSwapComponent, AppearanceChangeEvent>(OnAppearanceChange);
+ }
+
+ private void OnAppearanceChange(Entity<HolidayRsiSwapComponent> ent, ref AppearanceChangeEvent args)
+ {
+ if (!_appearance.TryGetData<string>(ent, HolidayVisuals.Holiday, out var data, args.Component))
+ return;
+
+ var comp = ent.Comp;
+ if (!comp.Sprite.TryGetValue(data, out var rsistring) || args.Sprite == null)
+ return;
+
+ var path = SpriteSpecifierSerializer.TextureRoot / rsistring;
+ if (_rescache.TryGetResource(path, out RSIResource? rsi))
+ args.Sprite.BaseRSI = rsi.RSI;
+ }
+}
"PdaBorderColor",
"InventorySlots",
"LightFade",
+ "HolidayRsiSwap",
};
}
}
using Content.Server.Chat.Managers;
using Content.Server.GameTicking;
using Content.Shared.CCVar;
+using Content.Shared.Holiday;
using Robust.Shared.Configuration;
using Robust.Shared.Prototypes;
[Dependency] private readonly IConfigurationManager _configManager = default!;
[Dependency] private readonly IPrototypeManager _prototypeManager = default!;
[Dependency] private readonly IChatManager _chatManager = default!;
+ [Dependency] private readonly SharedAppearanceSystem _appearance = default!;
[ViewVariables]
private readonly List<HolidayPrototype> _currentHolidays = new();
_configManager.OnValueChanged(CCVars.HolidaysEnabled, OnHolidaysEnableChange, true);
SubscribeLocalEvent<GameRunLevelChangedEvent>(OnRunLevelChanged);
+ SubscribeLocalEvent<HolidayVisualsComponent, ComponentInit>(OnVisualsInit);
}
public void RefreshCurrentHolidays()
break;
}
}
+
+ private void OnVisualsInit(Entity<HolidayVisualsComponent> ent, ref ComponentInit args)
+ {
+ foreach (var (key, holidays) in ent.Comp.Holidays)
+ {
+ if (!holidays.Any(h => IsCurrentlyHoliday(h)))
+ continue;
+ _appearance.SetData(ent, HolidayVisuals.Holiday, key);
+ break;
+ }
+ }
}
/// <summary>
--- /dev/null
+using Robust.Shared.Prototypes;
+
+namespace Content.Server.Holiday;
+
+/// <summary>
+/// This is used for an entity that enables unique visuals on specified holidays.
+/// </summary>
+[RegisterComponent]
+public sealed partial class HolidayVisualsComponent : Component
+{
+ /// <summary>
+ /// A dictionary relating a generic key to a list of holidays.
+ /// If any of the holidays are being celebrated, that key will be set for holiday visuals.
+ /// </summary>
+ [DataField]
+ public Dictionary<string, List<ProtoId<HolidayPrototype>>> Holidays = new();
+}
--- /dev/null
+using Robust.Shared.Serialization;
+
+namespace Content.Shared.Holiday;
+
+[Serializable, NetSerializable]
+public enum HolidayVisuals : byte
+{
+ Holiday
+}
- type: Sprite
sprite: Objects/Devices/nuke.rsi
noRot: true
- state: nuclearbomb_base
+ layers:
+ - state: nuclearbomb_base
+ - state: nukefestive
+ map: ["christmas"]
+ visible: false
+ - type: Appearance
+ - type: HolidayVisuals
+ holidays:
+ festive:
+ - FestiveSeason
+ - type: GenericVisualizer
+ visuals:
+ enum.HolidayVisuals.Holiday:
+ christmas:
+ festive: { visible: true }
- type: Physics
bodyType: Static
- type: Fixtures
- type: NukeLabel
- type: Sprite
sprite: Objects/Devices/nuke.rsi
- state: nuclearbomb_base
+ layers:
+ - state: nuclearbomb_base
+ - state: nukefestive
+ map: ["christmas"]
+ visible: false
+ - type: Appearance
+ - type: HolidayVisuals
+ holidays:
+ festive:
+ - FestiveSeason
+ - type: GenericVisualizer
+ visuals:
+ enum.HolidayVisuals.Holiday:
+ christmas:
+ festive: { visible: true }
- type: Physics
bodyType: Dynamic
- type: Fixtures
sprite: Objects/Misc/Lights/lamp.rsi
layers:
- state: lamp
+ map: [ "base" ]
- state: lamp-on
shader: unshaded
visible: false
map: [ "light" ]
- type: Item
sprite: Objects/Misc/Lights/lamp.rsi
+ - type: HolidayVisuals
+ holidays:
+ festive:
+ - FestiveSeason
+ - type: GenericVisualizer
+ visuals:
+ enum.HolidayVisuals.Holiday:
+ base:
+ festive: { state: christmaslamp }
+ light:
+ festive: { state: christmaslamp-on }
- type: entity
name: banana lamp
sprite: Objects/Misc/Lights/lampgreen.rsi
layers:
- state: lampgreen
+ map: [ "base" ]
- state: lampgreen-on
shader: unshaded
visible: false
map: [ "light" ]
- type: Item
sprite: Objects/Misc/Lights/lampgreen.rsi
+ - type: HolidayVisuals
+ holidays:
+ festive:
+ - FestiveSeason
+ - type: GenericVisualizer
+ visuals:
+ enum.HolidayVisuals.Holiday:
+ base:
+ festive:
+ sprite: Objects/Misc/Lights/lamp.rsi
+ state: christmaslamp
+ light:
+ festive:
+ sprite: Objects/Misc/Lights/lamp.rsi
+ state: christmaslamp-on
- type: entity
name: interrogator lamp
- state: icon
map: ["base"]
- type: Item
- sprite: Objects/Weapons/Bombs/c4.rsi
size: Small
- type: OnUseTimerTrigger
delay: 10
- !type:ExplodeBehavior
- type: StickyVisualizer
- type: Appearance
+ - type: HolidayVisuals
+ holidays:
+ festive:
+ - FestiveSeason
+ - type: HolidayRsiSwap
+ sprite:
+ festive: Objects/Weapons/Bombs/c4gift.rsi
- type: GenericVisualizer
visuals:
enum.Trigger.TriggerVisuals.VisualState:
components:
- type: Sprite
sprite: Objects/Weapons/Throwable/throwing_star.rsi
- state: icon
+ layers:
+ - state: icon
+ map: ["base"]
+ - type: Appearance
+ - type: HolidayVisuals
+ holidays:
+ festive:
+ - FestiveSeason
+ - type: GenericVisualizer
+ visuals:
+ enum.HolidayVisuals.Holiday:
+ base:
+ festive: { state: festive }
- type: Fixtures
fixtures:
fix1:
sprite: Structures/Decoration/fireplace.rsi
layers:
- state: fireplace
+ - state: fireplacefestive
+ map: ["christmas"]
+ visible: false
- state: fireplace_fire4
shader: unshaded
- state: fireplace_glow
shader: unshaded
+ - type: Appearance
+ - type: HolidayVisuals
+ holidays:
+ festive:
+ - FestiveSeason
+ - type: GenericVisualizer
+ visuals:
+ enum.HolidayVisuals.Holiday:
+ christmas:
+ festive: { visible: true }
- type: AmbientSound
volume: -6
range: 5
{
"version": 1,
"license": "CC-BY-SA-3.0",
- "copyright": "Taken from https://github.com/vgstation-coders/vgstation13/blob/835fd60545178a19064f5df9981dac6e1b220775/icons/obj/stationobjs.dmi",
+ "copyright": "Taken from https://github.com/vgstation-coders/vgstation13/blob/835fd60545178a19064f5df9981dac6e1b220775/icons/obj/stationobjs.dmi, nukefestive by Alekshhh (Github)",
"size": {
"x": 32,
"y": 32
{
"name": "nuclearbomb_deployed"
},
+ {
+ "name": "nukefestive",
+ "delays": [
+ [
+ 0.25,
+ 0.25
+ ]
+ ]
+ },
{
"name": "nuclearbomb_timing",
"delays": [
{
"version": 1,
"license": "CC-BY-SA-3.0",
- "copyright": "Taken from tgstation at https://github.com/tgstation/tgstation/commit/e1142f20f5e4661cb6845cfcf2dd69f864d67432",
+ "copyright": "Taken from tgstation at https://github.com/tgstation/tgstation/commit/e1142f20f5e4661cb6845cfcf2dd69f864d67432, christmaslamp by Alekshhh (Github)",
"size": {
"x": 32,
"y": 32
"name": "lamp",
"directions": 4
},
+ {
+ "name": "christmaslamp"
+ },
+ {
+ "name": "christmaslamp-on"
+ },
{
"name": "lamp-on",
"directions": 4
--- /dev/null
+{
+ "version": 1,
+ "license": "CC-BY-SA-3.0",
+ "copyright": "Created by Alekshhh (Github) for SS14",
+ "size": {
+ "x": 32,
+ "y": 32
+ },
+ "states": [
+ {
+ "name": "icon"
+ },
+ {
+ "name": "primed",
+ "delays": [
+ [
+ 0.1,
+ 0.1
+ ]
+ ]
+ },
+ {
+ "name": "inhand-left",
+ "directions": 4
+ },
+ {
+ "name": "inhand-right",
+ "directions": 4
+ }
+ ]
+}
{
"version": 1,
"license": "CC0-1.0",
- "copyright": "Created for SS14 by deltanedas (github)",
+ "copyright": "Created for SS14 by deltanedas (github), festive by Alekshhh (Github)",
"size": {
"x": 32,
"y": 32
"states": [
{
"name": "icon"
+ },
+ {
+ "name": "festive"
}
]
}
{
"version": 1,
"license": "CC-BY-SA-3.0",
- "copyright": "https://github.com/tgstation/tgstation/commit/6449b65d307312a111deb592e7a1bb4093e085e4",
+ "copyright": "https://github.com/tgstation/tgstation/commit/6449b65d307312a111deb592e7a1bb4093e085e4, fireplacefestive by Alekshhh (Github)",
"size": {
"x": 64,
"y": 64
"name": "fireplace",
"directions": 1
},
+ {
+ "name": "fireplacefestive"
+ },
{
"name": "fireplace_fire4",
"directions": 4,
]
}
]
-}
\ No newline at end of file
+}