Fix toilet suicide messages (#6445)
Co-authored-by: mirrorcult <lunarautomaton6@gmail.com>
This commit is contained in:
@@ -1,4 +1,4 @@
|
||||
using Content.Server.Act;
|
||||
using Content.Server.Act;
|
||||
using Content.Server.Buckle.Components;
|
||||
using Content.Server.Popups;
|
||||
using Content.Server.Storage.Components;
|
||||
@@ -126,22 +126,16 @@ namespace Content.Server.Toilet
|
||||
public SuicideKind Suicide(EntityUid uid, EntityUid victimUid, ToiletComponent? component = null,
|
||||
MetaDataComponent? meta = null, MetaDataComponent? victimMeta = null)
|
||||
{
|
||||
if (!Resolve(uid, ref component, ref meta))
|
||||
return SuicideKind.Special;
|
||||
|
||||
if (!Resolve(uid, ref victimMeta))
|
||||
return SuicideKind.Special;
|
||||
|
||||
// check that victim even have head
|
||||
if (EntityManager.TryGetComponent<SharedBodyComponent>(victimUid, out var body) &&
|
||||
body.HasPartOfType(BodyPartType.Head))
|
||||
{
|
||||
var othersMessage = Loc.GetString("toilet-component-suicide-head-message-others",
|
||||
("victim",victimMeta.Name),("owner", meta.Name));
|
||||
_popupSystem.PopupEntity(othersMessage, uid, Filter.Pvs(victimUid));
|
||||
("victim", victimUid),("owner", uid));
|
||||
_popupSystem.PopupEntity(othersMessage, uid, Filter.Pvs(victimUid).RemoveWhereAttachedEntity(puid => puid == victimUid));
|
||||
|
||||
var selfMessage = Loc.GetString("toilet-component-suicide-head-message",
|
||||
("owner", meta.Name));
|
||||
("owner", uid));
|
||||
_popupSystem.PopupEntity(selfMessage, uid, Filter.Entities(victimUid));
|
||||
|
||||
return SuicideKind.Asphyxiation;
|
||||
@@ -149,11 +143,11 @@ namespace Content.Server.Toilet
|
||||
else
|
||||
{
|
||||
var othersMessage = Loc.GetString("toilet-component-suicide-message-others",
|
||||
("victim", victimMeta.Name),("owner", meta.Name));
|
||||
_popupSystem.PopupEntity(othersMessage, uid, Filter.Pvs(uid));
|
||||
("victim", victimUid),("owner", uid));
|
||||
_popupSystem.PopupEntity(othersMessage, uid, Filter.Pvs(uid).RemoveWhereAttachedEntity(puid => puid == victimUid));
|
||||
|
||||
var selfMessage = Loc.GetString("toilet-component-suicide-message",
|
||||
("owner",meta.Name));
|
||||
("owner", uid));
|
||||
_popupSystem.PopupEntity(selfMessage, uid, Filter.Entities(victimUid));
|
||||
|
||||
return SuicideKind.Blunt;
|
||||
|
||||
Reference in New Issue
Block a user