Suicide2 (#8117)
* Fix toilet suicide * Fix ghost ghosting * Clean suicide system
This commit is contained in:
@@ -43,7 +43,34 @@ namespace Content.Server.Toilet
|
||||
|
||||
private void OnSuicide(EntityUid uid, ToiletComponent component, SuicideEvent args)
|
||||
{
|
||||
Suicide(component.Owner, uid, component);
|
||||
if (args.Handled) return;
|
||||
|
||||
// Check that victim has a head
|
||||
if (EntityManager.TryGetComponent<SharedBodyComponent>(args.Victim, out var body) &&
|
||||
body.HasPartOfType(BodyPartType.Head))
|
||||
{
|
||||
var othersMessage = Loc.GetString("toilet-component-suicide-head-message-others",
|
||||
("victim", args.Victim), ("owner", uid));
|
||||
_popupSystem.PopupEntity(othersMessage, uid, Filter.Pvs(args.Victim).RemoveWhereAttachedEntity(puid => puid == args.Victim));
|
||||
|
||||
var selfMessage = Loc.GetString("toilet-component-suicide-head-message",
|
||||
("owner", uid));
|
||||
_popupSystem.PopupEntity(selfMessage, uid, Filter.Entities(args.Victim));
|
||||
|
||||
args.SetHandled(SuicideKind.Asphyxiation);
|
||||
}
|
||||
else
|
||||
{
|
||||
var othersMessage = Loc.GetString("toilet-component-suicide-message-others",
|
||||
("victim", args.Victim), ("owner", uid));
|
||||
_popupSystem.PopupEntity(othersMessage, uid, Filter.Pvs(uid).RemoveWhereAttachedEntity(puid => puid == args.Victim));
|
||||
|
||||
var selfMessage = Loc.GetString("toilet-component-suicide-message",
|
||||
("owner", uid));
|
||||
_popupSystem.PopupEntity(selfMessage, uid, Filter.Entities(args.Victim));
|
||||
|
||||
args.SetHandled(SuicideKind.Blunt);
|
||||
}
|
||||
}
|
||||
|
||||
private void OnInit(EntityUid uid, ToiletComponent component, ComponentInit args)
|
||||
@@ -130,37 +157,6 @@ namespace Content.Server.Toilet
|
||||
}
|
||||
}
|
||||
|
||||
public SuicideKind Suicide(EntityUid uid, EntityUid victimUid, ToiletComponent? component = null,
|
||||
MetaDataComponent? meta = null, MetaDataComponent? victimMeta = null)
|
||||
{
|
||||
// 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", victimUid),("owner", uid));
|
||||
_popupSystem.PopupEntity(othersMessage, uid, Filter.Pvs(victimUid).RemoveWhereAttachedEntity(puid => puid == victimUid));
|
||||
|
||||
var selfMessage = Loc.GetString("toilet-component-suicide-head-message",
|
||||
("owner", uid));
|
||||
_popupSystem.PopupEntity(selfMessage, uid, Filter.Entities(victimUid));
|
||||
|
||||
return SuicideKind.Asphyxiation;
|
||||
}
|
||||
else
|
||||
{
|
||||
var othersMessage = Loc.GetString("toilet-component-suicide-message-others",
|
||||
("victim", victimUid),("owner", uid));
|
||||
_popupSystem.PopupEntity(othersMessage, uid, Filter.Pvs(uid).RemoveWhereAttachedEntity(puid => puid == victimUid));
|
||||
|
||||
var selfMessage = Loc.GetString("toilet-component-suicide-message",
|
||||
("owner", uid));
|
||||
_popupSystem.PopupEntity(selfMessage, uid, Filter.Entities(victimUid));
|
||||
|
||||
return SuicideKind.Blunt;
|
||||
}
|
||||
}
|
||||
|
||||
private void OnToiletInterrupt(ToiletPryInterrupted ev)
|
||||
{
|
||||
if (!EntityManager.TryGetComponent(ev.Uid, out ToiletComponent? toilet))
|
||||
|
||||
Reference in New Issue
Block a user