General slime improvements (#23425)
* General slime improvements * Finish morphing * oops 2x2 not 3x3 * actually lets ball - 2x3 inventory * Last two things on the todo list * .\RobustToolbox\ * JUST COMPILE * fix tests 2.0 * fix tests 3.0 * Do reviews * minor change * guideboob * more --------- Co-authored-by: Kara <lunarautomaton6@gmail.com>
This commit is contained in:
40
Content.Server/Geras/GerasSystem.cs
Normal file
40
Content.Server/Geras/GerasSystem.cs
Normal file
@@ -0,0 +1,40 @@
|
||||
using Content.Server.Actions;
|
||||
using Content.Server.Polymorph.Systems;
|
||||
using Content.Server.Popups;
|
||||
using Content.Shared.Actions;
|
||||
using Content.Shared.Geras;
|
||||
using Robust.Shared.Player;
|
||||
|
||||
namespace Content.Server.Geras;
|
||||
|
||||
/// <inheritdoc/>
|
||||
public sealed class GerasSystem : SharedGerasSystem
|
||||
{
|
||||
[Dependency] private readonly ActionsSystem _actionsSystem = default!;
|
||||
[Dependency] private readonly PolymorphSystem _polymorphSystem = default!;
|
||||
[Dependency] private readonly PopupSystem _popupSystem = default!;
|
||||
|
||||
/// <inheritdoc/>
|
||||
public override void Initialize()
|
||||
{
|
||||
SubscribeLocalEvent<GerasComponent, MorphIntoGeras>(OnMorphIntoGeras);
|
||||
SubscribeLocalEvent<GerasComponent, MapInitEvent>(OnMapInit);
|
||||
}
|
||||
|
||||
private void OnMapInit(EntityUid uid, GerasComponent component, MapInitEvent args)
|
||||
{
|
||||
// try to add geras action
|
||||
_actionsSystem.AddAction(uid, ref component.GerasActionEntity, component.GerasAction);
|
||||
}
|
||||
|
||||
private void OnMorphIntoGeras(EntityUid uid, GerasComponent component, MorphIntoGeras args)
|
||||
{
|
||||
var ent = _polymorphSystem.PolymorphEntity(uid, component.GerasPolymorphId);
|
||||
|
||||
if (!ent.HasValue)
|
||||
return;
|
||||
|
||||
_popupSystem.PopupEntity(Loc.GetString("geras-popup-morph-message-others", ("entity", ent.Value)), ent.Value, Filter.PvsExcept(ent.Value), true);
|
||||
_popupSystem.PopupEntity(Loc.GetString("geras-popup-morph-message-user"), ent.Value, ent.Value);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user