From d505ce1409d43ba2e1ae2170376faee565e98202 Mon Sep 17 00:00:00 2001 From: Vera Aguilera Puerto Date: Sun, 21 Mar 2021 18:05:35 +0100 Subject: [PATCH] Adds creampie launcher --- .../Components/Nutrition/CreamPieComponent.cs | 6 +++ .../Nutrition/CreamPiedComponent.cs | 4 +- .../Projectiles/ProjectileComponent.cs | 5 ++- .../Weapon/Ranged/Ammunition/AmmoComponent.cs | 1 + Resources/Changelog/Parts/launcher.yml | 4 ++ .../Specific/Engines/PA/particles.yml | 2 +- .../Entities/Objects/Consumable/food.yml | 4 ++ .../Weapons/Guns/Launchers/launchers.yml | 28 +++++++++++++- .../Weapons/Guns/Projectiles/projectiles.yml | 35 ++++++++++++++---- .../Guns/Launchers/pie_cannon.rsi/meta.json | 14 +++++++ .../Launchers/pie_cannon.rsi/piecannon.png | Bin 0 -> 670 bytes RobustToolbox | 2 +- 12 files changed, 90 insertions(+), 15 deletions(-) create mode 100644 Resources/Changelog/Parts/launcher.yml create mode 100644 Resources/Textures/Objects/Weapons/Guns/Launchers/pie_cannon.rsi/meta.json create mode 100644 Resources/Textures/Objects/Weapons/Guns/Launchers/pie_cannon.rsi/piecannon.png diff --git a/Content.Server/GameObjects/Components/Nutrition/CreamPieComponent.cs b/Content.Server/GameObjects/Components/Nutrition/CreamPieComponent.cs index c82479e0d2..4467f31ee6 100644 --- a/Content.Server/GameObjects/Components/Nutrition/CreamPieComponent.cs +++ b/Content.Server/GameObjects/Components/Nutrition/CreamPieComponent.cs @@ -5,6 +5,8 @@ using Content.Shared.Interfaces.GameObjects.Components; using Robust.Shared.Audio; using Robust.Shared.GameObjects; using Robust.Shared.Player; +using Robust.Shared.Serialization.Manager.Attributes; +using Robust.Shared.ViewVariables; namespace Content.Server.GameObjects.Components.Nutrition { @@ -13,6 +15,10 @@ namespace Content.Server.GameObjects.Components.Nutrition { public override string Name => "CreamPie"; + [ViewVariables(VVAccess.ReadWrite)] + [field: DataField("paralyzeTime")] + public float ParalyzeTime { get; set; } = 1f; + public void PlaySound() { SoundSystem.Play(Filter.Pvs(Owner), AudioHelpers.GetRandomFileFromSoundCollection("desecration"), Owner, diff --git a/Content.Server/GameObjects/Components/Nutrition/CreamPiedComponent.cs b/Content.Server/GameObjects/Components/Nutrition/CreamPiedComponent.cs index 12ed187642..bbf48768a5 100644 --- a/Content.Server/GameObjects/Components/Nutrition/CreamPiedComponent.cs +++ b/Content.Server/GameObjects/Components/Nutrition/CreamPiedComponent.cs @@ -51,7 +51,7 @@ namespace Content.Server.GameObjects.Components.Nutrition void IThrowCollide.HitBy(ThrowCollideEventArgs eventArgs) { - if (!eventArgs.Thrown.HasComponent() || CreamPied) return; + if (CreamPied || eventArgs.Thrown.Deleted || !eventArgs.Thrown.TryGetComponent(out CreamPieComponent? creamPie)) return; CreamPied = true; Owner.PopupMessage(Loc.GetString("You have been creamed by {0:theName}!", eventArgs.Thrown)); @@ -59,7 +59,7 @@ namespace Content.Server.GameObjects.Components.Nutrition if (Owner.TryGetComponent(out StunnableComponent? stun)) { - stun.Paralyze(1f); + stun.Paralyze(creamPie.ParalyzeTime); } } } diff --git a/Content.Server/GameObjects/Components/Projectiles/ProjectileComponent.cs b/Content.Server/GameObjects/Components/Projectiles/ProjectileComponent.cs index 9fa7ec69d7..47f5b06fcc 100644 --- a/Content.Server/GameObjects/Components/Projectiles/ProjectileComponent.cs +++ b/Content.Server/GameObjects/Components/Projectiles/ProjectileComponent.cs @@ -31,7 +31,7 @@ namespace Content.Server.GameObjects.Components.Projectiles set => _damages = value; } - [field: DataField("delete_on_collide")] + [field: DataField("deleteOnCollide")] public bool DeleteOnCollide { get; } = true; // Get that juicy FPS hit sound @@ -95,7 +95,8 @@ namespace Content.Server.GameObjects.Components.Projectiles recoilComponent.Kick(direction); } - Owner.Delete(); + if(DeleteOnCollide) + Owner.Delete(); } public override ComponentState GetComponentState(ICommonSession player) diff --git a/Content.Server/GameObjects/Components/Weapon/Ranged/Ammunition/AmmoComponent.cs b/Content.Server/GameObjects/Components/Weapon/Ranged/Ammunition/AmmoComponent.cs index 223c39a383..8968aee8b0 100644 --- a/Content.Server/GameObjects/Components/Weapon/Ranged/Ammunition/AmmoComponent.cs +++ b/Content.Server/GameObjects/Components/Weapon/Ranged/Ammunition/AmmoComponent.cs @@ -176,5 +176,6 @@ namespace Content.Server.GameObjects.Components.Weapon.Ranged.Ammunition Dart, // Placeholder Grenade, Energy, + CreamPie, // I can't wait for this enum to be a prototype type... } } diff --git a/Resources/Changelog/Parts/launcher.yml b/Resources/Changelog/Parts/launcher.yml new file mode 100644 index 0000000000..c18ea7aa31 --- /dev/null +++ b/Resources/Changelog/Parts/launcher.yml @@ -0,0 +1,4 @@ +author: Your_Name_Here +changes: + - type: Add + message: Adds cream pie launcher. Honk! diff --git a/Resources/Prototypes/Entities/Constructible/Specific/Engines/PA/particles.yml b/Resources/Prototypes/Entities/Constructible/Specific/Engines/PA/particles.yml index 04a252a4c9..01e11baf02 100644 --- a/Resources/Prototypes/Entities/Constructible/Specific/Engines/PA/particles.yml +++ b/Resources/Prototypes/Entities/Constructible/Specific/Engines/PA/particles.yml @@ -10,7 +10,7 @@ state: particle0 shader: unshaded - type: Projectile - delete_on_collide: false + deleteOnCollide: false soundHit: /Audio/Weapons/Guns/Hits/bullet_hit.ogg damages: Radiation: 10 diff --git a/Resources/Prototypes/Entities/Objects/Consumable/food.yml b/Resources/Prototypes/Entities/Objects/Consumable/food.yml index 847ab7434a..5414aaf180 100644 --- a/Resources/Prototypes/Entities/Objects/Consumable/food.yml +++ b/Resources/Prototypes/Entities/Objects/Consumable/food.yml @@ -228,6 +228,10 @@ Quantity: 8 - type: Sprite sprite: Objects/Consumable/Food/pie.rsi + - type: Ammo + caliber: CreamPie + caseless: true + projectile: BulletCreampie #- type: entity diff --git a/Resources/Prototypes/Entities/Objects/Weapons/Guns/Launchers/launchers.yml b/Resources/Prototypes/Entities/Objects/Weapons/Guns/Launchers/launchers.yml index c0cda2dbbd..161a49e291 100644 --- a/Resources/Prototypes/Entities/Objects/Weapons/Guns/Launchers/launchers.yml +++ b/Resources/Prototypes/Entities/Objects/Weapons/Guns/Launchers/launchers.yml @@ -23,7 +23,6 @@ map: ["enum.RangedBarrelVisualLayers.Base"] - state: bolt-closed map: ["enum.RangedBarrelVisualLayers.Bolt"] - - type: Item size: 24 sprite: Objects/Weapons/Guns/Launchers/china_lake.rsi @@ -56,7 +55,6 @@ map: ["enum.RangedBarrelVisualLayers.Base"] - state: mag-0 map: ["enum.RangedBarrelVisualLayers.Mag"] - - type: Item size: 24 sprite: Objects/Weapons/Guns/Launchers/rocket.rsi @@ -78,3 +76,29 @@ magState: mag steps: 1 zeroVisible: true + +- type: entity + name: pie cannon + parent: LauncherBase + id: LauncherCreamPie + description: Load cream pie for optimal results. + components: + - type: Sprite + sprite: Objects/Weapons/Guns/Launchers/pie_cannon.rsi + state: piecannon + - type: Item + size: 24 + sprite: Objects/Weapons/Guns/Launchers/pie_cannon.rsi + - type: RangedWeapon + clumsyCheck: false + - type: RevolverBarrel + caliber: CreamPie + currentSelector: Single + allSelectors: + - Single + fillPrototype: FoodBananaCreamPie + fireRate: 5 + capacity: 15 + soundEmpty: /Audio/Weapons/Guns/Empty/empty.ogg + soundGunshot: /Audio/Effects/bang.ogg + soundInsert: /Audio/Items/bikehorn.ogg diff --git a/Resources/Prototypes/Entities/Objects/Weapons/Guns/Projectiles/projectiles.yml b/Resources/Prototypes/Entities/Objects/Weapons/Guns/Projectiles/projectiles.yml index 42cf16a064..f3239aa4c7 100644 --- a/Resources/Prototypes/Entities/Objects/Weapons/Guns/Projectiles/projectiles.yml +++ b/Resources/Prototypes/Entities/Objects/Weapons/Guns/Projectiles/projectiles.yml @@ -150,7 +150,7 @@ state: frag - type: ExplosiveProjectile - type: Projectile - delete_on_collide: false + deleteOnCollide: false - type: Explosive devastationRange: 1 heavyImpactRange: 2 @@ -172,7 +172,7 @@ sprite: Objects/Weapons/Guns/Projectiles/grenade.rsi state: grenade - type: Projectile - delete_on_collide: false + deleteOnCollide: false soundHit: /Audio/Effects/gen_hit.ogg - type: StunnableProjectile paralyzeAmount: 8 @@ -189,7 +189,7 @@ state: grenade - type: ExplosiveProjectile - type: Projectile - delete_on_collide: false + deleteOnCollide: false - type: Explosive devastationRange: 1 heavyImpactRange: 2 @@ -207,7 +207,7 @@ sprite: Objects/Weapons/Guns/Projectiles/grenade.rsi state: grenade - type: Projectile - delete_on_collide: false + deleteOnCollide: false soundHit: /Audio/Effects/flash_bang.ogg - type: FlashProjectile range: 7 @@ -225,7 +225,7 @@ state: grenade - type: ExplosiveProjectile - type: Projectile - delete_on_collide: false + deleteOnCollide: false - type: Explosive devastationRange: 0 heavyImpactRange: 1 @@ -243,7 +243,7 @@ sprite: Objects/Fun/toys.rsi state: foamdart - type: Projectile - delete_on_collide: true + deleteOnCollide: true soundHit: /Audio/Guns/Hits/snap.ogg damages: Blunt: 2 @@ -259,6 +259,27 @@ sprite: Objects/Fun/toys.rsi state: capbullet - type: Projectile - delete_on_collide: true + deleteOnCollide: true damages: Piercing: 0 + +- type: entity + id: BulletCreampie + name: cream pie + parent: BulletBase + description: get creampied, honk!! + abstract: true + components: + - type: Projectile + deleteOnCollide: false # CreamPie component handles this. + - type: CreamPie + - type: ThrownItem + - type: Sprite + netsync: false + sprite: Objects/Consumable/Food/pie.rsi + state: icon + - type: SolutionContainer + contents: + reagents: + - ReagentId: chem.Nutriment + Quantity: 8 diff --git a/Resources/Textures/Objects/Weapons/Guns/Launchers/pie_cannon.rsi/meta.json b/Resources/Textures/Objects/Weapons/Guns/Launchers/pie_cannon.rsi/meta.json new file mode 100644 index 0000000000..310bee7a9b --- /dev/null +++ b/Resources/Textures/Objects/Weapons/Guns/Launchers/pie_cannon.rsi/meta.json @@ -0,0 +1,14 @@ +{ + "version": 1, + "size": { + "x": 32, + "y": 32 + }, + "license": "CC-BY-SA-3.0", + "copyright": "Taken from https://github.com/tgstation/tgstation at dc9cef40447ee86c2b9fff9f690385cd63b655fa", + "states": [ + { + "name": "piecannon" + }, + ] +} diff --git a/Resources/Textures/Objects/Weapons/Guns/Launchers/pie_cannon.rsi/piecannon.png b/Resources/Textures/Objects/Weapons/Guns/Launchers/pie_cannon.rsi/piecannon.png new file mode 100644 index 0000000000000000000000000000000000000000..741faa01c67548f29a1f16eead36590660b1b0ff GIT binary patch literal 670 zcmV;P0%84$P)y zy^9(_7{;Fov9O4RONvqVMz69t4_B;gb`RvRN^@zFN)c_expW~`!lq3f&_E!6Knf9} zWh|p4&24dw3NC^3>flA*G-}Sf^((vU6&cvVm+}2QGw;^`dtQ zrQC%pibATY(p-eqo>kYrOTt+W1VvGn9Qb@bc)eaUn@u)vpV4R(ov*);JvhgQ%nQ(a z22cWlzzC*kZarwW+8B$)$nW>#sU#tOd<+11UHNPqzSD}uVvCSCS?61+l_ZIjqa*yh zzQ*sH8vww^iwh(G+b4gt?MC_V5I??q008eUF987G0KBa}!(=k~7dC($ZeV;BM)u$w zp5aS80dVT^z(2c%S%nJa$ntfk99`|~@EX$S&m&@g-Fcab$oO4dP zu3J8%(yHq2b7~H6Hk+31)k*lhD&U+`xm-p(9tVI$lL?2f(C_z|5aNxK3AeTk2ZO;9 zd}gjX`LfyA2To3Wi#iuVP(GhWtyY6mA}j?MhJjwMhfb%nuxXk``FtM9WD<-qlu9K> zL_EH0Fin%SS}g*A;cy69mXS`U0br3A-EJ3#VSq9Fsj$++e7Mx>^(A|+*MnggXt&!K zjYhT=taZRSr}^n`uU4z&*x23ZgmX@eF%bO?x05sf4}L?!jl%={lK=n!07*qoM6N<$ Ef+MRlsQ>@~ literal 0 HcmV?d00001 diff --git a/RobustToolbox b/RobustToolbox index 92f44b390e..0dac17ae5e 160000 --- a/RobustToolbox +++ b/RobustToolbox @@ -1 +1 @@ -Subproject commit 92f44b390eaf8a62c44f396dc9de3a2a042c99ae +Subproject commit 0dac17ae5e941264fb22ba556d1c5e803f74478e