diff --git a/Content.Server/Damage/Components/DamageRandomPopupComponent.cs b/Content.Server/Damage/Components/DamageRandomPopupComponent.cs new file mode 100644 index 0000000000..bcc7f5684b --- /dev/null +++ b/Content.Server/Damage/Components/DamageRandomPopupComponent.cs @@ -0,0 +1,13 @@ +using Content.Server.Damage.Systems; + +namespace Content.Server.Damage.Components; + +[RegisterComponent, Access(typeof(DamageRandomPopupSystem))] +/// +/// Outputs a random pop-up from the list when an object receives damage +/// +public sealed partial class DamageRandomPopupComponent : Component +{ + [DataField, ViewVariables(VVAccess.ReadWrite)] + public List Popups = new(); +} diff --git a/Content.Server/Damage/Systems/DamageRandomPopupSystem.cs b/Content.Server/Damage/Systems/DamageRandomPopupSystem.cs new file mode 100644 index 0000000000..8bdbf84147 --- /dev/null +++ b/Content.Server/Damage/Systems/DamageRandomPopupSystem.cs @@ -0,0 +1,27 @@ +using Content.Server.Damage.Components; +using Content.Server.Popups; +using Content.Shared.Damage; +using Robust.Shared.Player; +using Robust.Shared.Random; + +namespace Content.Server.Damage.Systems; + +/// +/// Outputs a random pop-up from the strings list when an object receives damage +/// +public sealed class DamageRandomPopupSystem : EntitySystem +{ + [Dependency] private readonly PopupSystem _popupSystem = default!; + [Dependency] private readonly IRobustRandom _random = default!; + + public override void Initialize() + { + base.Initialize(); + SubscribeLocalEvent(OnDamageChange); + } + + private void OnDamageChange(EntityUid uid, DamageRandomPopupComponent component, DamageChangedEvent args) + { + _popupSystem.PopupEntity(Loc.GetString(_random.Pick(component.Popups)), uid); + } +} diff --git a/Resources/Locale/en-US/darts/darts-popup.ftl b/Resources/Locale/en-US/darts/darts-popup.ftl new file mode 100644 index 0000000000..82bf7fde53 --- /dev/null +++ b/Resources/Locale/en-US/darts/darts-popup.ftl @@ -0,0 +1,6 @@ +darts-popup-bullseye = Bullseye! 50 points! +darts-popup-25 = 25 points +darts-popup-10 = 10 points +darts-popup-5 = 5 points +darts-popup-1 = 1 point +darts-popup-miss = Miss \ No newline at end of file diff --git a/Resources/Locale/en-US/prototypes/catalog/cargo/cargo-fun.ftl b/Resources/Locale/en-US/prototypes/catalog/cargo/cargo-fun.ftl index d4c1d9ddf6..018a44a8aa 100644 --- a/Resources/Locale/en-US/prototypes/catalog/cargo/cargo-fun.ftl +++ b/Resources/Locale/en-US/prototypes/catalog/cargo/cargo-fun.ftl @@ -17,7 +17,10 @@ ent-FunATV = { ent-CrateFunATV } .desc = { ent-CrateFunATV.desc } ent-FunWaterGuns = { ent-CrateFunWaterGuns } - .desc = { ent-CrateFunWaterGuns.desc } + .desc = { ent-CrateFunWaterGuns.desc } ent-FunParty = { ent-CrateFunParty } - .desc = { ent-CrateFunParty.desc } \ No newline at end of file + .desc = { ent-CrateFunParty.desc } + +ent-FunDartsSet = { ent-CrateFunDartsSet } + .desc = { ent-CrateFunDartsSet.desc } diff --git a/Resources/Locale/en-US/prototypes/catalog/fills/crates/fun-crates.ftl b/Resources/Locale/en-US/prototypes/catalog/fills/crates/fun-crates.ftl index 27bc24853c..1e5e069352 100644 --- a/Resources/Locale/en-US/prototypes/catalog/fills/crates/fun-crates.ftl +++ b/Resources/Locale/en-US/prototypes/catalog/fills/crates/fun-crates.ftl @@ -51,3 +51,6 @@ ent-CrateFunBikeHornImplants = Bike Horn Implants ent-CrateFunMysteryFigurines = Mystery Figure Crate .desc = A collection of 10 Mystery Figurine boxes. Duplicates non refundable. + +ent-CrateFunDartsSet = Dartboard Box Set + .desc = A box with everything you need for a fun game of darts. diff --git a/Resources/Prototypes/Catalog/Cargo/cargo_fun.yml b/Resources/Prototypes/Catalog/Cargo/cargo_fun.yml index 5ea658ffe5..e114545b9d 100644 --- a/Resources/Prototypes/Catalog/Cargo/cargo_fun.yml +++ b/Resources/Prototypes/Catalog/Cargo/cargo_fun.yml @@ -186,4 +186,14 @@ product: CrateFunMysteryFigurines cost: 4000 category: Fun + group: market + +- type: cargoProduct + id: FunDartsSet + icon: + sprite: Objects/Fun/Darts/dart_red.rsi + state: icon + product: CrateFunDartsSet + cost: 900 + category: Fun group: market \ No newline at end of file diff --git a/Resources/Prototypes/Catalog/Fills/Boxes/general.yml b/Resources/Prototypes/Catalog/Fills/Boxes/general.yml index 78d04343b6..d05dfbb4ed 100644 --- a/Resources/Prototypes/Catalog/Fills/Boxes/general.yml +++ b/Resources/Prototypes/Catalog/Fills/Boxes/general.yml @@ -425,4 +425,29 @@ - type: Sprite state: box - type: RadiationBlockingContainer - resistance: 2 \ No newline at end of file + resistance: 2 + +- type: entity + name: darts box + parent: BoxCardboard + id: BoxDarts + description: This box filled with colorful darts. + components: + - type: Item + size: 40 + - type: StorageFill + contents: + - id: Dart + amount: 5 + - id: DartBlue + amount: 5 + - id: DartPurple + amount: 5 + - id: DartYellow + amount: 5 + - type: Storage + capacity: 40 + - type: Sprite + layers: + - state: box + - state: darts \ No newline at end of file diff --git a/Resources/Prototypes/Catalog/Fills/Crates/fun.yml b/Resources/Prototypes/Catalog/Fills/Crates/fun.yml index 23a178b094..48877fd889 100644 --- a/Resources/Prototypes/Catalog/Fills/Crates/fun.yml +++ b/Resources/Prototypes/Catalog/Fills/Crates/fun.yml @@ -290,3 +290,20 @@ - id: MysteryFigureBox amount: 15 prob: 0.05 + +- type: entity + name: Dartboard Box Set + description: A box with everything you need for a fun game of darts. + id: CrateFunDartsSet + parent: CratePlastic + components: + - type: StorageFill + contents: + - id: TargetDarts + amount: 1 + - id: BoxDarts + amount: 1 + - id: BoxDarts + amount: 1 + prob: 0.05 + diff --git a/Resources/Prototypes/Entities/Objects/Fun/darts.yml b/Resources/Prototypes/Entities/Objects/Fun/darts.yml new file mode 100644 index 0000000000..bd4163d974 --- /dev/null +++ b/Resources/Prototypes/Entities/Objects/Fun/darts.yml @@ -0,0 +1,176 @@ +- type: entity + name: dart + description: light throwing dart for playing darts. Don't get in the eye! + parent: BaseItem + id: Dart + components: + - type: EmbeddableProjectile + minimumSpeed: 3 + removalTime: 0.5 + offset: 0.0,0.0 + - type: ThrowingAngle + angle: 315 + - type: Fixtures + fixtures: + fix1: + shape: !type:PolygonShape + vertices: + - -0.20,0.10 + - -0.10,0.20 + - 0.20,-0.10 + - 0.10,-0.20 + density: 20 + mask: + - ItemMask + restitution: 0.3 + friction: 0.2 + - type: Sprite + sprite: Objects/Fun/Darts/dart_red.rsi + state: icon + - type: MeleeWeapon + damage: + types: + Piercing: 2 + angle: 0 + animation: WeaponArcThrust + soundHit: + path: /Audio/Weapons/pierce.ogg + - type: DamageOtherOnHit + damage: + types: + Piercing: 4 + - type: Item + size: 2 + sprite: Objects/Fun/Darts/dart_red.rsi + - type: ItemCooldown + - type: SolutionContainerManager + solutions: + melee: + maxVol: 2 + - type: MeleeChemicalInjector + solution: melee + - type: RefillableSolution + solution: melee + - type: InjectableSolution + solution: melee + - type: SolutionInjectOnCollide + transferAmount: 2 + blockSlots: OUTERCLOTHING + - type: SolutionTransfer + maxTransferAmount: 2 + - type: Damageable + damageContainer: Inorganic + - type: Destructible + thresholds: + - trigger: + !type:DamageTrigger + damage: 30 #excess damage avoids cost of spawning entities. + behaviors: + - !type:DoActsBehavior + acts: [ "Destruction" ] + - trigger: + !type:DamageTrigger + damage: 20 + behaviors: + - !type:PlaySoundBehavior + sound: + collection: GlassBreak + - !type:SpawnEntitiesBehavior + spawn: + PartRodMetal1: + min: 1 + max: 1 + - !type:DoActsBehavior + acts: [ "Destruction" ] + - type: Appearance + - type: SolutionContainerVisuals + maxFillLevels: 1 + fillBaseName: dart + +- type: entity + parent: Dart + id: DartBlue + components: + - type: Sprite + sprite: Objects/Fun/Darts/dart_blue.rsi + - type: Item + sprite: Objects/Fun/Darts/dart_blue.rsi + +- type: entity + parent: Dart + id: DartPurple + components: + - type: Sprite + sprite: Objects/Fun/Darts/dart_purple.rsi + - type: Item + sprite: Objects/Fun/Darts/dart_purple.rsi + +- type: entity + parent: Dart + id: DartYellow + components: + - type: Sprite + sprite: Objects/Fun/Darts/dart_yellow.rsi + - type: Item + sprite: Objects/Fun/Darts/dart_yellow.rsi + +- type: entity + name: dartboard + id: TargetDarts + parent: BaseStructureDynamic + description: A target for playing darts. + components: + - type: Sprite + sprite: Objects/Fun/Darts/target.rsi + state: target_dart + noRot: true + - type: Fixtures + fixtures: + fix1: + shape: + !type:PhysShapeCircle + radius: 0.35 + density: 50 + mask: + - FullTileMask + layer: + - WallLayer + - type: InteractionOutline + - type: Physics + - type: Damageable + - type: DamageRandomPopup + popups: + - darts-popup-bullseye + - darts-popup-25 + - darts-popup-10 + - darts-popup-10 + - darts-popup-5 + - darts-popup-5 + - darts-popup-5 + - darts-popup-1 + - darts-popup-1 + - darts-popup-1 + - darts-popup-miss + - darts-popup-miss + - type: Destructible + thresholds: + - trigger: + !type:DamageTrigger + damage: 500 + behaviors: + - !type:DoActsBehavior + acts: [ "Destruction" ] + - trigger: + !type:DamageTrigger + damage: 300 + behaviors: + - !type:SpawnEntitiesBehavior + spawn: + MaterialWoodPlank: + min: 5 + max: 5 + - !type:PlaySoundBehavior + sound: + path: /Audio/Effects/tree_fell.ogg + - !type:DoActsBehavior + acts: [ "Destruction" ] diff --git a/Resources/Textures/Objects/Fun/Darts/dart_blue.rsi/icon.png b/Resources/Textures/Objects/Fun/Darts/dart_blue.rsi/icon.png new file mode 100644 index 0000000000..2a1cfdbb2b Binary files /dev/null and b/Resources/Textures/Objects/Fun/Darts/dart_blue.rsi/icon.png differ diff --git a/Resources/Textures/Objects/Fun/Darts/dart_blue.rsi/inhand-left.png b/Resources/Textures/Objects/Fun/Darts/dart_blue.rsi/inhand-left.png new file mode 100644 index 0000000000..21a72d1303 Binary files /dev/null and b/Resources/Textures/Objects/Fun/Darts/dart_blue.rsi/inhand-left.png differ diff --git a/Resources/Textures/Objects/Fun/Darts/dart_blue.rsi/inhand-right.png b/Resources/Textures/Objects/Fun/Darts/dart_blue.rsi/inhand-right.png new file mode 100644 index 0000000000..6913eafd62 Binary files /dev/null and b/Resources/Textures/Objects/Fun/Darts/dart_blue.rsi/inhand-right.png differ diff --git a/Resources/Textures/Objects/Fun/Darts/dart_blue.rsi/meta.json b/Resources/Textures/Objects/Fun/Darts/dart_blue.rsi/meta.json new file mode 100644 index 0000000000..a219ffdd17 --- /dev/null +++ b/Resources/Textures/Objects/Fun/Darts/dart_blue.rsi/meta.json @@ -0,0 +1,22 @@ +{ + "version": 1, + "license": "CC-BY-SA-3.0", + "copyright": "Made by TheShuEd (github) for ss14", + "size": { + "x": 32, + "y": 32 + }, + "states": [ + { + "name": "icon" + }, + { + "name": "inhand-left", + "directions": 4 + }, + { + "name": "inhand-right", + "directions": 4 + } + ] +} diff --git a/Resources/Textures/Objects/Fun/Darts/dart_purple.rsi/icon.png b/Resources/Textures/Objects/Fun/Darts/dart_purple.rsi/icon.png new file mode 100644 index 0000000000..589b35772f Binary files /dev/null and b/Resources/Textures/Objects/Fun/Darts/dart_purple.rsi/icon.png differ diff --git a/Resources/Textures/Objects/Fun/Darts/dart_purple.rsi/inhand-left.png b/Resources/Textures/Objects/Fun/Darts/dart_purple.rsi/inhand-left.png new file mode 100644 index 0000000000..21066439d1 Binary files /dev/null and b/Resources/Textures/Objects/Fun/Darts/dart_purple.rsi/inhand-left.png differ diff --git a/Resources/Textures/Objects/Fun/Darts/dart_purple.rsi/inhand-right.png b/Resources/Textures/Objects/Fun/Darts/dart_purple.rsi/inhand-right.png new file mode 100644 index 0000000000..5aa88947a0 Binary files /dev/null and b/Resources/Textures/Objects/Fun/Darts/dart_purple.rsi/inhand-right.png differ diff --git a/Resources/Textures/Objects/Fun/Darts/dart_purple.rsi/meta.json b/Resources/Textures/Objects/Fun/Darts/dart_purple.rsi/meta.json new file mode 100644 index 0000000000..a219ffdd17 --- /dev/null +++ b/Resources/Textures/Objects/Fun/Darts/dart_purple.rsi/meta.json @@ -0,0 +1,22 @@ +{ + "version": 1, + "license": "CC-BY-SA-3.0", + "copyright": "Made by TheShuEd (github) for ss14", + "size": { + "x": 32, + "y": 32 + }, + "states": [ + { + "name": "icon" + }, + { + "name": "inhand-left", + "directions": 4 + }, + { + "name": "inhand-right", + "directions": 4 + } + ] +} diff --git a/Resources/Textures/Objects/Fun/Darts/dart_red.rsi/icon.png b/Resources/Textures/Objects/Fun/Darts/dart_red.rsi/icon.png new file mode 100644 index 0000000000..1fdb737923 Binary files /dev/null and b/Resources/Textures/Objects/Fun/Darts/dart_red.rsi/icon.png differ diff --git a/Resources/Textures/Objects/Fun/Darts/dart_red.rsi/inhand-left.png b/Resources/Textures/Objects/Fun/Darts/dart_red.rsi/inhand-left.png new file mode 100644 index 0000000000..da6906085d Binary files /dev/null and b/Resources/Textures/Objects/Fun/Darts/dart_red.rsi/inhand-left.png differ diff --git a/Resources/Textures/Objects/Fun/Darts/dart_red.rsi/inhand-right.png b/Resources/Textures/Objects/Fun/Darts/dart_red.rsi/inhand-right.png new file mode 100644 index 0000000000..392b36fcc5 Binary files /dev/null and b/Resources/Textures/Objects/Fun/Darts/dart_red.rsi/inhand-right.png differ diff --git a/Resources/Textures/Objects/Fun/Darts/dart_red.rsi/meta.json b/Resources/Textures/Objects/Fun/Darts/dart_red.rsi/meta.json new file mode 100644 index 0000000000..a219ffdd17 --- /dev/null +++ b/Resources/Textures/Objects/Fun/Darts/dart_red.rsi/meta.json @@ -0,0 +1,22 @@ +{ + "version": 1, + "license": "CC-BY-SA-3.0", + "copyright": "Made by TheShuEd (github) for ss14", + "size": { + "x": 32, + "y": 32 + }, + "states": [ + { + "name": "icon" + }, + { + "name": "inhand-left", + "directions": 4 + }, + { + "name": "inhand-right", + "directions": 4 + } + ] +} diff --git a/Resources/Textures/Objects/Fun/Darts/dart_yellow.rsi/icon.png b/Resources/Textures/Objects/Fun/Darts/dart_yellow.rsi/icon.png new file mode 100644 index 0000000000..3e4754c239 Binary files /dev/null and b/Resources/Textures/Objects/Fun/Darts/dart_yellow.rsi/icon.png differ diff --git a/Resources/Textures/Objects/Fun/Darts/dart_yellow.rsi/inhand-left.png b/Resources/Textures/Objects/Fun/Darts/dart_yellow.rsi/inhand-left.png new file mode 100644 index 0000000000..2a948757c3 Binary files /dev/null and b/Resources/Textures/Objects/Fun/Darts/dart_yellow.rsi/inhand-left.png differ diff --git a/Resources/Textures/Objects/Fun/Darts/dart_yellow.rsi/inhand-right.png b/Resources/Textures/Objects/Fun/Darts/dart_yellow.rsi/inhand-right.png new file mode 100644 index 0000000000..fbbfe1e5a8 Binary files /dev/null and b/Resources/Textures/Objects/Fun/Darts/dart_yellow.rsi/inhand-right.png differ diff --git a/Resources/Textures/Objects/Fun/Darts/dart_yellow.rsi/meta.json b/Resources/Textures/Objects/Fun/Darts/dart_yellow.rsi/meta.json new file mode 100644 index 0000000000..a219ffdd17 --- /dev/null +++ b/Resources/Textures/Objects/Fun/Darts/dart_yellow.rsi/meta.json @@ -0,0 +1,22 @@ +{ + "version": 1, + "license": "CC-BY-SA-3.0", + "copyright": "Made by TheShuEd (github) for ss14", + "size": { + "x": 32, + "y": 32 + }, + "states": [ + { + "name": "icon" + }, + { + "name": "inhand-left", + "directions": 4 + }, + { + "name": "inhand-right", + "directions": 4 + } + ] +} diff --git a/Resources/Textures/Objects/Fun/Darts/target.rsi/meta.json b/Resources/Textures/Objects/Fun/Darts/target.rsi/meta.json new file mode 100644 index 0000000000..b8c429548c --- /dev/null +++ b/Resources/Textures/Objects/Fun/Darts/target.rsi/meta.json @@ -0,0 +1,14 @@ +{ + "version": 1, + "license": "CC-BY-SA-3.0", + "copyright": "Made by TheShuEd (github) for ss14", + "size": { + "x": 32, + "y": 32 + }, + "states": [ + { + "name": "target_dart" + } + ] +} diff --git a/Resources/Textures/Objects/Fun/Darts/target.rsi/target_dart.png b/Resources/Textures/Objects/Fun/Darts/target.rsi/target_dart.png new file mode 100644 index 0000000000..578daf14f7 Binary files /dev/null and b/Resources/Textures/Objects/Fun/Darts/target.rsi/target_dart.png differ diff --git a/Resources/Textures/Objects/Storage/boxes.rsi/darts.png b/Resources/Textures/Objects/Storage/boxes.rsi/darts.png new file mode 100644 index 0000000000..fa839457f9 Binary files /dev/null and b/Resources/Textures/Objects/Storage/boxes.rsi/darts.png differ diff --git a/Resources/Textures/Objects/Storage/boxes.rsi/meta.json b/Resources/Textures/Objects/Storage/boxes.rsi/meta.json index 59f2cf9e44..1af32510df 100644 --- a/Resources/Textures/Objects/Storage/boxes.rsi/meta.json +++ b/Resources/Textures/Objects/Storage/boxes.rsi/meta.json @@ -1,7 +1,7 @@ { "version": 1, "license": "CC-BY-SA-3.0", - "copyright": "Taken from tgstation at commit https://github.com/tgstation/tgstation/commit/cc65477c04f7403ca8a457bd5bae69a01abadbf0, encryptokey was taken from Baystation12 at https://github.com/infinitystation/Baystation12/blob/073f678cdce92edb8fcd55f9ffc9f0523bf31506/icons/obj/radio.dmi and modified by lapatison. boxwidetoy, shelltoy, swab, flare, inflatable, trashbag, magazine, holo and forensic created by potato1234x (github) for ss14 based on toys.rsi, mouth_swab.rsi, flare.rsi, inflatable_wall.rsi, trashbag.rsi, caseless_pistol_mag.rsi, guardians.rsi and bureaucracy.rsi respectively", + "copyright": "Taken from tgstation at commit https://github.com/tgstation/tgstation/commit/cc65477c04f7403ca8a457bd5bae69a01abadbf0, encryptokey was taken from Baystation12 at https://github.com/infinitystation/Baystation12/blob/073f678cdce92edb8fcd55f9ffc9f0523bf31506/icons/obj/radio.dmi and modified by lapatison. boxwidetoy, shelltoy, swab, flare, inflatable, trashbag, magazine, holo and forensic created by potato1234x (github) for ss14 based on toys.rsi, mouth_swab.rsi, flare.rsi, inflatable_wall.rsi, trashbag.rsi, caseless_pistol_mag.rsi, guardians.rsi and bureaucracy.rsi respectively, darts made by TheShuEd (github) for ss14", "size": { "x": 32, "y": 32 @@ -196,6 +196,9 @@ }, { "name": "ziptie" + }, + { + "name": "darts" } ] }