Add DamagePopup, Target Entities, And Practice Laser Gun (#12317)
This commit is contained in:
20
Content.Server/Damage/Components/DamagePopupComponent.cs
Normal file
20
Content.Server/Damage/Components/DamagePopupComponent.cs
Normal file
@@ -0,0 +1,20 @@
|
|||||||
|
using Content.Server.Damage.Systems;
|
||||||
|
|
||||||
|
namespace Content.Server.Damage.Components;
|
||||||
|
|
||||||
|
[RegisterComponent, Access(typeof(DamagePopupSystem))]
|
||||||
|
public sealed class DamagePopupComponent : Component
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// Enum that will be used to determine the type of damage popup displayed.
|
||||||
|
/// </summary>
|
||||||
|
[DataField("damagePopupType")] [ViewVariables(VVAccess.ReadWrite)]
|
||||||
|
public DamagePopupType Type = DamagePopupType.Combined;
|
||||||
|
}
|
||||||
|
public enum DamagePopupType
|
||||||
|
{
|
||||||
|
Combined,
|
||||||
|
Total,
|
||||||
|
Delta,
|
||||||
|
Hit,
|
||||||
|
};
|
||||||
36
Content.Server/Damage/Systems/DamagePopupSystem.cs
Normal file
36
Content.Server/Damage/Systems/DamagePopupSystem.cs
Normal file
@@ -0,0 +1,36 @@
|
|||||||
|
using Content.Server.Damage.Components;
|
||||||
|
using Content.Server.Popups;
|
||||||
|
using Content.Shared.Damage;
|
||||||
|
using Robust.Shared.Player;
|
||||||
|
|
||||||
|
namespace Content.Server.Damage.Systems;
|
||||||
|
|
||||||
|
public sealed class DamagePopupSystem : EntitySystem
|
||||||
|
{
|
||||||
|
[Dependency] private readonly PopupSystem _popupSystem = default!;
|
||||||
|
|
||||||
|
public override void Initialize()
|
||||||
|
{
|
||||||
|
base.Initialize();
|
||||||
|
SubscribeLocalEvent<DamagePopupComponent, DamageChangedEvent>(OnDamageChange);
|
||||||
|
}
|
||||||
|
|
||||||
|
private void OnDamageChange(EntityUid uid, DamagePopupComponent component, DamageChangedEvent args)
|
||||||
|
{
|
||||||
|
if (args.DamageDelta != null)
|
||||||
|
{
|
||||||
|
var damageTotal = args.Damageable.TotalDamage;
|
||||||
|
var damageDelta = args.DamageDelta.Total;
|
||||||
|
|
||||||
|
var msg = component.Type switch
|
||||||
|
{
|
||||||
|
DamagePopupType.Delta => damageDelta.ToString(),
|
||||||
|
DamagePopupType.Total => damageTotal.ToString(),
|
||||||
|
DamagePopupType.Combined => damageDelta + " | " + damageTotal,
|
||||||
|
DamagePopupType.Hit => "!",
|
||||||
|
_ => "Invalid type",
|
||||||
|
};
|
||||||
|
_popupSystem.PopupEntity(msg, uid, Filter.Pvs(uid, 2F, EntityManager));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,148 @@
|
|||||||
|
- type: entity
|
||||||
|
id: BaseTarget
|
||||||
|
parent: BaseStructureDynamic
|
||||||
|
abstract: true
|
||||||
|
components:
|
||||||
|
- type: Sprite
|
||||||
|
sprite: Objects/Specific/Security/target.rsi
|
||||||
|
state: target_stake
|
||||||
|
noRot: true
|
||||||
|
netsync: false
|
||||||
|
- type: Repairable
|
||||||
|
- type: DamagePopup
|
||||||
|
damagePopupType: Combined
|
||||||
|
- type: Fixtures
|
||||||
|
fixtures:
|
||||||
|
- shape:
|
||||||
|
!type:PhysShapeCircle
|
||||||
|
radius: 0.35
|
||||||
|
density: 200
|
||||||
|
mask:
|
||||||
|
- FullTileMask
|
||||||
|
layer:
|
||||||
|
- WallLayer
|
||||||
|
- type: InteractionOutline
|
||||||
|
- type: Physics
|
||||||
|
- type: Damageable
|
||||||
|
damageContainer: Inorganic
|
||||||
|
- type: Destructible
|
||||||
|
thresholds:
|
||||||
|
- trigger:
|
||||||
|
!type:DamageTrigger
|
||||||
|
damage: 50
|
||||||
|
behaviors:
|
||||||
|
- !type:SpawnEntitiesBehavior
|
||||||
|
spawn:
|
||||||
|
SheetSteel:
|
||||||
|
min: 5
|
||||||
|
max: 5
|
||||||
|
- !type:PlaySoundBehavior
|
||||||
|
sound:
|
||||||
|
path: /Audio/Effects/metalbreak.ogg
|
||||||
|
- !type:DoActsBehavior
|
||||||
|
acts: [ "Destruction" ]
|
||||||
|
|
||||||
|
- type: entity
|
||||||
|
name: human target
|
||||||
|
id: TargetHuman
|
||||||
|
parent: BaseTarget
|
||||||
|
description: A shooting target. This one is a human.
|
||||||
|
components:
|
||||||
|
- type: Sprite
|
||||||
|
sprite: Objects/Specific/Security/target.rsi
|
||||||
|
state: target_h
|
||||||
|
- type: Destructible
|
||||||
|
thresholds:
|
||||||
|
- trigger:
|
||||||
|
!type:DamageTrigger
|
||||||
|
damage: 500
|
||||||
|
behaviors:
|
||||||
|
- !type:SpawnEntitiesBehavior
|
||||||
|
spawn:
|
||||||
|
SheetSteel:
|
||||||
|
min: 10
|
||||||
|
max: 10
|
||||||
|
- !type:PlaySoundBehavior
|
||||||
|
sound:
|
||||||
|
path: /Audio/Effects/metalbreak.ogg
|
||||||
|
- !type:DoActsBehavior
|
||||||
|
acts: [ "Destruction" ]
|
||||||
|
|
||||||
|
- type: entity
|
||||||
|
name: syndicate target
|
||||||
|
id: TargetSyndicate
|
||||||
|
parent: BaseTarget
|
||||||
|
description: A shooting target. This one is a syndicate agent.
|
||||||
|
components:
|
||||||
|
- type: Sprite
|
||||||
|
sprite: Objects/Specific/Security/target.rsi
|
||||||
|
state: target_s
|
||||||
|
- type: Destructible
|
||||||
|
thresholds:
|
||||||
|
- trigger:
|
||||||
|
!type:DamageTrigger
|
||||||
|
damage: 500
|
||||||
|
behaviors:
|
||||||
|
- !type:SpawnEntitiesBehavior
|
||||||
|
spawn:
|
||||||
|
SheetSteel:
|
||||||
|
min: 10
|
||||||
|
max: 10
|
||||||
|
- !type:PlaySoundBehavior
|
||||||
|
sound:
|
||||||
|
path: /Audio/Effects/metalbreak.ogg
|
||||||
|
- !type:DoActsBehavior
|
||||||
|
acts: [ "Destruction" ]
|
||||||
|
|
||||||
|
- type: entity
|
||||||
|
name: clown target
|
||||||
|
id: TargetClown
|
||||||
|
parent: BaseTarget
|
||||||
|
description: A shooting target. This one is a clown.
|
||||||
|
components:
|
||||||
|
- type: Sprite
|
||||||
|
sprite: Objects/Specific/Security/target.rsi
|
||||||
|
state: target_c
|
||||||
|
- type: Destructible
|
||||||
|
thresholds:
|
||||||
|
- trigger:
|
||||||
|
!type:DamageTrigger
|
||||||
|
damage: 500
|
||||||
|
behaviors:
|
||||||
|
- !type:SpawnEntitiesBehavior
|
||||||
|
spawn:
|
||||||
|
SheetSteel:
|
||||||
|
min: 10
|
||||||
|
max: 10
|
||||||
|
- !type:PlaySoundBehavior
|
||||||
|
sound:
|
||||||
|
path: /Audio/Effects/metalbreak.ogg
|
||||||
|
- !type:DoActsBehavior
|
||||||
|
acts: [ "Destruction" ]
|
||||||
|
|
||||||
|
# put it on a salvage or something
|
||||||
|
- type: entity
|
||||||
|
name: strange target
|
||||||
|
id: TargetStrange
|
||||||
|
parent: BaseTarget
|
||||||
|
description: A shooting target. You aren't quite sure what this one is, but it seems to be extra robust.
|
||||||
|
components:
|
||||||
|
- type: Sprite
|
||||||
|
sprite: Objects/Specific/Security/target.rsi
|
||||||
|
state: target_f
|
||||||
|
- type: Destructible
|
||||||
|
thresholds:
|
||||||
|
- trigger:
|
||||||
|
!type:DamageTrigger
|
||||||
|
damage: 2000
|
||||||
|
behaviors:
|
||||||
|
- !type:SpawnEntitiesBehavior
|
||||||
|
spawn:
|
||||||
|
SheetSteel:
|
||||||
|
min: 10
|
||||||
|
max: 10
|
||||||
|
- !type:PlaySoundBehavior
|
||||||
|
sound:
|
||||||
|
path: /Audio/Effects/metalbreak.ogg
|
||||||
|
- !type:DoActsBehavior
|
||||||
|
acts: [ "Destruction" ]
|
||||||
@@ -115,6 +115,16 @@
|
|||||||
proto: RedLaser
|
proto: RedLaser
|
||||||
fireCost: 62.5
|
fireCost: 62.5
|
||||||
|
|
||||||
|
- type: entity
|
||||||
|
name: practice laser gun
|
||||||
|
parent: WeaponLaserCarbine
|
||||||
|
id: WeaponLaserCarbinePractice
|
||||||
|
description: A modified version of the basic laser gun, this one fires less concentrated energy bolts designed for target practice.
|
||||||
|
components:
|
||||||
|
- type: HitscanBatteryAmmoProvider
|
||||||
|
proto: RedLaserPractice
|
||||||
|
fireCost: 62.5
|
||||||
|
|
||||||
- type: entity
|
- type: entity
|
||||||
name: pulse pistol
|
name: pulse pistol
|
||||||
parent: BaseWeaponBatterySmall
|
parent: BaseWeaponBatterySmall
|
||||||
|
|||||||
@@ -30,6 +30,21 @@
|
|||||||
sprite: Objects/Weapons/Guns/Projectiles/projectiles.rsi
|
sprite: Objects/Weapons/Guns/Projectiles/projectiles.rsi
|
||||||
state: impact_laser
|
state: impact_laser
|
||||||
|
|
||||||
|
- type: hitscan
|
||||||
|
id: RedLaserPractice
|
||||||
|
damage:
|
||||||
|
types:
|
||||||
|
Heat: 0
|
||||||
|
muzzleFlash:
|
||||||
|
sprite: Objects/Weapons/Guns/Projectiles/projectiles.rsi
|
||||||
|
state: muzzle_laser
|
||||||
|
travelFlash:
|
||||||
|
sprite: Objects/Weapons/Guns/Projectiles/projectiles.rsi
|
||||||
|
state: beam
|
||||||
|
impactFlash:
|
||||||
|
sprite: Objects/Weapons/Guns/Projectiles/projectiles.rsi
|
||||||
|
state: impact_laser
|
||||||
|
|
||||||
- type: hitscan
|
- type: hitscan
|
||||||
id: RedMediumLaser
|
id: RedMediumLaser
|
||||||
damage:
|
damage:
|
||||||
|
|||||||
@@ -347,6 +347,9 @@
|
|||||||
- CartridgeCaselessRifleRubber
|
- CartridgeCaselessRifleRubber
|
||||||
- CartridgeLightRifleRubber
|
- CartridgeLightRifleRubber
|
||||||
- CartridgeRifleRubber
|
- CartridgeRifleRubber
|
||||||
|
- TargetHuman
|
||||||
|
- TargetSyndicate
|
||||||
|
- TargetClown
|
||||||
- type: MaterialStorage
|
- type: MaterialStorage
|
||||||
whitelist:
|
whitelist:
|
||||||
tags:
|
tags:
|
||||||
|
|||||||
@@ -170,3 +170,33 @@
|
|||||||
Plastic: 15
|
Plastic: 15
|
||||||
Steel: 10
|
Steel: 10
|
||||||
Glass: 5
|
Glass: 5
|
||||||
|
|
||||||
|
- type: latheRecipe
|
||||||
|
id: TargetHuman
|
||||||
|
icon:
|
||||||
|
sprite: Objects/Specific/Security/target.rsi
|
||||||
|
state: target_h
|
||||||
|
result: TargetHuman
|
||||||
|
completetime: 5
|
||||||
|
materials:
|
||||||
|
Steel: 10
|
||||||
|
|
||||||
|
- type: latheRecipe
|
||||||
|
id: TargetClown
|
||||||
|
icon:
|
||||||
|
sprite: Objects/Specific/Security/target.rsi
|
||||||
|
state: target_c
|
||||||
|
result: TargetClown
|
||||||
|
completetime: 5
|
||||||
|
materials:
|
||||||
|
Steel: 10
|
||||||
|
|
||||||
|
- type: latheRecipe
|
||||||
|
id: TargetSyndicate
|
||||||
|
icon:
|
||||||
|
sprite: Objects/Specific/Security/target.rsi
|
||||||
|
state: target_s
|
||||||
|
result: TargetSyndicate
|
||||||
|
completetime: 5
|
||||||
|
materials:
|
||||||
|
Steel: 10
|
||||||
|
|||||||
@@ -0,0 +1,26 @@
|
|||||||
|
{
|
||||||
|
"version": 1,
|
||||||
|
"license": "CC-BY-SA-3.0",
|
||||||
|
"copyright": "Taken from tgstation at https://github.com/tgstation/tgstation/blob/a0f470046f01c2e8643d27e8dac8b9cb08b9a68d/icons/obj/objects.dmi",
|
||||||
|
"size": {
|
||||||
|
"x": 32,
|
||||||
|
"y": 32
|
||||||
|
},
|
||||||
|
"states": [
|
||||||
|
{
|
||||||
|
"name": "target_stake"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "target_h"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "target_s"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "target_c"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "target_f"
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
Binary file not shown.
|
After Width: | Height: | Size: 435 B |
Binary file not shown.
|
After Width: | Height: | Size: 424 B |
Binary file not shown.
|
After Width: | Height: | Size: 341 B |
Binary file not shown.
|
After Width: | Height: | Size: 371 B |
Binary file not shown.
|
After Width: | Height: | Size: 312 B |
Reference in New Issue
Block a user