Bar signs implemented.
This commit is contained in:
@@ -163,6 +163,7 @@ namespace Content.Client
|
||||
|
||||
prototypes.RegisterIgnore("material");
|
||||
prototypes.RegisterIgnore("reaction"); //Chemical reactions only needed by server. Reactions checks are server-side.
|
||||
prototypes.RegisterIgnore("barSign");
|
||||
|
||||
ClientContentIoC.Register();
|
||||
|
||||
|
||||
@@ -0,0 +1,115 @@
|
||||
using System.Linq;
|
||||
using Content.Server.GameObjects.Components.Power;
|
||||
using Robust.Server.GameObjects;
|
||||
using Robust.Server.Interfaces.GameObjects;
|
||||
using Robust.Shared.GameObjects;
|
||||
using Robust.Shared.Interfaces.Random;
|
||||
using Robust.Shared.IoC;
|
||||
using Robust.Shared.Localization;
|
||||
using Robust.Shared.Log;
|
||||
using Robust.Shared.Prototypes;
|
||||
using Robust.Shared.Random;
|
||||
using Robust.Shared.Serialization;
|
||||
using Robust.Shared.ViewVariables;
|
||||
|
||||
namespace Content.Server.GameObjects.Components.BarSign
|
||||
{
|
||||
[RegisterComponent]
|
||||
public class BarSignComponent : Component, IMapInit
|
||||
{
|
||||
public override string Name => "BarSign";
|
||||
|
||||
#pragma warning disable 649
|
||||
[Dependency] private readonly IPrototypeManager _prototypeManager;
|
||||
[Dependency] private readonly IRobustRandom _robustRandom;
|
||||
#pragma warning restore 649
|
||||
|
||||
private string _currentSign;
|
||||
|
||||
private PowerDeviceComponent _power;
|
||||
private SpriteComponent _sprite;
|
||||
|
||||
[ViewVariables(VVAccess.ReadWrite)]
|
||||
public string CurrentSign
|
||||
{
|
||||
get => _currentSign;
|
||||
set
|
||||
{
|
||||
_currentSign = value;
|
||||
UpdateSignInfo();
|
||||
}
|
||||
}
|
||||
|
||||
private void UpdateSignInfo()
|
||||
{
|
||||
if (_currentSign == null)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
if (!_prototypeManager.TryIndex(_currentSign, out BarSignPrototype prototype))
|
||||
{
|
||||
Logger.ErrorS("barSign", $"Invalid bar sign prototype: \"{_currentSign}\"");
|
||||
return;
|
||||
}
|
||||
|
||||
if (!_power.Powered)
|
||||
{
|
||||
_sprite.LayerSetState(0, "empty");
|
||||
}
|
||||
else
|
||||
{
|
||||
_sprite.LayerSetState(0, prototype.Icon);
|
||||
}
|
||||
|
||||
if (!string.IsNullOrEmpty(prototype.Name))
|
||||
{
|
||||
Owner.Name = prototype.Name;
|
||||
}
|
||||
else
|
||||
{
|
||||
Owner.Name = Loc.GetString("bar sign");
|
||||
}
|
||||
|
||||
Owner.Description = prototype.Description;
|
||||
}
|
||||
|
||||
public override void Initialize()
|
||||
{
|
||||
base.Initialize();
|
||||
|
||||
_power = Owner.GetComponent<PowerDeviceComponent>();
|
||||
_sprite = Owner.GetComponent<SpriteComponent>();
|
||||
|
||||
_power.OnPowerStateChanged += PowerOnOnPowerStateChanged;
|
||||
|
||||
UpdateSignInfo();
|
||||
}
|
||||
|
||||
private void PowerOnOnPowerStateChanged(object sender, PowerStateEventArgs e)
|
||||
{
|
||||
UpdateSignInfo();
|
||||
}
|
||||
|
||||
public override void ExposeData(ObjectSerializer serializer)
|
||||
{
|
||||
base.ExposeData(serializer);
|
||||
|
||||
serializer.DataField(ref _currentSign, "current", null);
|
||||
}
|
||||
|
||||
public void MapInit()
|
||||
{
|
||||
if (_currentSign != null)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
var prototypes = _prototypeManager.EnumeratePrototypes<BarSignPrototype>().Where(p => !p.Hidden)
|
||||
.ToList();
|
||||
var prototype = _robustRandom.Pick(prototypes);
|
||||
|
||||
CurrentSign = prototype.ID;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,40 @@
|
||||
using Robust.Shared.Localization;
|
||||
using Robust.Shared.Prototypes;
|
||||
using Robust.Shared.Utility;
|
||||
using YamlDotNet.RepresentationModel;
|
||||
|
||||
namespace Content.Server.GameObjects.Components.BarSign
|
||||
{
|
||||
[Prototype("barSign")]
|
||||
public class BarSignPrototype : IPrototype, IIndexedPrototype
|
||||
{
|
||||
public string ID { get; private set; }
|
||||
public string Icon { get; private set; }
|
||||
public string Name { get; private set; }
|
||||
public string Description { get; private set; }
|
||||
public bool RenameArea { get; private set; } = true;
|
||||
public bool Hidden { get; private set; }
|
||||
|
||||
public void LoadFrom(YamlMappingNode mapping)
|
||||
{
|
||||
ID = mapping.GetNode("id").AsString();
|
||||
Name = Loc.GetString(mapping.GetNode("name").AsString());
|
||||
Icon = mapping.GetNode("icon").AsString();
|
||||
|
||||
if (mapping.TryGetNode("hidden", out var node))
|
||||
{
|
||||
Hidden = node.AsBool();
|
||||
}
|
||||
|
||||
if (mapping.TryGetNode("renameArea", out node))
|
||||
{
|
||||
RenameArea = node.AsBool();
|
||||
}
|
||||
|
||||
if (mapping.TryGetNode("description", out node))
|
||||
{
|
||||
Description = Loc.GetString(node.AsString());
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
191
Resources/Prototypes/BarSigns.yml
Normal file
191
Resources/Prototypes/BarSigns.yml
Normal file
@@ -0,0 +1,191 @@
|
||||
- type: barSign
|
||||
id: MalteseFalcon
|
||||
name: "Maltese Falcon"
|
||||
icon: "maltesefalcon"
|
||||
description: "The Maltese Falcon, Space Bar and Grill."
|
||||
|
||||
- type: barSign
|
||||
id: TheBark
|
||||
name: "The Bark"
|
||||
icon: "thebark"
|
||||
description: "Ian's bar of choice."
|
||||
|
||||
- type: barSign
|
||||
id: Harmbaton
|
||||
name: "The Harmbaton"
|
||||
icon: "theharmbaton"
|
||||
description: "A great dining experience for both security members and assistants."
|
||||
|
||||
- type: barSign
|
||||
id: TheSingulo
|
||||
name: "The Singulo"
|
||||
icon: "thesingulo"
|
||||
description: "Where people go that'd rather not be called by their name."
|
||||
|
||||
- type: barSign
|
||||
id: TheDrunkCarp
|
||||
name: "The Drunk Carp"
|
||||
icon: "thedrunkcarp"
|
||||
description: "Don't drink and swim."
|
||||
|
||||
- type: barSign
|
||||
id: ScotchServinWill
|
||||
name: "Scotch Servin Willy's"
|
||||
icon: "scotchservinwill"
|
||||
description: "Willy sure moved up in the world from clown to bartender."
|
||||
|
||||
- type: barSign
|
||||
id: OfficerBeersky
|
||||
name: "Officer Beersky's"
|
||||
icon: "officerbeersky"
|
||||
description: "Man eat a dong, these drinks are great."
|
||||
|
||||
- type: barSign
|
||||
id: TheCavern
|
||||
name: "The Cavern"
|
||||
icon: "thecavern"
|
||||
description: "Fine drinks while listening to some fine tunes."
|
||||
|
||||
- type: barSign
|
||||
id: TheOuterSpess
|
||||
name: "The Outer Spess"
|
||||
icon: "theouterspess"
|
||||
description: "This bar isn't actually located in outer space."
|
||||
|
||||
- type: barSign
|
||||
id: SlipperyShots
|
||||
name: "Slippery Shots"
|
||||
icon: "slipperyshots"
|
||||
description: "Slippery slope to drunkeness with our shots!"
|
||||
|
||||
- type: barSign
|
||||
id: TheGreyTide
|
||||
name: "The Grey Tide"
|
||||
icon: "thegreytide"
|
||||
description: "Abandon your toolboxing ways and enjoy a lazy beer!"
|
||||
|
||||
- type: barSign
|
||||
id: HonkednLoaded
|
||||
name: "Honked 'n' Loaded"
|
||||
icon: "honkednloaded"
|
||||
description: "Honk."
|
||||
|
||||
- type: barSign
|
||||
id: TheNest
|
||||
name: "The Nest"
|
||||
icon: "thenest"
|
||||
description: "A good place to retire for a drink after a long night of crime fighting."
|
||||
|
||||
- type: barSign
|
||||
id: TheCoderbus
|
||||
name: "The Coderbus"
|
||||
icon: "thecoderbus"
|
||||
description: "A very controversial bar known for its wide variety of constantly-changing drinks."
|
||||
|
||||
- type: barSign
|
||||
id: TheAdminbus
|
||||
name: "The Adminbus"
|
||||
icon: "theadminbus"
|
||||
description: "An establishment visited mainly by space-judges. It isn't bombed nearly as much as court hearings."
|
||||
|
||||
- type: barSign
|
||||
id: OldCockInn
|
||||
name: "The Old Cock Inn"
|
||||
icon: "oldcockinn"
|
||||
description: "Something about this sign fills you with despair."
|
||||
|
||||
- type: barSign
|
||||
id: TheWretchedHive
|
||||
name: "The Wretched Hive"
|
||||
icon: "thewretchedhive"
|
||||
description: "Legally obligated to instruct you to check your drinks for acid before consumption."
|
||||
|
||||
- type: barSign
|
||||
id: RobustaCafe
|
||||
name: "The Robusta Cafe"
|
||||
icon: "robustacafe"
|
||||
description: "Holder of the 'Most Lethal Barfights' record 5 years uncontested."
|
||||
|
||||
- type: barSign
|
||||
id: EmergencyRumParty
|
||||
name: "The Emergency Rum Party"
|
||||
icon: "emergencyrumparty"
|
||||
description: "Recently relicensed after a long closure."
|
||||
|
||||
- type: barSign
|
||||
id: ComboCafe
|
||||
name: "The Combo Cafe"
|
||||
icon: "combocafe"
|
||||
description: "Renowned system-wide for their utterly uncreative drink combinations."
|
||||
|
||||
- type: barSign
|
||||
id: VladsSaladBar
|
||||
name: "Vlad's Salad Bar"
|
||||
icon: "vladssaladbar"
|
||||
description: "Under new management. Vlad was always a bit too trigger happy with that shotgun."
|
||||
|
||||
- type: barSign
|
||||
id: TheShaken
|
||||
name: "The Shaken"
|
||||
icon: "theshaken"
|
||||
description: "This establishment does not serve stirred drinks."
|
||||
|
||||
- type: barSign
|
||||
id: TheAleNath
|
||||
name: "The Ale' Nath"
|
||||
icon: "thealenath"
|
||||
description: "All right, buddy. I think you've had EI NATH. Time to get a cab."
|
||||
|
||||
- type: barSign
|
||||
id: TheAlohaAnackbar
|
||||
name: "The Aloha Snackbar"
|
||||
icon: "alohasnackbar"
|
||||
description: "A tasteful, inoffensive tiki bar sign."
|
||||
|
||||
- type: barSign
|
||||
id: TheNet
|
||||
name: "The Net"
|
||||
icon: "thenet"
|
||||
description: "You just seem to get caught up in it for hours."
|
||||
|
||||
- type: barSign
|
||||
id: MaidCafe
|
||||
name: "Maid Cafe"
|
||||
icon: "maidcafe"
|
||||
description: "Welcome back, master!"
|
||||
|
||||
- type: barSign
|
||||
id: TheLightbulb
|
||||
name: "The Lightbulb"
|
||||
icon: "the_lightbulb"
|
||||
description: "A cafe popular among moths and moffs. Once shut down for a week after the bartender used mothballs to protect her spare uniforms."
|
||||
|
||||
- type: barSign
|
||||
id: Goose
|
||||
name: "The Loose Goose"
|
||||
icon: "goose"
|
||||
description: "Drink till you puke and/or break the laws of reality!"
|
||||
|
||||
# Hidden signs list below this point
|
||||
- type: barSign
|
||||
id: EmpBarSign
|
||||
name: ""
|
||||
icon: "empbarsign"
|
||||
description: "Something has gone very wrong."
|
||||
rename_area: false
|
||||
hidden: true
|
||||
|
||||
- type: barSign
|
||||
id: SyndiBarSign
|
||||
name: "Syndi Cat"
|
||||
icon: "syndibarsign"
|
||||
description: "Syndicate or die."
|
||||
hidden: true
|
||||
|
||||
- type: barSign
|
||||
id: SignOff
|
||||
name: ""
|
||||
icon: "empty"
|
||||
description: "This sign doesn't seem to be on."
|
||||
rename_area: false
|
||||
hidden: true
|
||||
25
Resources/Prototypes/Entities/Buildings/barSign.yml
Normal file
25
Resources/Prototypes/Entities/Buildings/barSign.yml
Normal file
@@ -0,0 +1,25 @@
|
||||
- type: entity
|
||||
id: BarSign
|
||||
name: bar sign
|
||||
components:
|
||||
- type: Clickable
|
||||
- type: InteractionOutline
|
||||
- type: Collidable
|
||||
- type: Sprite
|
||||
drawdepth: WallTops
|
||||
sprite: Buildings/barsign.rsi
|
||||
state: empty
|
||||
- type: Icon
|
||||
sprite: Buildings/barsign.rsi
|
||||
state: empty
|
||||
- type: PowerDevice
|
||||
- type: BarSign
|
||||
|
||||
|
||||
- type: entity
|
||||
id: BarSignMalteseFalcon
|
||||
name: Maltese Falcon
|
||||
parent: BarSign
|
||||
components:
|
||||
- type: BarSign
|
||||
current: MalteseFalcon
|
||||
Reference in New Issue
Block a user