/// <summary> /// Creates an invisible wall in a free space after some checks. /// </summary> private void OnInvisibleWall(EntityUid uid, MimePowersComponent component, InvisibleWallActionEvent args) { if (!component.Enabled) { return; } var xform = Transform(uid); // Get the tile in front of the mime var offsetValue = xform.LocalRotation.ToWorldVec().Normalized; var coords = xform.Coordinates.Offset(offsetValue).SnapToGrid(EntityManager); // Check there are no walls or mobs there foreach (var entity in coords.GetEntitiesInTile()) { IPhysBody?physics = null; // We use this to check if it's impassable if ((HasComp <MobStateComponent>(entity) && entity != uid) || // Is it a mob? ((Resolve(entity, ref physics, false) && (physics.CollisionLayer & (int)CollisionGroup.Impassable) != 0) && // Is it impassable? !(TryComp <DoorComponent>(entity, out var door) && door.State != DoorState.Closed))) // Is it a door that's open and so not actually impassable? { _popupSystem.PopupEntity(Loc.GetString("mime-invisible-wall-failed"), uid, Filter.Entities(uid)); return; } } _popupSystem.PopupEntity(Loc.GetString("mime-invisible-wall-popup", ("mime", uid)), uid, Filter.Pvs(uid)); // Make sure we set the invisible wall to despawn properly Spawn(component.WallPrototype, coords); // Handle args so cooldown works args.Handled = true; }
private void OnSpeakAttempt(EntityUid uid, MimePowersComponent component, SpeakAttemptEvent args) { if (!component.Enabled) { return; } _popupSystem.PopupEntity(Loc.GetString("mime-cant-speak"), uid, Filter.Entities(uid)); args.Cancel(); }
private void OnComponentInit(EntityUid uid, MimePowersComponent component, ComponentInit args) { _actionsSystem.AddAction(uid, component.InvisibleWallAction, uid); _alertsSystem.ShowAlert(uid, AlertType.VowOfSilence); }