diff --git a/Content.Client/Sprite/RandomSpriteSystem.cs b/Content.Client/Sprite/RandomSpriteSystem.cs index 30c0f8622e..04f6681136 100644 --- a/Content.Client/Sprite/RandomSpriteSystem.cs +++ b/Content.Client/Sprite/RandomSpriteSystem.cs @@ -45,14 +45,14 @@ public sealed class RandomSpriteSystem : SharedRandomSpriteSystem if (_reflection.TryParseEnumReference(layer.Key, out var @enum)) { if (!sprite.LayerMapTryGet(@enum, out index, logError: true)) - return; + continue; } else if (!sprite.LayerMapTryGet(layer.Key, out index)) { - if (layer.Key is not string strKey || !int.TryParse(strKey, out index)) + if (layer.Key is not { } strKey || !int.TryParse(strKey, out index)) { Logger.Error($"Invalid key `{layer.Key}` for entity with random sprite {ToPrettyString(uid)}"); - return; + continue; } } diff --git a/Content.Server/Sprite/RandomSpriteSystem.cs b/Content.Server/Sprite/RandomSpriteSystem.cs index 78ac695258..035f7c6903 100644 --- a/Content.Server/Sprite/RandomSpriteSystem.cs +++ b/Content.Server/Sprite/RandomSpriteSystem.cs @@ -1,4 +1,3 @@ -using System.Linq; using Content.Shared.Decals; using Content.Shared.Sprite; using Robust.Shared.GameStates; @@ -27,17 +26,29 @@ public sealed class RandomSpriteSystem: SharedRandomSpriteSystem if (component.Available.Count == 0) return; - var group = _random.Pick(component.Available); - component.Selected.EnsureCapacity(group.Count); - - foreach (var layer in group) + var groups = new List>(); + if (component.GetAllGroups) { - Color? color = null; + groups = component.Available; + } + else + { + groups.Add(_random.Pick(component.Available)); + } - if (!string.IsNullOrEmpty(layer.Value.Color)) - color = _random.Pick(_prototype.Index(layer.Value.Color).Colors.Values); + component.Selected.EnsureCapacity(groups.Count); - component.Selected.Add(layer.Key, (layer.Value.State, color)); + foreach (var group in groups) + { + foreach (var layer in group) + { + Color? color = null; + + if (!string.IsNullOrEmpty(layer.Value.Item2)) + color = _random.Pick(_prototype.Index(layer.Value.Item2).Colors.Values); + + component.Selected.Add(layer.Key, (layer.Value.Item1, color)); + } } Dirty(component); diff --git a/Content.Shared/Sprite/RandomSpriteComponent.cs b/Content.Shared/Sprite/RandomSpriteComponent.cs index d511b2b123..568ab6101c 100644 --- a/Content.Shared/Sprite/RandomSpriteComponent.cs +++ b/Content.Shared/Sprite/RandomSpriteComponent.cs @@ -5,6 +5,13 @@ namespace Content.Shared.Sprite; [RegisterComponent, NetworkedComponent] public sealed class RandomSpriteComponent : Component { + /// + /// Whether or not all groups from are used, + /// or if only one is picked at random. + /// + [DataField("getAllGroups")] + public bool GetAllGroups; + /// /// Available colors based on group, parsed layer enum, state, and color. /// Stored as a list so we can have groups of random sprites (e.g. tech_base + tech_flare for holoparasite) 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 48014ce0ef..d4c1d9ddf6 100644 --- a/Resources/Locale/en-US/prototypes/catalog/cargo/cargo-fun.ftl +++ b/Resources/Locale/en-US/prototypes/catalog/cargo/cargo-fun.ftl @@ -16,5 +16,8 @@ ent-FunBoardGames = { ent-CrateFunBoardGames } ent-FunATV = { ent-CrateFunATV } .desc = { ent-CrateFunATV.desc } +ent-FunWaterGuns = { ent-CrateFunWaterGuns } + .desc = { ent-CrateFunWaterGuns.desc } + ent-FunParty = { ent-CrateFunParty } .desc = { ent-CrateFunParty.desc } \ No newline at end of file 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 5eb24599c2..a79058b40a 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 @@ -37,6 +37,9 @@ ent-CrateFunLightImplants = Light Implants ent-CrateFunParty = Party Crate .desc = An entire party just waiting for you to open it. Includes party favors, party beverages, and even a cake. +ent-CrateFunWaterGuns = Water Gun Crate + .desc = A summer special with a variety of brightly colored water guns. Water not included. + ent-CrateFunSyndicateSegway = Syndicate segway crate .desc = A crate containing a two-wheeler that will help you escape from the security officers. Or not. diff --git a/Resources/Prototypes/Catalog/Cargo/cargo_fun.yml b/Resources/Prototypes/Catalog/Cargo/cargo_fun.yml index 97422e1a41..7d414334e8 100644 --- a/Resources/Prototypes/Catalog/Cargo/cargo_fun.yml +++ b/Resources/Prototypes/Catalog/Cargo/cargo_fun.yml @@ -78,6 +78,16 @@ category: Fun group: market +- type: cargoProduct + id: CrateFunWaterGuns + icon: + sprite: Objects/Weapons/Guns/Pistols/water_pistol.rsi + state: display + product: CrateFunWaterGuns + cost: 750 + category: Fun + group: market + - type: cargoProduct id: FunPlushies icon: diff --git a/Resources/Prototypes/Catalog/Fills/Crates/fun.yml b/Resources/Prototypes/Catalog/Fills/Crates/fun.yml index 0c05dbe582..d1d9c89cd1 100644 --- a/Resources/Prototypes/Catalog/Fills/Crates/fun.yml +++ b/Resources/Prototypes/Catalog/Fills/Crates/fun.yml @@ -186,6 +186,16 @@ amount: 4 - id: KnifePlastic +- type: entity + id: CrateFunWaterGuns + parent: CratePlastic + components: + - type: StorageFill + contents: + - id: WeaponWaterBlaster + - id: WeaponWaterPistol + amount: 5 + - type: entity id: CrateFunSyndicateSegway parent: CrateLivestock diff --git a/Resources/Prototypes/Entities/Objects/Weapons/Guns/Basic/watergun.yml b/Resources/Prototypes/Entities/Objects/Weapons/Guns/Basic/watergun.yml new file mode 100644 index 0000000000..a2a25b56ab --- /dev/null +++ b/Resources/Prototypes/Entities/Objects/Weapons/Guns/Basic/watergun.yml @@ -0,0 +1,104 @@ +- type: entity + id: WeaponWaterGunBase + abstract: true + parent: BaseItem + components: + - type: Sprite + sprite: Objects/Weapons/Guns/Pistols/water_pistol.rsi + - type: Clothing + sprite: Objects/Weapons/Guns/Pistols/water_pistol.rsi + slots: BELT + - type: Item + sprite: Objects/Weapons/Guns/Pistols/water_pistol.rsi + size: 10 + - type: Gun + cameraRecoilScalar: 0 #no recoil + fireRate: 1 + selectedMode: SemiAuto + availableModes: + - SemiAuto + soundGunshot: + path: /Audio/Weapons/Guns/Gunshots/water_spray.ogg + - type: SolutionContainerManager + solutions: + chamber: + maxVol: 50 #5 shots + - type: SolutionAmmoProvider + solutionId: chamber + proto: BulletWaterShot + - type: SolutionTransfer + transferAmount: 10 + maxTransferAmount: 50 + minTransferAmount: 5 + canChangeTransferAmount: true + - type: UserInterface + interfaces: + - key: enum.TransferAmountUiKey.Key + type: TransferAmountBoundUserInterface + - type: DrawableSolution + solution: chamber + - type: RefillableSolution + solution: chamber + - type: DrainableSolution + solution: chamber + - type: ExaminableSolution + solution: chamber + - type: StaticPrice + price: 100 + - type: PhysicalComposition + materialComposition: + Plastic: 150 + +- type: entity + id: WeaponWaterPistol + parent: WeaponWaterGunBase + name: water pistol + description: The dinkiest of water-based weaponry. You swear the trigger doesn't do anything. + components: + - type: Sprite + sprite: Objects/Weapons/Guns/Pistols/water_pistol.rsi + layers: + - state: detail + - state: icon + map: [ "enum.DamageStateVisualLayers.Base" ] + - type: RandomSprite + available: + - enum.DamageStateVisualLayers.Base: + icon: Rainbow + +- type: entity + id: WeaponWaterBlaster + parent: WeaponWaterGunBase + name: water blaster + description: With this bad boy, you'll be the cooleste kid at the summer barbecue. + components: + - type: Gun + cameraRecoilScalar: 0 #no recoil + fireRate: 2 + selectedMode: FullAuto + availableModes: + - FullAuto + soundGunshot: + path: /Audio/Weapons/Guns/Gunshots/water_spray.ogg + - type: SolutionContainerManager + solutions: + chamber: + maxVol: 100 #10 shots + - type: Sprite + sprite: Objects/Weapons/Guns/Pistols/soaker.rsi + layers: + - state: detail1 + - state: detail2 + map: ["enum.PowerDeviceVisualLayers.Powered"] + - state: icon + map: [ "enum.DamageStateVisualLayers.Base" ] + - type: Item + sprite: Objects/Weapons/Guns/Pistols/soaker.rsi + size: 35 + - type: RandomSprite + getAllGroups: true + available: + - enum.DamageStateVisualLayers.Base: + icon: Rainbow + - enum.PowerDeviceVisualLayers.Powered: + detail2: Sixteen \ No newline at end of file diff --git a/Resources/Prototypes/Entities/Objects/Weapons/Guns/Projectiles/projectiles.yml b/Resources/Prototypes/Entities/Objects/Weapons/Guns/Projectiles/projectiles.yml index 82b9c0f9b3..642b4f8d0b 100644 --- a/Resources/Prototypes/Entities/Objects/Weapons/Guns/Projectiles/projectiles.yml +++ b/Resources/Prototypes/Entities/Objects/Weapons/Guns/Projectiles/projectiles.yml @@ -598,7 +598,7 @@ fix1: shape: !type:PhysShapeAabb - bounds: "-0.25,-0.25,0.25,0.25" + bounds: "-0.10,-0.30,0.10,0.15" hard: false mask: - FullTileMask diff --git a/Resources/Textures/Objects/Weapons/Guns/Pistols/soaker.rsi/detail1.png b/Resources/Textures/Objects/Weapons/Guns/Pistols/soaker.rsi/detail1.png new file mode 100644 index 0000000000..ed001bb514 Binary files /dev/null and b/Resources/Textures/Objects/Weapons/Guns/Pistols/soaker.rsi/detail1.png differ diff --git a/Resources/Textures/Objects/Weapons/Guns/Pistols/soaker.rsi/detail2.png b/Resources/Textures/Objects/Weapons/Guns/Pistols/soaker.rsi/detail2.png new file mode 100644 index 0000000000..dc436f301b Binary files /dev/null and b/Resources/Textures/Objects/Weapons/Guns/Pistols/soaker.rsi/detail2.png differ diff --git a/Resources/Textures/Objects/Weapons/Guns/Pistols/soaker.rsi/icon.png b/Resources/Textures/Objects/Weapons/Guns/Pistols/soaker.rsi/icon.png new file mode 100644 index 0000000000..99f79d16f8 Binary files /dev/null and b/Resources/Textures/Objects/Weapons/Guns/Pistols/soaker.rsi/icon.png differ diff --git a/Resources/Textures/Objects/Weapons/Guns/Pistols/soaker.rsi/inhand-left.png b/Resources/Textures/Objects/Weapons/Guns/Pistols/soaker.rsi/inhand-left.png new file mode 100644 index 0000000000..d1d2748f20 Binary files /dev/null and b/Resources/Textures/Objects/Weapons/Guns/Pistols/soaker.rsi/inhand-left.png differ diff --git a/Resources/Textures/Objects/Weapons/Guns/Pistols/soaker.rsi/inhand-right.png b/Resources/Textures/Objects/Weapons/Guns/Pistols/soaker.rsi/inhand-right.png new file mode 100644 index 0000000000..9102333cfd Binary files /dev/null and b/Resources/Textures/Objects/Weapons/Guns/Pistols/soaker.rsi/inhand-right.png differ diff --git a/Resources/Textures/Objects/Weapons/Guns/Pistols/soaker.rsi/meta.json b/Resources/Textures/Objects/Weapons/Guns/Pistols/soaker.rsi/meta.json new file mode 100644 index 0000000000..8652914b03 --- /dev/null +++ b/Resources/Textures/Objects/Weapons/Guns/Pistols/soaker.rsi/meta.json @@ -0,0 +1,28 @@ +{ + "version": 1, + "license": "CC0-1.0", + "copyright": "Created by EmoGarbage404 (github) for Space Station 14", + "size": { + "x": 32, + "y": 32 + }, + "states": [ + { + "name": "detail1" + }, + { + "name": "detail2" + }, + { + "name": "icon" + }, + { + "name": "inhand-left", + "directions": 4 + }, + { + "name": "inhand-right", + "directions": 4 + } + ] +} diff --git a/Resources/Textures/Objects/Weapons/Guns/Pistols/water_pistol.rsi/detail.png b/Resources/Textures/Objects/Weapons/Guns/Pistols/water_pistol.rsi/detail.png new file mode 100644 index 0000000000..dd3be00c06 Binary files /dev/null and b/Resources/Textures/Objects/Weapons/Guns/Pistols/water_pistol.rsi/detail.png differ diff --git a/Resources/Textures/Objects/Weapons/Guns/Pistols/water_pistol.rsi/display.png b/Resources/Textures/Objects/Weapons/Guns/Pistols/water_pistol.rsi/display.png new file mode 100644 index 0000000000..34b9b66347 Binary files /dev/null and b/Resources/Textures/Objects/Weapons/Guns/Pistols/water_pistol.rsi/display.png differ diff --git a/Resources/Textures/Objects/Weapons/Guns/Pistols/water_pistol.rsi/equipped-BELT.png b/Resources/Textures/Objects/Weapons/Guns/Pistols/water_pistol.rsi/equipped-BELT.png new file mode 100644 index 0000000000..34c982eafd Binary files /dev/null and b/Resources/Textures/Objects/Weapons/Guns/Pistols/water_pistol.rsi/equipped-BELT.png differ diff --git a/Resources/Textures/Objects/Weapons/Guns/Pistols/water_pistol.rsi/icon.png b/Resources/Textures/Objects/Weapons/Guns/Pistols/water_pistol.rsi/icon.png new file mode 100644 index 0000000000..ad794d6029 Binary files /dev/null and b/Resources/Textures/Objects/Weapons/Guns/Pistols/water_pistol.rsi/icon.png differ diff --git a/Resources/Textures/Objects/Weapons/Guns/Pistols/water_pistol.rsi/inhand-left.png b/Resources/Textures/Objects/Weapons/Guns/Pistols/water_pistol.rsi/inhand-left.png new file mode 100644 index 0000000000..9a9200b58a Binary files /dev/null and b/Resources/Textures/Objects/Weapons/Guns/Pistols/water_pistol.rsi/inhand-left.png differ diff --git a/Resources/Textures/Objects/Weapons/Guns/Pistols/water_pistol.rsi/inhand-right.png b/Resources/Textures/Objects/Weapons/Guns/Pistols/water_pistol.rsi/inhand-right.png new file mode 100644 index 0000000000..13eed597ec Binary files /dev/null and b/Resources/Textures/Objects/Weapons/Guns/Pistols/water_pistol.rsi/inhand-right.png differ diff --git a/Resources/Textures/Objects/Weapons/Guns/Pistols/water_pistol.rsi/meta.json b/Resources/Textures/Objects/Weapons/Guns/Pistols/water_pistol.rsi/meta.json new file mode 100644 index 0000000000..d6261bf9dc --- /dev/null +++ b/Resources/Textures/Objects/Weapons/Guns/Pistols/water_pistol.rsi/meta.json @@ -0,0 +1,32 @@ +{ + "version": 1, + "license": "CC0-1.0", + "copyright": "Created by EmoGarbage404 (github) for Space Station 14", + "size": { + "x": 32, + "y": 32 + }, + "states": [ + { + "name": "icon" + }, + { + "name": "display" + }, + { + "name": "detail" + }, + { + "name": "inhand-left", + "directions": 4 + }, + { + "name": "inhand-right", + "directions": 4 + }, + { + "name": "equipped-BELT", + "directions": 4 + } + ] +}