Add inflatable door (#6393)

Co-authored-by: fishfish458 <fishfish458>
This commit is contained in:
Fishfish458
2022-02-08 15:54:14 -06:00
committed by GitHub
parent 91a9d474c6
commit 997a500fc3
25 changed files with 375 additions and 67 deletions

View File

@@ -251,7 +251,7 @@ namespace Content.Client.Entry
"GhostOnMove",
"RandomSpawner",
"SpawnAfterInteract",
"DisassembleOnActivate",
"DisassembleOnAltVerb",
"ExplosionLaunched",
"BeingCloned",
"Advertise",

View File

@@ -8,7 +8,7 @@ using Robust.Shared.ViewVariables;
namespace Content.Server.Engineering.Components
{
[RegisterComponent]
public class DisassembleOnActivateComponent : Component
public class DisassembleOnAltVerbComponent : Component
{
[ViewVariables]
[DataField("prototype", customTypeSerializer: typeof(PrototypeIdSerializer<EntityPrototype>))]

View File

@@ -1,59 +0,0 @@
using Content.Server.DoAfter;
using Content.Server.Engineering.Components;
using Content.Server.Hands.Components;
using Content.Shared.Interaction;
using Content.Shared.Interaction.Helpers;
using Content.Shared.Item;
using JetBrains.Annotations;
using Robust.Shared.GameObjects;
namespace Content.Server.Engineering.EntitySystems
{
[UsedImplicitly]
public class DisassembleOnActivateSystem : EntitySystem
{
public override void Initialize()
{
base.Initialize();
SubscribeLocalEvent<DisassembleOnActivateComponent, ActivateInWorldEvent>(HandleActivateInWorld);
}
private async void HandleActivateInWorld(EntityUid uid, DisassembleOnActivateComponent component, ActivateInWorldEvent args)
{
if (string.IsNullOrEmpty(component.Prototype))
return;
if (!args.User.InRangeUnobstructed(args.Target))
return;
if (component.DoAfterTime > 0 && TryGet<DoAfterSystem>(out var doAfterSystem))
{
var doAfterArgs = new DoAfterEventArgs(args.User, component.DoAfterTime, component.TokenSource.Token)
{
BreakOnUserMove = true,
BreakOnStun = true,
};
var result = await doAfterSystem.WaitDoAfter(doAfterArgs);
if (result != DoAfterStatus.Finished)
return;
component.TokenSource.Cancel();
}
if (component.Deleted || Deleted(component.Owner))
return;
var entity = EntityManager.SpawnEntity(component.Prototype, EntityManager.GetComponent<TransformComponent>(component.Owner).Coordinates);
if (EntityManager.TryGetComponent<HandsComponent?>(args.User, out var hands)
&& EntityManager.TryGetComponent<SharedItemComponent?>(entity, out var item))
{
hands.PutInHandOrDrop(item);
}
EntityManager.DeleteEntity(component.Owner);
return;
}
}
}

View File

@@ -0,0 +1,80 @@
using Content.Server.DoAfter;
using Content.Server.Engineering.Components;
using Content.Server.Hands.Components;
using Content.Shared.Interaction.Helpers;
using Content.Shared.Item;
using Content.Shared.Verbs;
using Robust.Shared.GameObjects;
using Robust.Shared.Localization;
using JetBrains.Annotations;
namespace Content.Server.Engineering.EntitySystems
{
[UsedImplicitly]
public class DisassembleOnAltVerbSystem : EntitySystem
{
public override void Initialize()
{
base.Initialize();
SubscribeLocalEvent<DisassembleOnAltVerbComponent, GetAlternativeVerbsEvent>(AddDisassembleVerb);
}
private void AddDisassembleVerb(EntityUid uid, DisassembleOnAltVerbComponent component, GetAlternativeVerbsEvent args)
{
if (!args.CanInteract)
return;
Verb verb = new()
{
Act = () =>
{
AttemptDisassemble(uid, args.User, args.Target, component);
},
Text = Loc.GetString("disassemble-system-verb-disassemble"),
Priority = 2
};
args.Verbs.Add(verb);
}
public async void AttemptDisassemble(EntityUid uid, EntityUid user, EntityUid target, DisassembleOnAltVerbComponent? component = null)
{
if (!Resolve(uid, ref component))
return;
if (string.IsNullOrEmpty(component.Prototype))
return;
if (!user.InRangeUnobstructed(target))
return;
if (component.DoAfterTime > 0 && TryGet<DoAfterSystem>(out var doAfterSystem))
{
var doAfterArgs = new DoAfterEventArgs(user, component.DoAfterTime, component.TokenSource.Token)
{
BreakOnUserMove = true,
BreakOnStun = true,
};
var result = await doAfterSystem.WaitDoAfter(doAfterArgs);
if (result != DoAfterStatus.Finished)
return;
component.TokenSource.Cancel();
}
if (component.Deleted || Deleted(component.Owner))
return;
if (!TryComp<TransformComponent>(component.Owner, out var transformComp))
return;
var entity = EntityManager.SpawnEntity(component.Prototype, transformComp.Coordinates);
if (TryComp<HandsComponent?>(user, out var hands)
&& TryComp<SharedItemComponent?>(entity, out var item))
{
hands.PutInHandOrDrop(item);
}
EntityManager.DeleteEntity(component.Owner);
return;
}
}
}

Binary file not shown.

Binary file not shown.

View File

@@ -0,0 +1 @@
disassemble-system-verb-disassemble = Disassemble

View File

@@ -171,3 +171,20 @@
- type: Storage
capacity: 30
size: 30
- type: entity
name: inflatable wall box
parent: BoxCardboard
id: BoxInflatable
description: Inflatable walls are not to be used as floatation devices.
components:
- type: StorageFill
contents:
- id: InflatableWallStack
amount: 2
- id: InflatableDoorStack
amount: 2
- type: Sprite
layers:
- state: box
- state: writing

View File

@@ -81,6 +81,4 @@
components:
- type: StorageFill
contents:
- id: InflatableWallStack
amount: 3
- id: BoxInflatable

View File

@@ -8,4 +8,5 @@
Multitool: 4
PowerCellSmallHigh: 5
ClothingHandsGlovesColorYellow: 6
InflatableWallStack1: 24
InflatableDoorStack1: 8

View File

@@ -32,7 +32,7 @@
behaviors:
- !type:DoActsBehavior
acts: [ "Destruction" ]
- type: DisassembleOnActivate
- type: DisassembleOnAltVerb
prototype: InflatableWallStack1
doAfter: 3
- type: Airtight
@@ -40,3 +40,47 @@
anchored: true
placement:
mode: SnapgridCenter
- type: entity
id: InflatableDoor
name: inflatable door
parent: BaseMaterialDoor
description: An inflated membrane. Activate to deflate. Now with a door. Do not puncture.
components:
- type: Clickable
- type: InteractionOutline
- type: Sprite
sprite: Objects/Misc/inflatable_door.rsi
state: closed
- type: Physics
bodyType: Static
- type: Fixtures
fixtures:
- shape:
!type:PhysShapeAabb
bounds: "-0.5,-0.5,0.5,0.5"
mass: 15
layer:
- Impassable
- MobImpassable
- VaultImpassable
- SmallImpassable
- type: Door
openSound:
path: /Audio/Misc/zip.ogg
closeSound:
path: /Audio/Misc/zip.ogg
- type: Damageable
damageContainer: Inorganic
damageModifierSet: Inflatable
- type: Destructible
thresholds:
- trigger:
!type:DamageTrigger
damage: 20
behaviors:
- !type:DoActsBehavior
acts: [ "Destruction" ]
- type: DisassembleOnAltVerb
prototype: InflatableDoorStack1
doAfter: 3

View File

@@ -7,6 +7,8 @@
components:
- type: Stack
stackType: InflatableWall
count: 10
max: 10
- type: Sprite
sprite: Objects/Misc/inflatable_wall.rsi
state: item_wall
@@ -27,6 +29,30 @@
# - coillv-20
# - coillv-30
- type: entity
id: InflatableDoorStack
parent: BaseItem
name: inflatable door
description: A folded membrane which rapidly expands into a large cubical shape on activation.
suffix: Full
components:
- type: Stack
stackType: InflatableDoor
count: 4
max: 4
- type: Sprite
sprite: Objects/Misc/inflatable_door.rsi
state: item_door
netsync: false
- type: Item
sprite: Objects/Misc/inflatable_door.rsi
size: 5
- type: SpawnAfterInteract
prototype: InflatableDoor
doAfter: 1
removeOnInteract: true
- type: Clickable
- type: entity
parent: InflatableWallStack
id: InflatableWallStack1
@@ -38,3 +64,15 @@
size: 5
- type: Stack
count: 1
- type: entity
parent: InflatableDoorStack
id: InflatableDoorStack1
suffix: 1
components:
- type: Sprite
state: item_door
- type: Item
size: 5
- type: Stack
count: 1

View File

@@ -0,0 +1,66 @@
- type: entity
id: BaseMaterialDoor
parent: BaseStructure
name: door
abstract: true
description: A door, where will it lead?
components:
- type: Sprite
netsync: false
sprite: Structures/Doors/MineralDoors/wood_door.rsi
layers:
- state: closed
map: ["enum.DoorVisualLayers.Base"]
- type: Physics
- type: Fixtures
fixtures:
- shape:
!type:PhysShapeAabb
bounds: "-0.49,-0.49,0.49,0.49"
mass: 100
mask:
- MobImpassable
layer:
- Opaque
- Impassable
- MobImpassable
- VaultImpassable
- SmallImpassable
- type: Door
bumpOpen: false
clickOpen: true
weldable: false
closeTimeOne: 0.2
closeTimeTwo: 0.6
openTimeOne: 0.6
openTimeTwo: 0.2
openSound:
path: /Audio/Effects/door_open.ogg
closeSound:
path: /Audio/Effects/door_close.ogg
- type: Appearance
visuals:
- type: AirlockVisualizer
simpleVisuals: true
animationTime: 1.2
- type: Airtight
fixVacuum: true
- type: Damageable
damageContainer: Inorganic
damageModifierSet: Wood
- type: Destructible
thresholds:
- trigger:
!type:DamageTrigger
damage: 100
behaviors:
- !type:DoActsBehavior
acts: ["Destruction"]
- type: IconSmooth
key: walls
mode: NoSprite
- type: entity
id: WoodDoor
name: wooden door
parent: BaseMaterialDoor

View File

@@ -2,3 +2,8 @@
id: InflatableWall
name: inflatable wall
spawn: InflatableWallStack1
- type: stack
id: InflatableDoor
name: inflatable door
spawn: InflatableDoorStack1

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.0 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 5.7 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 6.7 KiB

View File

@@ -0,0 +1,60 @@
{
"version": 1,
"license": "CC-BY-SA-3.0",
"copyright": "Taken from cev-eris at https://github.com/discordia-space/CEV-Eris/commit/eb0d3b2552537b2be044c6bf42e5c65268ee0e56#diff-5275f19fb0944c478cdc6b46be5312df20b6c6e82d0d21114a452c3689fb6fb3 | item_door by ShadowCommander slightly modified by Fishfish458",
"size": {
"x": 32,
"y": 32
},
"states": [
{
"name": "closed",
"directions": 1,
"delays": [
[
1.0
]
]
},
{
"name": "closing",
"directions": 1,
"delays": [
[
0.2,
0.2,
0.2,
0.2,
0.2,
0.2
]
]
},
{
"name": "open",
"directions": 1,
"delays": [
[
1.0
]
]
},
{
"name": "opening",
"directions": 1,
"delays": [
[
0.2,
0.2,
0.2,
0.2,
0.2,
0.2
]
]
},
{
"name": "item_door"
}
]
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 933 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 5.5 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.6 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.2 KiB

View File

@@ -0,0 +1,57 @@
{
"version": 1,
"license": "CC-BY-SA-3.0",
"copyright": "Taken from Tgstation https://github.com/tgstation/tgstation/commit/a5eaa18d2192ef9dd7c8d5b8f4ff22bcf304cdd1#diff-4713a9070dd0da77d2f0932685db4d445073695edb05bb49ff96240cbe355036",
"size": {
"x": 32,
"y": 32
},
"states": [
{
"name": "closed",
"directions": 1,
"delays": [
[
1.0
]
]
},
{
"name": "closing",
"directions": 1,
"delays": [
[
0.2,
0.2,
0.2,
0.2,
0.2,
0.2
]
]
},
{
"name": "open",
"directions": 1,
"delays": [
[
1.0
]
]
},
{
"name": "opening",
"directions": 1,
"delays": [
[
0.2,
0.2,
0.2,
0.2,
0.2,
0.2
]
]
}
]
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.8 KiB