Draw depth adjustments (#5130)

* door drawdepth toggle

* git mv

* dooooors

* drawdepth adjustments

* fix door and missed projectiles

* firelock depth tweak

* Get sprite only when needed

* single letter typo

* forgot to include closing in _activeDoors.
This commit is contained in:
Leon Friedrich
2021-11-04 02:43:10 +13:00
committed by GitHub
parent 40f866f35c
commit 673301825b
32 changed files with 103 additions and 100 deletions

View File

@@ -0,0 +1,117 @@
using Content.Shared.Interaction;
using Robust.Shared.GameObjects;
namespace Content.Shared.Doors
{
/// <summary>
/// Raised when the door's State variable is changed to a new variable that it was not equal to before.
/// </summary>
public class DoorStateChangedEvent : EntityEventArgs
{
public SharedDoorComponent.DoorState State;
public DoorStateChangedEvent(SharedDoorComponent.DoorState state)
{
State = state;
}
}
/// <summary>
/// Raised when the door is determining whether it is able to open.
/// Cancel to stop the door from being opened.
/// </summary>
public class BeforeDoorOpenedEvent : CancellableEntityEventArgs
{
}
/// <summary>
/// Raised when the door is determining whether it is able to close.
/// Cancel to stop the door from being closed.
/// </summary>
public class BeforeDoorClosedEvent : CancellableEntityEventArgs
{
}
/// <summary>
/// Called when the door is determining whether it is able to deny.
/// Cancel to stop the door from being able to deny.
/// </summary>
public class BeforeDoorDeniedEvent : CancellableEntityEventArgs
{
}
/// <summary>
/// Raised to determine whether the door's safety is on.
/// Modify Safety to set the door's safety.
/// </summary>
public class DoorSafetyEnabledEvent : HandledEntityEventArgs
{
public bool Safety = false;
}
/// <summary>
/// Raised to determine whether the door should automatically close.
/// Cancel to stop it from automatically closing.
/// </summary>
public class BeforeDoorAutoCloseEvent : CancellableEntityEventArgs
{
}
/// <summary>
/// Raised to determine how long the door's pry time should be modified by.
/// Multiply PryTimeModifier by the desired amount.
/// </summary>
public class DoorGetPryTimeModifierEvent : EntityEventArgs
{
public float PryTimeModifier = 1.0f;
}
/// <summary>
/// Raised to determine how long the door's close time should be modified by.
/// Multiply CloseTimeModifier by the desired amount.
/// </summary>
public class DoorGetCloseTimeModifierEvent : EntityEventArgs
{
public float CloseTimeModifier = 1.0f;
}
/// <summary>
/// Raised to determine whether clicking the door should open/close it.
/// </summary>
public class DoorClickShouldActivateEvent : HandledEntityEventArgs
{
public ActivateEventArgs Args;
public DoorClickShouldActivateEvent(ActivateEventArgs args)
{
Args = args;
}
}
/// <summary>
/// Raised when an attempt to pry open the door is made.
/// Cancel to stop the door from being pried open.
/// </summary>
public class BeforeDoorPryEvent : CancellableEntityEventArgs
{
public InteractUsingEventArgs Args;
public BeforeDoorPryEvent(InteractUsingEventArgs args)
{
Args = args;
}
}
/// <summary>
/// Raised when a door is successfully pried open.
/// </summary>
public class OnDoorPryEvent : EntityEventArgs
{
public InteractUsingEventArgs Args;
public OnDoorPryEvent(InteractUsingEventArgs args)
{
Args = args;
}
}
}

View File

@@ -6,25 +6,73 @@ namespace Content.Shared.DrawDepth
[ConstantsFor(typeof(DrawDepthTag))]
public enum DrawDepth
{
LowFloors = DrawDepthTag.Default - 7,
/// <summary>
/// Things that are beneath regular floors, such as wires.
/// This is for sub-floors, the floors you see after prying off a tile.
/// </summary>
LowFloors = DrawDepthTag.Default - 7,
/// <summary>
/// Things that are beneath regular floors, such as wires or pipes. vents/scrubbers also use this to ensure
/// that they appear below carpets.
/// </summary>
BelowFloor = DrawDepthTag.Default - 6,
FloorTiles = DrawDepthTag.Default - 5,
/// <summary>
/// Things that are actually right on the floor, like vents.
/// Used for entities like carpets.
/// </summary>
FloorTiles = DrawDepthTag.Default - 5,
/// <summary>
/// Things that are actually right on the floor, like puddles. This does not mean objects like
/// tables, even though they are technically "on the floor".
/// </summary>
FloorObjects = DrawDepthTag.Default - 4,
Walls = DrawDepthTag.Default - 3,
/// <summary>
/// Used for windows (grilles use walls) and misc signage. Useful if you want to have an APC in the middle
/// of some wall-art or something.
/// </summary>
WallTops = DrawDepthTag.Default - 2,
/// <summary>
/// Posters, APCs, air alarms, etc.
/// </summary>
WallMountedItems = DrawDepthTag.Default - 1,
/// <summary>
/// Furniture, crates, etc.
/// </summary>
Objects = DrawDepthTag.Default,
Items = DrawDepthTag.Default + 1,
Mobs = DrawDepthTag.Default + 2,
HighlightedItems = DrawDepthTag.Default + 3,
Effects = DrawDepthTag.Default + 4,
Ghosts = DrawDepthTag.Default + 5,
Overlays = DrawDepthTag.Default + 6,
/// <summary>
/// In-between an furniture and an item. Useful for entities that need to appear on top of tables, but are
/// not items. E.g., power cell chargers. Also useful for pizza boxes, which appear above crates, but not
/// above the pizza itself.
/// </summary>
SmallObjects = DrawDepthTag.Default + 1,
/// <summary>
/// Generic items. Things that should be above crates & tables, but underneath mobs.
/// </summary>
Items = DrawDepthTag.Default + 2,
Mobs = DrawDepthTag.Default + 3,
Doors = DrawDepthTag.Default + 4,
/// <summary>
/// Explosions, fire, melee swings. Whatever.
/// </summary>
Effects = DrawDepthTag.Default + 5,
Ghosts = DrawDepthTag.Default + 6,
/// <summary>
/// Use this selectively if it absolutely needs to be drawn above (almost) everything else. Examples include
/// the pointing arrow, the drag & drop ghost-entity, and some debug tools.
/// </summary>
Overlays = DrawDepthTag.Default + 7,
}
}