forked from space-wizards/space-station-14
-
Notifications
You must be signed in to change notification settings - Fork 156
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Nozzle refactor #1206
Draft
Ady4ik
wants to merge
9
commits into
SerbiaStrong-220:master
Choose a base branch
from
Ady4ik:NozzleFix
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
+163
−11
Draft
Nozzle refactor #1206
Changes from 6 commits
Commits
Show all changes
9 commits
Select commit
Hold shift + click to select a range
c8a318e
First time fix nozzle
Ady4ik 6252d6e
Some changes for SharedSpaySystem.Clothings
Ady4ik e6f2c92
Move spraynozzle from weapons to tools
Ady4ik f531849
Refactor whitelist check
Ady4ik 7f81a61
Rename spaces and methods in SharedSpraySystem
Ady4ik 101d51e
Add OnGetSolution but in not work
Ady4ik cc36ac5
Merge branch 'master' of https://github.com/SerbiaStrong-220/space-st…
Ady4ik b684517
Add more love to Dexler
Ady4ik 5208312
Fix mistakes
Ady4ik File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
27 changes: 27 additions & 0 deletions
27
Content.Shared/SS220/Spray/Components/ClothingSlotSolutionProviderComponent.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
using Content.Shared.Inventory; | ||
using Content.Shared.Whitelist; | ||
using Robust.Shared.GameStates; | ||
using Content.Shared.SS220.Spray.System; | ||
|
||
namespace Content.Shared.SS220.Spray.Components; | ||
|
||
/// <summary> | ||
/// This is used for relaying solition events | ||
/// to an entity in the user's clothing slot. | ||
/// </summary> | ||
[RegisterComponent, NetworkedComponent, Access(typeof(SharedSpraySystem))] | ||
public sealed partial class ClothingSlotSolutionProviderComponent : SolutionProviderComponent | ||
{ | ||
public const string ContainmentSolutionName = "containmentsolution"; | ||
/// <summary> | ||
/// The slot that the ammo provider should be located in. | ||
/// </summary> | ||
[DataField("solutionRequiredSlot", required: true)] | ||
public SlotFlags SolutionRequiredSlot; | ||
|
||
/// <summary> | ||
/// A whitelist for determining whether or not an solution provider is valid. | ||
/// </summary> | ||
[DataField("solutionProviderWhitelist")] | ||
public EntityWhitelist? SolutionProviderWhitelist; | ||
} |
6 changes: 6 additions & 0 deletions
6
Content.Shared/SS220/Spray/Components/SolutionProviderComponent.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
using Robust.Shared.GameStates; | ||
|
||
namespace Content.Shared.SS220.Spray.Components; | ||
|
||
[NetworkedComponent] | ||
public abstract partial class SolutionProviderComponent : Component {} |
11 changes: 11 additions & 0 deletions
11
Content.Shared/SS220/Spray/Events/GetSolutionCountEvent.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
namespace Content.Shared.SS220.Spray.Events; | ||
|
||
/// <summary> | ||
/// Raised on an AmmoProvider to request deets. | ||
/// </summary> | ||
[ByRefEvent] | ||
public struct GetSolutionCountEvent | ||
{ | ||
public int Count; | ||
public int Capacity; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
using Robust.Shared.Map; | ||
using Content.Shared.Weapons.Ranged; | ||
|
||
namespace Content.Shared.SS220.Spray.Events; | ||
|
||
/// <summary> | ||
/// Raised on a gun when it would like to take the specified amount of ammo. | ||
/// </summary> | ||
public sealed class TakeSolutionEvent : EntityEventArgs | ||
{ | ||
public readonly EntityUid? User; | ||
public byte SolutionAmount { get; } | ||
|
||
/// <summary> | ||
/// If no ammo returned what is the reason for it? | ||
/// </summary> | ||
public string? Reason; | ||
|
||
public TakeSolutionEvent(EntityUid? user, byte solutionAmount) | ||
{ | ||
} | ||
|
||
} |
61 changes: 61 additions & 0 deletions
61
Content.Shared/SS220/Spray/Systems/SharedSpraySystem.Clothing.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,61 @@ | ||
using System.Diagnostics.CodeAnalysis; | ||
using Content.Shared.Inventory; | ||
using Content.Shared.SS220.Spray.Components; | ||
using Content.Shared.SS220.Spray.Events; | ||
using Content.Shared.Whitelist; | ||
using Linguini.Bundle.Errors; | ||
using Robust.Shared.Containers; | ||
|
||
namespace Content.Shared.SS220.Spray.System; | ||
|
||
public sealed partial class SharedSpraySystem : EntitySystem | ||
{ | ||
[Dependency] private readonly InventorySystem _inventory = default!; | ||
[Dependency] private readonly SharedContainerSystem _container = default!; | ||
[Dependency] private readonly EntityWhitelistSystem _whitelistSystem = default!; | ||
|
||
public override void Initialize() | ||
{ | ||
SubscribeLocalEvent<ClothingSlotSolutionProviderComponent, TakeSolutionEvent>(OnClothingTakeSolution); | ||
SubscribeLocalEvent<ClothingSlotSolutionProviderComponent, GetSolutionCountEvent>(OnClothingSolutionCount); | ||
} | ||
|
||
private void OnClothingTakeSolution(EntityUid uid, ClothingSlotSolutionProviderComponent component, TakeSolutionEvent args) | ||
{ | ||
if (!TryGetClothingSlotEntity(uid, component, out var entity)) | ||
return; | ||
RaiseLocalEvent(entity.Value, args); | ||
} | ||
|
||
private void OnClothingSolutionCount(EntityUid uid, ClothingSlotSolutionProviderComponent component, ref GetSolutionCountEvent args) | ||
{ | ||
if (!TryGetClothingSlotEntity(uid, component, out var entity)) | ||
return; | ||
RaiseLocalEvent(entity.Value, ref args); | ||
} | ||
|
||
private bool TryGetClothingSlotEntity(EntityUid uid, ClothingSlotSolutionProviderComponent component, [NotNullWhen(true)] out EntityUid? slotEntity) | ||
{ | ||
slotEntity = null; | ||
|
||
if (!_container.TryGetContainingContainer(uid, out var container)) | ||
return false; | ||
var user = container.Owner; | ||
|
||
if (!_inventory.TryGetContainerSlotEnumerator(user, out var enumerator, component.SolutionRequiredSlot)) | ||
return false; | ||
|
||
while (enumerator.NextItem(out var item)) | ||
{ | ||
if (component.SolutionProviderWhitelist == null || | ||
!_whitelistSystem.IsValid(component.SolutionProviderWhitelist, uid)) | ||
continue; | ||
|
||
slotEntity = item; | ||
return true; | ||
} | ||
|
||
return false; | ||
} | ||
} | ||
|
4 changes: 2 additions & 2 deletions
4
...urces/Locale/ru-RU/ss14-ru/prototypes/entities/objects/weapons/guns/basic/spraynozzle.ftl
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,2 @@ | ||
ent-WeaponSprayNozzle = форсунка-распылитель | ||
.desc = Мощное разбрызгивающее устройство, используемое в связке с ранцевым резервуаром с водой. | ||
ent-SprayNozzle = пневматический распылитель высокого давления | ||
.desc = Мощное разбрызгивающее устройство, используемое в связке с ранцевым резервуаром с космическим очистителем. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -6687,7 +6687,7 @@ entities: | |
- type: Transform | ||
pos: -1.5,6.5 | ||
parent: 1 | ||
- proto: WeaponSprayNozzle | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. И это тоже |
||
- proto: SprayNozzle | ||
entities: | ||
- uid: 337 | ||
components: | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
43 changes: 43 additions & 0 deletions
43
Resources/Prototypes/Entities/Objects/Tools/spraynozzle.yml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
- type: entity | ||
id: SprayNozzle | ||
parent: BaseItem | ||
name: spray nozzle | ||
description: A high-powered spray nozzle used in conjunction with a backpack-mounted water tank. | ||
components: | ||
- type: Sprite | ||
sprite: Objects/Weapons/Guns/Basic/spraynozzle.rsi | ||
state: icon | ||
- type: Item | ||
sprite: Objects/Weapons/Guns/Basic/spraynozzle.rsi | ||
size: Normal | ||
# SS220 Nozzle fix begin | ||
#- type: Gun | ||
# cameraRecoilScalar: 0 #no recoil | ||
# fireRate: 4 | ||
# selectedMode: FullAuto | ||
# availableModes: | ||
# - FullAuto | ||
# soundGunshot: | ||
# path: /Audio/Weapons/Guns/Gunshots/water_spray.ogg | ||
- type: UseDelay | ||
- type: Spray | ||
transferAmount: 15 | ||
sprayedPrototype: BigVapor | ||
sprayVelocity: 4 | ||
sprayDistance: 6 | ||
spraySound: | ||
path: /Audio/Effects/spray2.ogg | ||
- type: Drink | ||
solution: spray | ||
ignoreEmpty: true | ||
useSound: | ||
path: /Audio/Effects/spray3.ogg | ||
transferAmount: 10 | ||
- type: SolutionItemStatus | ||
solution: spray | ||
- type: Appearance | ||
- type: ClothingSlotSolutionProvider | ||
solutionRequiredSlot: BACK | ||
solutionProviderWhitelist: | ||
tags: | ||
- NozzleBackTank |
26 changes: 0 additions & 26 deletions
26
Resources/Prototypes/Entities/Objects/Weapons/Guns/Basic/spraynozzle.yml
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Здравствуйте, пожалуйста, не трогайте, мне страшно