From 62eb7db0c734c57add1712ec934991d49ff99005 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?V=C3=ADctor=20Aguilera=20Puerto?= <6766154+Zumorica@users.noreply.github.com> Date: Fri, 22 Mar 2019 15:03:29 +0100 Subject: [PATCH] Adds Ointment and Brutepack. (#150) * Add Ointment and Brutepack to StackType * Add Ointment and Brutepack sprites * HealingComponent now works correctly with StackComponent * Adds Ointment and Brutepack prototypes * Adds Ointment and Brutepack to stationstation --- .../Components/Healing/HealingComponent.cs | 27 ++++++-- .../Components/Stack/StackComponent.cs | 2 + Resources/Maps/stationstation.yml | 12 ++++ Resources/Prototypes/Entities/Medical.yml | 61 ++++++++++++++++++ Resources/Prototypes/Entities/Medkit.yml | 14 ---- Resources/Textures/Objects/brutepack.png | Bin 0 -> 213 bytes Resources/Textures/Objects/ointment.png | Bin 0 -> 197 bytes 7 files changed, 98 insertions(+), 18 deletions(-) create mode 100644 Resources/Prototypes/Entities/Medical.yml delete mode 100644 Resources/Prototypes/Entities/Medkit.yml create mode 100644 Resources/Textures/Objects/brutepack.png create mode 100644 Resources/Textures/Objects/ointment.png diff --git a/Content.Server/GameObjects/Components/Healing/HealingComponent.cs b/Content.Server/GameObjects/Components/Healing/HealingComponent.cs index b4f28cadfd..d20f9d18ee 100644 --- a/Content.Server/GameObjects/Components/Healing/HealingComponent.cs +++ b/Content.Server/GameObjects/Components/Healing/HealingComponent.cs @@ -1,4 +1,5 @@ using System; +using Content.Server.GameObjects.Components.Stack; using SS14.Shared.GameObjects; using Content.Server.GameObjects.EntitySystems; using SS14.Shared.Interfaces.GameObjects; @@ -36,21 +37,39 @@ namespace Content.Server.GameObjects.Components.Weapon.Melee { return; } - if (attacked.TryGetComponent(out DamageableComponent damagecomponent)) + + if (!attacked.TryGetComponent(out DamageableComponent damagecomponent)) return; + if (Owner.TryGetComponent(out StackComponent stackComponent)) { + if (!stackComponent.Use(1)) + { + Owner.Delete(); + return; + } + damagecomponent.TakeHealing(Damage, Heal); - Owner.Delete(); + return; } + damagecomponent.TakeHealing(Damage, Heal); + Owner.Delete(); } bool IUse.UseEntity(IEntity user) { - if (user.TryGetComponent(out DamageableComponent damagecomponent)) + if (!user.TryGetComponent(out DamageableComponent damagecomponent)) return false; + if (Owner.TryGetComponent(out StackComponent stackComponent)) { + if (!stackComponent.Use(1)) + { + Owner.Delete(); + return false; + } + damagecomponent.TakeHealing(Damage, Heal); - Owner.Delete(); return false; } + damagecomponent.TakeHealing(Damage, Heal); + Owner.Delete(); return false; } } diff --git a/Content.Server/GameObjects/Components/Stack/StackComponent.cs b/Content.Server/GameObjects/Components/Stack/StackComponent.cs index 3911005979..da4d4fd959 100644 --- a/Content.Server/GameObjects/Components/Stack/StackComponent.cs +++ b/Content.Server/GameObjects/Components/Stack/StackComponent.cs @@ -125,5 +125,7 @@ namespace Content.Server.GameObjects.Components.Stack Metal, Glass, Cable, + Ointment, + Brutepack, } } diff --git a/Resources/Maps/stationstation.yml b/Resources/Maps/stationstation.yml index db341e4fbe..6a3c92cb67 100644 --- a/Resources/Maps/stationstation.yml +++ b/Resources/Maps/stationstation.yml @@ -298,6 +298,18 @@ entities: pos: -1.984375,-4.484375 rot: -1.570796 rad type: Transform +- type: Ointment + components: + - grid: 0 + pos: 0.779375,-3.7521875 + rot: -1.570796 rad + type: Transform +- type: Brutepack + components: + - grid: 0 + pos: 1.509375,-3.7521875 + rot: -1.570796 rad + type: Transform - type: Medkit components: - grid: 0 diff --git a/Resources/Prototypes/Entities/Medical.yml b/Resources/Prototypes/Entities/Medical.yml new file mode 100644 index 0000000000..cf5f2ea590 --- /dev/null +++ b/Resources/Prototypes/Entities/Medical.yml @@ -0,0 +1,61 @@ +- type: entity + name: Medkit + parent: BaseItem + id: Medkit + components: + - type: Sprite + texture: Objects/medkit_r.png + - type: Icon + texture: Objects/medkit_r.png + - type: Healing + heal: 100 + damage: Brute + - type: Item + Size: 24 + +- type: entity + name: Medical Stack + id: MedicalStack + parent: BaseItem + components: + - type: Stack + - type: Item + - type: Healing + + +- type: entity + name: Ointment + description: Used to treat those nasty burns. + parent: MedicalStack + id: Ointment + components: + - type: Sprite + texture: Objects/ointment.png + - type: Icon + texture: Objects/ointment.png + - type: Healing + heal: 10 + damage: Heat + - type: Stack + max: 5 + count: 5 + stacktype: enum.StackType.Ointment + + +- type: entity + name: Brutepack + description: Some sterile gauze to wrap around bloody stumps. + parent: MedicalStack + id: Brutepack + components: + - type: Sprite + texture: Objects/brutepack.png + - type: Icon + texture: Objects/brutepack.png + - type: Healing + heal: 10 + damage: Brute + - type: Stack + max: 5 + count: 5 + stacktype: enum.StackType.Brutepack \ No newline at end of file diff --git a/Resources/Prototypes/Entities/Medkit.yml b/Resources/Prototypes/Entities/Medkit.yml deleted file mode 100644 index 325dab1457..0000000000 --- a/Resources/Prototypes/Entities/Medkit.yml +++ /dev/null @@ -1,14 +0,0 @@ -- type: entity - name: Medkit - parent: BaseItem - id: Medkit - components: - - type: Sprite - texture: Objects/medkit_r.png - - type: Icon - texture: Objects/medkit_r.png - - type: Healing - heal: 100 - damage: Brute - - type: Item - Size: 24 \ No newline at end of file diff --git a/Resources/Textures/Objects/brutepack.png b/Resources/Textures/Objects/brutepack.png new file mode 100644 index 0000000000000000000000000000000000000000..1bd215195f0ebc1bb5d8df8f0fc4c0ad3685f53c GIT binary patch literal 213 zcmeAS@N?(olHy`uVBq!ia0vp^3LwnF3?v&v(vJfvxd5LK*H>TuT9}#Lx^?US|NqVn z421`{`~EXbt4uiEANlga&R326AgzogL4Lsu4$p3+0XeCjE{-7@6O$7pUNrh($ literal 0 HcmV?d00001 diff --git a/Resources/Textures/Objects/ointment.png b/Resources/Textures/Objects/ointment.png new file mode 100644 index 0000000000000000000000000000000000000000..413a72304cc83fdaeedd2c6048ed56cdfc883ba6 GIT binary patch literal 197 zcmeAS@N?(olHy`uVBq!ia0vp^3LwnF3?v&v(vJfvi2$Dv*H>Tuetdr*K0e++SNH$_ z|F>@4nlfdI^m2oSf{p)xY8Xp`{DK)Ap4~_Ta-uz5978lFCMQU^Gzi8z1UPsyhPH0Z z7Fs1V*+5i8)n}cjo}UI&;w#msC%k4%x^wz;;FJ|Rr%d0mK*N)L6^Bz8lZmtF(X?eE t%MC)duUxsvvR9Kgl##hv=x_it!?%5WAzR{IJ%H9Qc)I$ztaD0e0su?-MAZNQ literal 0 HcmV?d00001