ItemToggle system expansion (#22369)

* Fixed EnergySword and variants having incorrect sound on attacking when in their Off state.

* Removed the unused ItemToggle from the serverside and created a new shared ItemToggleComponent and System, now used for the e-blade family of items. Also added e-blade hum and swing sounds. Thanks Sloth for the initial code!

* Changing Stunbaton system to include the itemToggle system.

* Adapted changes that have come up in the meantime.

* Changed damagespecifier to be serializable and autoNetworked in melee weapon components. Fixes a bug that makes it so client-side, damage values are not updated on toggle.

* Made the ItemToggleSystem have both a shared and a server component. Ported the Stun Baton and Stun Prod to the new toggleable system. Added a failure to activate noise component.

* Ported the welders to the new item toggle system. Set it so deactivated damage and item size default to the item's regular options.

* Removed unnecessary usings.

* Small modification to the stun prod.

* Made the integration test use the new method to turn the welders on.

* Fixed a few testing issues, applied a few changes requested by Delta.

* Updated Stunbaton code for consistentcy when it comes to calling the itemToggle component.

* Removed a redundant return; as per Delta.
Made examining the stun baton for charge rely on the battery component instead.

* Removed the welder visualizer system, now using the generic one. Removed some unused usings. Removed the welder visuals and layers.
Ported lighters to the new system.
Added zippi (sic) lighters.

* Renamed variables used to make them less generic.

* Simplified the light update code.

* Fixed the unit test to use the itemToggle system for welders now.

* Made the name shorter. I can't tell if the welding damage when interacted with actually does anything though. I can't figure out how to trigger it.

* Fixed some YML issues.

* Added a client side item toggle system just to make the shared code run on local UID's too.

* Fixed some more Yaml.

* Made the Zippi lighter have its own parent item, so it doesnt' conflict with the random pattern on the regular lighter.

* Made the zippi lighter its own in-hand sprites.

* Added a summary for the activated property in itemtoggle component.

* Fixed a typo in the itemToggle Component.

* Fixed a typo.

* Added to the remarks for the ItemToggleComponent.

* Fixed up the lighter yaml to make it use a generic term instead of a toggle layer enum for the random skin.

* Fixed a bug I introduced accidentally with the humming sound.

* Removed 2 unnecessary events from the ItemToggleSystem and component.

* Fixed a bug by only making the server run the item activation code, since the client cannot predict whether or not the activation will be cancelled.

* Cleaned up some names and functions getting called.

* Renamed a couple of variables and removed the explicit datafields from the component. Removed "activated: false" from yml since they're already deactivated by default.

* Added an IsActivated function, used it in the welder and stun baton systems code.
Refactored welder code to remove the WelderToggle event, now using the ItemToggleActivatedEvent instead for eye protection check.

* Fixed a typo. Added some comments.

* Split the ItemToggle into smaller components.
Changed the items that used the toggle system to work with the smaller components.
Made the mirror shield reflect energy shots with a 95% chance.

* Fixed the namespaces for the server components and whatnot.

* Fixed a doubled deactivation sound from using activated wieldable items (like the double Esword).
Fixed wrong yml with the e-dagger.
Fixed the disarm malus code.

* Added the zippo lighter to the detective's trench coat.

* Removed the default hit sound for the double e-sword since it was unnecessary.

* Changed e-sword damage numbers to be in line with the changes made by Emisse.

* Made no damage sounds be autoNetworked, so it changes can be changed on activation/deactivation of items.
Made Welders and Eswords sound like themselves but quieter if they hit for 0 damage, instead of taps.
You can choose what sound to play when a weapon does 0 damage when activated now.
Fixed a bug with swing sounds.

* Typo.

* Fixed a bug where the welder would blind you if you used it while it was off.

* Created a single abstract method called when an item has completed its toggle.

* Update Content.Server/Eye/Blinding/EyeProtection/EyeProtectionSystem.cs

Co-authored-by: metalgearsloth <31366439+metalgearsloth@users.noreply.github.com>

* Fixed a comment.

* Made most component variables readOnly for ItemToggle. There is no need to be able to change them from within the variable viewer.

* Removed trailing white spaces.

* Made the Use a field instead of a property in the itemToggleActivation/Deactivation attempt events.

* Small fixes.

* Removed ForceToggle, just use the toggle method instead.

* Fixed a bug with item sharpness staying even after getting deactivated, if the item gained sharpness that way (esword).

* Used ProtoId in the welder component.

* Made damage NetSerializable as well.

* Added networking and data fields to a couple of components.

* Made component variables autonetworked. Added some comments.

* Moved the events that modify item components on toggle to events, handled (where possible) in the systems linked to said components.

* Made all the component variables readWrite again.

* Added the component get to the WelderStatus.

* Added a predictable bool to the item toggle component.

* Replaced the Activated/Deactivated events with ToggleDone, with an Activated argument. Used that to simplify some systems.

* Added a reflect update raise event.

* Removed the Zippo changes. To add in a later PR.

* Removed the zippo from meta.json too.

* Small fix.

* Another small fix.

* Fixed the wieldable system thing in ItemToggle.

---------

Co-authored-by: metalgearsloth <31366439+metalgearsloth@users.noreply.github.com>
This commit is contained in:
Darkie
2023-12-24 08:11:05 +02:00
committed by GitHub
parent 1de682e23f
commit a3fbab84e6
47 changed files with 1188 additions and 810 deletions

View File

@@ -1,4 +1,4 @@
- type: entity
- type: entity
name: base shield
parent: BaseItem
id: BaseShield
@@ -316,7 +316,11 @@
state: mirror-icon
- type: Item
heldPrefix: mirror
- type: Blocking #Mirror shield should reflect heat/laser eventually, but be relatively weak to everything else.
- type: Reflect
reflectProb: 0.95
reflects:
- Energy
- type: Blocking #Mirror shield reflects heat/laser, but is relatively weak to everything else.
passiveBlockModifier:
coefficients:
Blunt: 1.2
@@ -356,12 +360,17 @@
description: Exotic energy shield, when folded, can even fit in your pocket.
components:
- type: ItemToggle
activatedDisarmMalus: 0.6
activateSound:
soundActivate:
path: /Audio/Weapons/ebladeon.ogg
deActivateSound:
soundDeactivate:
path: /Audio/Weapons/ebladeoff.ogg
offSize: Small
- type: ItemToggleActiveSound
activeSound:
path: /Audio/Weapons/ebladehum.ogg
- type: ItemToggleSize
activatedSize: Huge
- type: ItemToggleDisarmMalus
activatedDisarmMalus: 0.6
- type: Sprite
sprite: Objects/Weapons/Melee/e_shield.rsi
layers:
@@ -461,16 +470,18 @@
description: An advanced riot shield made of lightweight materials that collapses for easy storage.
components:
- type: ItemToggle
activatedDisarmMalus: 0.6
activateSound:
soundActivate:
path: /Audio/Weapons/telescopicon.ogg
params:
volume: -5
deActivateSound:
soundDeactivate:
path: /Audio/Weapons/telescopicoff.ogg
params:
volume: -5
offSize: Small
- type: ItemToggleDisarmMalus
activatedDisarmMalus: 0.6
- type: ItemToggleSize
activatedSize: Huge
- type: Sprite
sprite: Objects/Weapons/Melee/teleriot_shield.rsi
layers:

View File

@@ -4,45 +4,73 @@
id: Lighter
description: "A simple plastic cigarette lighter."
components:
# Sloth: What is this comment ?????????
- type: RandomSprite #this has to be before sprite component for the flame to toggle right because weldercomponent behaves weird (and i dont trust myself to fix it right)
available:
- enum.WelderLayers.Base:
basic_icon_base-1: ""
- enum.WelderLayers.Base:
basic_icon_base-2: ""
- enum.WelderLayers.Base:
basic_icon_base-3: ""
- enum.WelderLayers.Base:
basic_icon_base-4: ""
- enum.WelderLayers.Base:
basic_icon_base-5: ""
- enum.WelderLayers.Base:
basic_icon_base-6: ""
- enum.WelderLayers.Base:
basic_icon_base-7: ""
- enum.WelderLayers.Base:
basic_icon_base-8: ""
- enum.WelderLayers.Base:
basic_icon_base-9: ""
- enum.WelderLayers.Base:
basic_icon_base-10: ""
- enum.WelderLayers.Base:
basic_icon_base-11: ""
- type: ItemToggle
predictable: false
soundActivate:
collection: lighterOnSounds
soundDeactivate:
collection: lighterOffSounds
- type: ItemToggleMeleeWeapon
activatedDamage:
types:
Heat: 1
- type: ItemToggleSize
activatedSize: Small
- type: ItemToggleHot
- type: Sprite
sprite: Objects/Tools/lighters.rsi
layers:
- state: icon_map
map: ["enum.WelderLayers.Base"]
- state: lighter_flame
map: ["enum.WelderLayers.Flame"]
shader: unshaded
visible: false
- state: cheap_icon_base
map: [ "skin" ]
- state: basic_icon_top
- state: lighter_flame
visible: false
shader: unshaded
map: [ "flame" ]
- type: Appearance
- type: RandomSprite
available:
- skin:
basic_icon_base-1: ""
- skin:
basic_icon_base-2: ""
- skin:
basic_icon_base-3: ""
- skin:
basic_icon_base-4: ""
- skin:
basic_icon_base-5: ""
- skin:
basic_icon_base-6: ""
- skin:
basic_icon_base-7: ""
- skin:
basic_icon_base-8: ""
- skin:
basic_icon_base-9: ""
- skin:
basic_icon_base-10: ""
- skin:
basic_icon_base-11: ""
- type: GenericVisualizer
visuals:
enum.ToggleVisuals.Toggled:
flame:
True: { visible: true }
False: { visible: false }
- type: ToggleableLightVisuals
spriteLayer: lighter_flame
inhandVisuals:
left:
- state: inhand-left-flame
shader: unshaded
right:
- state: inhand-right-flame
shader: unshaded
- type: Item
size: Tiny
sprite: Objects/Tools/lighters.rsi
heldPrefix: off
- type: ItemCooldown
- type: RefillableSolution
solution: Welder
@@ -56,24 +84,16 @@
- type: MeleeWeapon
damage:
types:
Blunt: 0 #this feels hacky, but is needed for burn damage while active (i think)
Blunt: 0
- type: Welder
fuelConsumption: 0.01
fuelLitCost: 0.1
litMeleeDamageBonus:
types:
Heat: 1
tankSafe: true
welderOnSounds:
collection: lighterOnSounds
welderOffSounds:
collection: lighterOffSounds
- type: PointLight
enabled: false
netsync: false
radius: 1.1 #smallest possible
color: orange
- type: Appearance
- type: entity
name: cheap lighter
@@ -81,20 +101,21 @@
id: CheapLighter
description: "A dangerously inexpensive plastic lighter, don't burn your thumb!"
components:
- type: RandomSprite
available:
- enum.WelderLayers.Base:
cheap_icon_base: Rainbow
- type: Sprite
sprite: Objects/Tools/lighters.rsi
layers:
- state: icon_map
map: ["enum.WelderLayers.Base"]
- state: lighter_flame
map: ["enum.WelderLayers.Flame"]
shader: unshaded
visible: false
- state: cheap_icon_base
map: [ "skin" ]
- state: cheap_icon_top
- state: lighter_flame
visible: false
shader: unshaded
map: [ "flame" ]
- type: RandomSprite
available:
- skin:
cheap_icon_base: Rainbow
- type: SolutionContainerManager
solutions:
Welder:
@@ -102,5 +123,3 @@
- ReagentId: WeldingFuel
Quantity: 4
maxVol: 4 #uses less fuel than a welder, so this isnt as bad as it looks
#TODO: zippos

View File

@@ -11,14 +11,50 @@
sprite: Objects/Tools/welder.rsi
layers:
- state: icon
map: ["enum.WelderLayers.Base"]
- state: welder_flame
map: ["enum.WelderLayers.Flame"]
shader: unshaded
visible: false
shader: unshaded
map: ["enum.ToggleVisuals.Layer"]
- type: GenericVisualizer
visuals:
enum.ToggleVisuals.Toggled:
enum.ToggleVisuals.Layer:
True: { visible: true }
False: { visible: false }
- type: Item
size: Small
sprite: Objects/Tools/welder.rsi
- type: ItemToggle
predictable: false
soundActivate:
collection: WelderOn
params:
variation: 0.125
volume: -5
soundDeactivate:
collection: WelderOff
params:
variation: 0.125
volume: -5
- type: ItemToggleMeleeWeapon
activatedSoundOnHit:
path: /Audio/Weapons/eblade1.ogg
params:
variation: 0.250
volume: -10
activatedSoundOnHitNoDamage:
path: /Audio/Weapons/eblade1.ogg
params:
variation: 0.250
volume: -12
activatedDamage:
types:
Heat: 8
- type: ItemToggleSize
activatedSize: Large
- type: ItemToggleHot
- type: ItemToggleDisarmMalus
activatedDisarmMalus: 0.6
- type: ToggleableLightVisuals
spriteLayer: flame
inhandVisuals:
@@ -48,10 +84,6 @@
collection: Welder
qualities: Welding
- type: Welder
litMeleeDamageBonus:
types:
Heat: 8
Blunt: -5
- type: PointLight
enabled: false
radius: 1.5

View File

@@ -5,13 +5,39 @@
description: A very loud & dangerous sword with a beam made of pure, concentrated plasma. Cuts through unarmored targets like butter.
components:
- type: EnergySword
litDamageBonus:
- type: ItemToggle
soundActivate:
path: /Audio/Weapons/ebladeon.ogg
soundDeactivate:
path: /Audio/Weapons/ebladeoff.ogg
- type: ItemToggleActiveSound
activeSound:
path: /Audio/Weapons/ebladehum.ogg
- type: ItemToggleSharp
- type: ItemToggleHot
- type: ItemToggleDisarmMalus
activatedDisarmMalus: 0.6
- type: ItemToggleSize
activatedSize: Huge
- type: ItemToggleMeleeWeapon
activatedSoundOnHit:
path: /Audio/Weapons/eblade1.ogg
params:
variation: 0.250
activatedSoundOnHitNoDamage:
path: /Audio/Weapons/eblade1.ogg
params:
variation: 0.250
volume: -10
activatedSoundOnSwing:
path: /Audio/Weapons/eblademiss.ogg
params:
variation: 0.125
activatedDamage:
types:
Slash: 15
Heat: 15
Structural: 20
Blunt: -4.5
litDisarmMalus: 0.6
- type: Sprite
sprite: Objects/Weapons/Melee/e_sword.rsi
layers:
@@ -24,8 +50,6 @@
- type: MeleeWeapon
wideAnimationRotation: -135
attackRate: 1
soundHit:
path: /Audio/Weapons/eblade1.ogg
damage:
types:
Blunt: 4.5
@@ -63,21 +87,33 @@
description: 'A dark ink pen.'
components:
- type: EnergySword
secret: true
litDamageBonus:
types:
Slash: 10
Heat: 10
Blunt: -1
litDisarmMalus: 0.4
activateSound: !type:SoundPathSpecifier
- type: ItemToggle
soundActivate:
path: /Audio/Weapons/ebladeon.ogg
params:
volume: -6
deActivateSound: !type:SoundPathSpecifier
soundDeactivate:
path: /Audio/Weapons/ebladeoff.ogg
params:
volume: -6
- type: ItemToggleMeleeWeapon
activatedSoundOnSwing:
path: /Audio/Weapons/eblademiss.ogg
params:
volume: -6
variation: 0.250
activatedDamage:
types:
Slash: 10
Heat: 10
deactivatedSecret: true
- type: ItemToggleActiveSound
activeSound:
path: /Audio/Weapons/ebladehum.ogg
params:
volume: -6
- type: ItemToggleDisarmMalus
activatedDisarmMalus: 0.4
- type: Sprite
sprite: Objects/Weapons/Melee/e_dagger.rsi
layers:
@@ -146,13 +182,14 @@
description: An exotic energy weapon.
components:
- type: EnergySword
secret: true
litDamageBonus:
- type: ItemToggleMeleeWeapon
activatedDamage:
types:
Slash: 10
Heat: 12
Blunt: -1
litDisarmMalus: 0.6
deactivatedSecret: true
- type: ItemToggleDisarmMalus
activatedDisarmMalus: 0.6
- type: Sprite
sprite: Objects/Weapons/Melee/e_cutlass.rsi
layers:
@@ -181,21 +218,39 @@
id: EnergySwordDouble
description: Syndicate Command Interns thought that having one blade on the energy sword was not enough. This can be stored in pockets.
components:
- type: Wieldable
- type: EnergySword
litDamageBonus:
- type: ItemToggle
soundActivate:
path: /Audio/Weapons/ebladeon.ogg
params:
volume: 3
soundDeactivate:
path: /Audio/Weapons/ebladeoff.ogg
params:
volume: 3
- type: ItemToggleMeleeWeapon
activatedSoundOnSwing:
path: /Audio/Weapons/eblademiss.ogg
params:
volume: 3
variation: 0.250
activatedDamage:
types:
Slash: 12
Heat: 12
Structural: 15
Blunt: -4.5
litDisarmMalus: 0.7
- type: ItemToggleActiveSound
activeSound:
path: /Audio/Weapons/ebladehum.ogg
params:
volume: 3
- type: ItemToggleDisarmMalus
activatedDisarmMalus: 0.7
- type: Wieldable
- type: MeleeWeapon
wideAnimationRotation: -135
attackRate: 1.5
angle: 100
soundHit:
path: /Audio/Weapons/eblade1.ogg
damage:
types:
Blunt: 4.5
@@ -212,7 +267,6 @@
size: Small
sprite: Objects/Weapons/Melee/e_sword_double-inhands.rsi
- type: Reflect
enabled: true
reflectProb: .75
spread: 75
- type: UseDelay

View File

@@ -9,6 +9,23 @@
layers:
- state: stunprod_off
map: [ "enum.ToggleVisuals.Layer" ]
- type: ItemToggle
soundActivate:
collection: sparks
params:
variation: 0.250
soundDeactivate:
collection: sparks
params:
variation: 0.250
soundFailToActivate:
path: /Audio/Machines/button.ogg
params:
variation: 0.250
- type: ItemToggleMeleeWeapon
activatedDamage:
types:
Blunt: 0
- type: Stunbaton
energyPerUse: 70
- type: MeleeWeapon
@@ -37,7 +54,7 @@
- type: Appearance
- type: GenericVisualizer
visuals:
enum.ToggleVisuals.Toggled:
enum.ToggleVisuals.Toggled:
enum.ToggleVisuals.Layer:
True: {state: stunprod_on}
False: {state: stunprod_off}

View File

@@ -11,6 +11,24 @@
map: [ "enum.ToggleVisuals.Layer" ]
- type: Stunbaton
energyPerUse: 50
- type: ItemToggle
predictable: false
soundActivate:
collection: sparks
params:
variation: 0.250
soundDeactivate:
collection: sparks
params:
variation: 0.250
soundFailToActivate:
path: /Audio/Machines/button.ogg
params:
variation: 0.250
- type: ItemToggleMeleeWeapon
activatedDamage:
types:
Blunt: 0
- type: MeleeWeapon
wideAnimationRotation: -135
damage: