From 5af4c06231d626021789d121a9b948509ab4050b Mon Sep 17 00:00:00 2001 From: Kara D Date: Thu, 5 Aug 2021 21:10:06 -0700 Subject: [PATCH] construction --- .../Completions/SetLayerVisibility.cs | 29 +++ .../Structures/Doors/Windoors/assembly.yml | 80 ++++++ .../Structures/Doors/Windoors/base.yml | 16 +- .../Recipes/Construction/Graphs/windoor.yml | 228 ++++++++++++++++++ .../Recipes/Construction/structures.yml | 42 +++- .../{assembly2.png => assembly.png} | Bin .../Doors/Windoors/windoor.rsi/assembly1.png | Bin 907 -> 0 bytes .../Doors/Windoors/windoor.rsi/meta.json | 3 +- 8 files changed, 388 insertions(+), 10 deletions(-) create mode 100644 Content.Server/Construction/Completions/SetLayerVisibility.cs create mode 100644 Resources/Prototypes/Entities/Structures/Doors/Windoors/assembly.yml create mode 100644 Resources/Prototypes/Recipes/Construction/Graphs/windoor.yml rename Resources/Textures/Structures/Doors/Windoors/windoor.rsi/{assembly2.png => assembly.png} (100%) delete mode 100644 Resources/Textures/Structures/Doors/Windoors/windoor.rsi/assembly1.png diff --git a/Content.Server/Construction/Completions/SetLayerVisibility.cs b/Content.Server/Construction/Completions/SetLayerVisibility.cs new file mode 100644 index 0000000000..3e5c32e794 --- /dev/null +++ b/Content.Server/Construction/Completions/SetLayerVisibility.cs @@ -0,0 +1,29 @@ +using System.Threading.Tasks; +using Content.Shared.Construction; +using Robust.Server.GameObjects; +using Robust.Shared.GameObjects; +using Robust.Shared.Serialization.Manager.Attributes; +using Robust.Shared.Utility; + +namespace Content.Server.Construction.Completions +{ + [DataDefinition] + public class SetLayerVisibility : IGraphAction + { + [DataField("layer")] public int Layer { get; private set; } = 0; + + [DataField("value")] public bool Value { get; private set; } = true; + + public async Task PerformAction(IEntity entity, IEntity? user) + { + if (entity.Deleted) return; + + if (!entity.TryGetComponent(out SpriteComponent? sprite)) return; + + // That layer doesn't exist, we do nothing. + if (sprite.LayerCount <= Layer) return; + + sprite.LayerSetVisible(Layer, Value); + } + } +} diff --git a/Resources/Prototypes/Entities/Structures/Doors/Windoors/assembly.yml b/Resources/Prototypes/Entities/Structures/Doors/Windoors/assembly.yml new file mode 100644 index 0000000000..84c4bf1a55 --- /dev/null +++ b/Resources/Prototypes/Entities/Structures/Doors/Windoors/assembly.yml @@ -0,0 +1,80 @@ +- type: entity + id: WindoorAssembly + name: windoor assembly + description: It opens, it closes, and you can see through it! + parent: BaseStructure + components: + - type: InteractionOutline + - type: Sprite + netsync: false + drawdepth: FloorObjects + sprite: Structures/Doors/Windoors/windoor.rsi + layers: + - state: assembly + - state: panel_open + visible: false + - type: Physics + fixtures: + - shape: + !type:PhysShapeAabb + bounds: "-0.2,-0.49,-0.49,0.49" + mass: 30 + mask: + - Impassable + - VaultImpassable + - type: Anchorable + - type: Pullable + - type: Rotatable + - type: Damageable + resistances: metallicResistances + - type: Destructible + thresholds: + - trigger: + !type:DamageTrigger + damage: 300 + behaviors: + - !type:DoActsBehavior + acts: ["Destruction"] + - !type:SpawnEntitiesBehavior + spawn: + MetalRod: + min: 1 + max: 3 + - type: Construction + graph: windoor + node: assembly + placement: + mode: SnapgridCenter + +- type: entity + id: WindoorAssemblySecure + name: secure windoor assembly + description: It opens, it closes, and you can see through it! This one looks tough. + parent: WindoorAssembly + components: + - type: Sprite + netsync: false + drawdepth: Mobs + sprite: Structures/Doors/Windoors/windoor.rsi + layers: + - state: secure_underlay + - state: assembly + - state: panel_open + visible: false + - type: Destructible + thresholds: + - trigger: + !type:DamageTrigger + damage: 600 + behaviors: + - !type:DoActsBehavior + acts: ["Destruction"] + - !type:SpawnEntitiesBehavior + spawn: + MetalRod: + min: 2 + max: 4 + - type: Construction + graph: windoor + node: assemblySecure + diff --git a/Resources/Prototypes/Entities/Structures/Doors/Windoors/base.yml b/Resources/Prototypes/Entities/Structures/Doors/Windoors/base.yml index a17acd61c6..d4b0e030fd 100644 --- a/Resources/Prototypes/Entities/Structures/Doors/Windoors/base.yml +++ b/Resources/Prototypes/Entities/Structures/Doors/Windoors/base.yml @@ -50,12 +50,16 @@ ShardGlass: min: 1 max: 2 + MetalRod: + min: 1 + max: 3 - !type:DoActsBehavior acts: [ "Destruction" ] - type: AccessReader - type: Airlock openPanelVisible: true - type: Door + weldable: false openSound: path: /Audio/Machines/windoor_open.ogg closeSound: @@ -77,6 +81,9 @@ animatedPanel: false openUnlitVisible: true - type: WiresVisualizer + - type: Construction + graph: windoor + node: windoor - type: entity id: BaseSecureWindoor @@ -118,13 +125,14 @@ ShardGlass: min: 1 max: 2 - - !type:SpawnEntitiesBehavior - spawn: MetalRod: - min: 1 - max: 3 + min: 2 + max: 4 - !type:DoActsBehavior acts: [ "Destruction" ] + - type: Construction + graph: windoor + node: windoorSecure # "0.49,-0.49,-0.49,-0.2" # to: diff --git a/Resources/Prototypes/Recipes/Construction/Graphs/windoor.yml b/Resources/Prototypes/Recipes/Construction/Graphs/windoor.yml new file mode 100644 index 0000000000..4ebd8243fe --- /dev/null +++ b/Resources/Prototypes/Recipes/Construction/Graphs/windoor.yml @@ -0,0 +1,228 @@ +- type: constructionGraph + id: windoor + start: start + graph: + - node: start + edges: + - to: assembly + completed: + - !type:SetAnchor + value: false + steps: + - material: Steel + amount: 4 + doAfter: 2 + - to: assemblySecure + completed: + - !type:SetAnchor + value: false + steps: + - material: Plasteel + amount: 4 + doAfter: 2 + + - node: assembly + entity: WindoorAssembly + actions: + - !type:SnapToGrid {} + - !type:SetAnchor {} + edges: + - to: glass + conditions: + - !type:EntityAnchored {} + steps: + - material: Glass + amount: 5 + doAfter: 1 + - to: start + conditions: + - !type:EntityAnchored + anchored: false + completed: + - !type:SpawnPrototype + prototype: SheetSteel1 + amount: 4 + - !type:DeleteEntity {} + steps: + - tool: Welding + doAfter: 2 + + - node: assemblySecure + entity: WindoorAssemblySecure + actions: + - !type:SnapToGrid { } + - !type:SetAnchor { } + edges: + - to: glassSecure + conditions: + - !type:EntityAnchored { } + steps: + - material: ReinforcedGlass + amount: 5 + doAfter: 1 + - to: start + conditions: + - !type:EntityAnchored + anchored: false + completed: + - !type:SpawnPrototype + prototype: SheetPlasteel1 + amount: 4 + - !type:DeleteEntity { } + steps: + - tool: Welding + doAfter: 10 + + - node: glass + entity: WindoorAssembly + edges: + - to: wired + conditions: + - !type:EntityAnchored { } + completed: + - !type:SetLayerVisibility + layer: 1 + value: true + steps: + - material: Cable + amount: 5 + doAfter: 1 + - to: assembly + conditions: + - !type:EntityAnchored + anchored: false + completed: + - !type:SpawnPrototype + prototype: SheetGlass1 + amount: 5 + - !type:DeleteEntity { } + steps: + - tool: Screwing + doAfter: 2 + + - node: glassSecure + entity: WindoorAssemblySecure + edges: + - to: wiredSecure + conditions: + - !type:EntityAnchored { } + completed: + - !type:SetLayerVisibility + layer: 2 + value: true + steps: + - material: Cable + amount: 5 + doAfter: 1 + - to: assemblySecure + conditions: + - !type:EntityAnchored + anchored: false + completed: + - !type:SpawnPrototype + prototype: SheetRGlass1 + amount: 5 + - !type:DeleteEntity { } + steps: + - tool: Screwing + doAfter: 4 + + - node: wired + entity: WindoorAssembly + edges: + - to: electronics + conditions: + - !type:EntityAnchored {} + steps: + - tag: DoorElectronics + store: board + name: "door electronics circuit board" + icon: + sprite: "Objects/Misc/module.rsi" + state: "door_electronics" + doAfter: 1 + - to: glass + completed: + - !type:SpawnPrototype + prototype: CableApcStack1 + amount: 5 + steps: + - tool: Cutting + doAfter: 1 + + - node: wiredSecure + entity: WindoorAssemblySecure + edges: + - to: electronicsSecure + conditions: + - !type:EntityAnchored {} + steps: + - tag: DoorElectronics + store: board + name: "door electronics circuit board" + icon: + sprite: "Objects/Misc/module.rsi" + state: "door_electronics" + doAfter: 1 + - to: glassSecure + completed: + - !type:SpawnPrototype + prototype: CableApcStack1 + amount: 5 + steps: + - tool: Cutting + doAfter: 3 + + - node: electronics + entity: WindoorAssembly + edges: + - to: windoor + conditions: + - !type:EntityAnchored {} + steps: + - tool: Screwing + doAfter: 2 + + - node: electronicsSecure + entity: WindoorAssemblySecure + edges: + - to: windoorSecure + conditions: + - !type:EntityAnchored { } + steps: + - tool: Screwing + doAfter: 4 + + - node: windoor + entity: Windoor + edges: + - to: wired + conditions: + - !type:EntityAnchored {} + - !type:AirlockBolted + value: false + - !type:WirePanel {} + - !type:ContainerNotEmpty # TODO ShadowCommander: Remove when map gets updated + container: board + completed: + - !type:EmptyAllContainers {} + steps: + - tool: Prying + doAfter: 1 + + - node: windoorSecure + entity: WindoorSecure + edges: + - to: wired + conditions: + - !type:EntityAnchored {} + - !type:AirlockBolted + value: false + - !type:WirePanel {} + - !type:ContainerNotEmpty # TODO ShadowCommander: Remove when map gets updated + container: board + completed: + - !type:EmptyAllContainers {} + steps: + - tool: Prying + doAfter: 4 diff --git a/Resources/Prototypes/Recipes/Construction/structures.yml b/Resources/Prototypes/Recipes/Construction/structures.yml index 2e52a35875..bf0ea9068e 100644 --- a/Resources/Prototypes/Recipes/Construction/structures.yml +++ b/Resources/Prototypes/Recipes/Construction/structures.yml @@ -125,7 +125,7 @@ canRotate: false - type: construction - name: Firelock + name: firelock id: Firelock graph: Firelock startNode: start @@ -142,7 +142,7 @@ - !type:TileNotBlocked {} - type: construction - name: Catwalk + name: catwalk id: Catwalk graph: Catwalk startNode: start @@ -164,7 +164,7 @@ canBuildInImpassable: false - type: construction - name: Wooden Barricade + name: wooden barricade id: Barricade graph: barricade startNode: start @@ -181,7 +181,7 @@ - !type:TileNotBlocked {} - type: construction - name: Airlock + name: airlock id: airlock graph: airlock startNode: start @@ -196,3 +196,37 @@ canBuildInImpassable: false conditions: - !type:TileNotBlocked {} + +- type: construction + name: windoor + id: windoor + graph: windoor + startNode: start + targetNode: windoor + category: Structures + description: It opens, it closes, and you can see through it! + icon: + sprite: Structures/Doors/Windoors/windoor.rsi + state: assembly + objectType: Structure + placementMode: SnapgridCenter + canBuildInImpassable: false + conditions: + - !type:TileNotBlocked {} + +- type: construction + name: secure windoor + id: secureWindoor + graph: windoor + startNode: start + targetNode: windoorSecure + category: Structures + description: It opens, it closes, and you can see through it! This one looks tough. + icon: + sprite: Structures/Doors/Windoors/windoor.rsi + state: assembly + objectType: Structure + placementMode: SnapgridCenter + canBuildInImpassable: false + conditions: + - !type:TileNotBlocked {} diff --git a/Resources/Textures/Structures/Doors/Windoors/windoor.rsi/assembly2.png b/Resources/Textures/Structures/Doors/Windoors/windoor.rsi/assembly.png similarity index 100% rename from Resources/Textures/Structures/Doors/Windoors/windoor.rsi/assembly2.png rename to Resources/Textures/Structures/Doors/Windoors/windoor.rsi/assembly.png diff --git a/Resources/Textures/Structures/Doors/Windoors/windoor.rsi/assembly1.png b/Resources/Textures/Structures/Doors/Windoors/windoor.rsi/assembly1.png deleted file mode 100644 index 4f17d55de44ff2cbb9811c5248ad0701059b7160..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 907 zcmV;619bd}P)(fRu}dHxTM&el76tG2 z(nHO`e;|VNM~KuO^ic0TNMdplswmPz*w&M{u{E^_&5}d0HfFo-8?s?ZVk(lIS$5~U zOg6hPd0)Qy-kX^n0-P~7JA3kMW#vnyQi)GZPmi(gpF07Wg{7A-Hugr24x7>xhyJ+} zu>EFjUXmmjyKvc3!<^A*{Dw&63=E>R(eF9#1n7DVn$0E*4UfXsmI_1BDEvA;X4Y~i zAQp=QDq#5Bd6=A3V2}# zWrN;eL%)l^IK9qhXUtNm7;?LR?gZG#0fd$TOlYWnFl zv6fb%VwzLe?^c~DrIV#22T_POjQj#m!wR9u-iX?t^#oc!6oT* zIt{w60}Y<>q9kvS%DCD^gGs1ggf;Whp8xuDAJy)$(fhWlI zn|D{E5p(3|@Tc_jQT`6=AHX}!kj>|h@7dea5I~T8p%6|a60UZlD2iFH*8vR|JqL#! zDi6sw3k6z>;Lb355Dvq9Ax|?AixkOZE}*I^O||GXXt>zoutViRi+uD1G)AX)uz>3X zV1IMr%ER&ME_`04Gih(w7Qw;xw5D zS^>WG04Ib82n7fQ2n7fQ2n7fQ2n7fQ2n7fQblnS-0(v1(3h0H1@PKXwuy{koyB;9R zhVPEd{BIWMe0^t-@TLMBZ>reAyEPoRE8y+=`oZg+=KG1SpCO*UMYqi+K5fIOq8Q7n z3T_{w;;w*XGFdxY+cOS+e1rY{?=U`okshSPvxGSYuMcon!2QL=E189*4~AjTLzLL! hMk*ep#9d{#@dtbV0@0c%nC$=n002ovPDHLkV1l20iOT>0 diff --git a/Resources/Textures/Structures/Doors/Windoors/windoor.rsi/meta.json b/Resources/Textures/Structures/Doors/Windoors/windoor.rsi/meta.json index 71193ffebe..494b341f91 100644 --- a/Resources/Textures/Structures/Doors/Windoors/windoor.rsi/meta.json +++ b/Resources/Textures/Structures/Doors/Windoors/windoor.rsi/meta.json @@ -3,8 +3,7 @@ "size": {"x":32,"y":32}, "states": [ - {"name":"assembly2","directions":4,"delays":[[0.3,0.3],[0.3,0.3],[0.3,0.3],[0.3,0.3]]}, - {"name":"assembly1","directions":4}, + {"name":"assembly","directions":4,"delays":[[0.3,0.3],[0.3,0.3],[0.3,0.3],[0.3,0.3]]}, {"name":"closed","directions":4}, {"name":"closed_unlit","directions":4}, {"name":"closing","directions":4,"delays":[[0.1,0.1,0.1,0.1,0.1,0.1,0.1],[0.1,0.1,0.1,0.1,0.1,0.1,0.1],[0.1,0.1,0.1,0.1,0.1,0.1,0.1],[0.1,0.1,0.1,0.1,0.1,0.1,0.1]]},