Обновление модулей (#365)
* base aim module * sprites, prototypes * more prototypes * fix * fix * fix2
This commit is contained in:
@@ -18,6 +18,7 @@ public sealed partial class WeaponModulesVisuals : VisualizerSystem<WeaponModule
|
||||
|
||||
args.Sprite.LayerSetVisible(ModuleVisualState.HandGuardModule, false);
|
||||
args.Sprite.LayerSetVisible(ModuleVisualState.BarrelModule, false);
|
||||
args.Sprite.LayerSetVisible(ModuleVisualState.AimModule, false);
|
||||
|
||||
if (AppearanceSystem.TryGetData<string>(uid, ModuleVisualState.HandGuardModule, out var handguardModule, args.Component) && handguardModule.Length != 0 && handguardModule != "none")
|
||||
{
|
||||
@@ -31,6 +32,12 @@ public sealed partial class WeaponModulesVisuals : VisualizerSystem<WeaponModule
|
||||
args.Sprite.LayerSetVisible(ModuleVisualState.BarrelModule, true);
|
||||
}
|
||||
|
||||
if (AppearanceSystem.TryGetData<string>(uid, ModuleVisualState.AimModule, out var aimModule, args.Component) && aimModule.Length != 0 && aimModule != "none")
|
||||
{
|
||||
args.Sprite.LayerSetState(ModuleVisualState.AimModule, aimModule);
|
||||
args.Sprite.LayerSetVisible(ModuleVisualState.AimModule, true);
|
||||
}
|
||||
|
||||
if (AppearanceSystem.TryGetData(uid, Modules.Light, out var data, args.Component))
|
||||
{
|
||||
if (TryComp<PointLightComponent>(uid, out var pointLightComponent))
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
using System.Diagnostics.CodeAnalysis;
|
||||
using Content.Shared._White.Telescope;
|
||||
using Content.Shared._White.WeaponModules;
|
||||
using Content.Shared.Weapons.Ranged.Components;
|
||||
using Content.Shared.Weapons.Ranged.Systems;
|
||||
@@ -11,7 +12,7 @@ public sealed class WeaponModulesSystem : EntitySystem
|
||||
{
|
||||
protected static readonly Dictionary<string, Enum> Slots = new()
|
||||
{
|
||||
{ "handguard_module", ModuleVisualState.HandGuardModule }, { "barrel_module", ModuleVisualState.BarrelModule }
|
||||
{ "handguard_module", ModuleVisualState.HandGuardModule }, { "barrel_module", ModuleVisualState.BarrelModule }, { "aim_module", ModuleVisualState.AimModule }
|
||||
};
|
||||
|
||||
[Dependency] private readonly PointLightSystem _lightSystem = default!;
|
||||
@@ -36,6 +37,9 @@ public sealed class WeaponModulesSystem : EntitySystem
|
||||
|
||||
SubscribeLocalEvent<AcceleratorModuleComponent, EntGotInsertedIntoContainerMessage>(AcceleratorModuleOnInsert);
|
||||
SubscribeLocalEvent<AcceleratorModuleComponent, EntGotRemovedFromContainerMessage>(AcceleratorModuleOnEject);
|
||||
|
||||
SubscribeLocalEvent<AimModuleComponent, EntGotInsertedIntoContainerMessage>(EightAimModuleOnInsert);
|
||||
SubscribeLocalEvent<AimModuleComponent, EntGotRemovedFromContainerMessage>(EightAimModuleOnEject);
|
||||
}
|
||||
|
||||
private bool TryInsertModule(EntityUid module, EntityUid weapon, BaseModuleComponent component,
|
||||
@@ -154,6 +158,18 @@ public sealed class WeaponModulesSystem : EntitySystem
|
||||
|
||||
_gunSystem.SetFireRate(weapon, component.OldFireRate + component.FireRateAdd);
|
||||
}
|
||||
|
||||
private void EightAimModuleOnInsert(EntityUid module, AimModuleComponent component, EntGotInsertedIntoContainerMessage args)
|
||||
{
|
||||
EntityUid weapon = args.Container.Owner;
|
||||
|
||||
if (!TryComp<GunComponent>(weapon, out var gunComp)) return;
|
||||
|
||||
if(!TryInsertModule(module, weapon, component, args.Container.ID, out var weaponModulesComponent))
|
||||
return;
|
||||
|
||||
EnsureComp<TelescopeComponent>(weapon).Divisor = component.Divisor;
|
||||
}
|
||||
#endregion
|
||||
|
||||
#region EjectModules
|
||||
@@ -213,5 +229,15 @@ public sealed class WeaponModulesSystem : EntitySystem
|
||||
|
||||
_gunSystem.SetFireRate(weapon, component.OldFireRate);
|
||||
}
|
||||
|
||||
private void EightAimModuleOnEject(EntityUid module, AimModuleComponent component, EntGotRemovedFromContainerMessage args)
|
||||
{
|
||||
EntityUid weapon = args.Container.Owner;
|
||||
|
||||
if(!TryEjectModule(module, weapon, args.Container.ID, out var weaponModulesComponent))
|
||||
return;
|
||||
|
||||
RemComp<TelescopeComponent>(weapon);
|
||||
}
|
||||
#endregion
|
||||
}
|
||||
|
||||
@@ -0,0 +1,8 @@
|
||||
namespace Content.Shared._White.WeaponModules;
|
||||
|
||||
[RegisterComponent]
|
||||
public sealed partial class AimModuleComponent : BaseModuleComponent
|
||||
{
|
||||
[ViewVariables(VVAccess.ReadWrite), DataField("divisor")]
|
||||
public float Divisor = 0.3F;
|
||||
}
|
||||
@@ -2,7 +2,6 @@
|
||||
|
||||
namespace Content.Shared._White.WeaponModules;
|
||||
|
||||
|
||||
[RegisterComponent, NetworkedComponent]
|
||||
public partial class BaseModuleComponent : Component
|
||||
{
|
||||
|
||||
@@ -1,8 +1,5 @@
|
||||
namespace Content.Shared._White.WeaponModules;
|
||||
|
||||
/// <summary>
|
||||
/// This is used for...
|
||||
/// </summary>
|
||||
[RegisterComponent]
|
||||
public sealed partial class FlameHiderModuleComponent : BaseModuleComponent
|
||||
{
|
||||
|
||||
@@ -20,7 +20,8 @@ public partial class WeaponModulesComponent : Component
|
||||
public enum ModuleVisualState : byte
|
||||
{
|
||||
BarrelModule,
|
||||
HandGuardModule
|
||||
HandGuardModule,
|
||||
AimModule
|
||||
}
|
||||
|
||||
[Serializable, NetSerializable]
|
||||
|
||||
@@ -285,6 +285,7 @@
|
||||
- id: MagazinePistol
|
||||
- id: BoxMindshield
|
||||
- id: TagillaHammer
|
||||
- id: EightAimModule
|
||||
- type: entity
|
||||
id: LockerFreezerVaultFilled
|
||||
suffix: Vault, Locked
|
||||
|
||||
@@ -15,7 +15,6 @@
|
||||
- Back
|
||||
- suitStorage
|
||||
- type: AmmoCounter
|
||||
- type: WeaponModules
|
||||
- type: Gun
|
||||
fireRate: 5
|
||||
selectedMode: FullAuto
|
||||
@@ -81,10 +80,15 @@
|
||||
visible: false
|
||||
sprite: White/Objects/Weapons/modulesOnWeapon.rsi
|
||||
map: [ "enum.ModuleVisualState.HandGuardModule" ]
|
||||
- state: aim_module
|
||||
visible: false
|
||||
sprite: White/Objects/Weapons/modulesOnWeapon.rsi
|
||||
map: [ "enum.ModuleVisualState.AimModule" ]
|
||||
- type: Gun
|
||||
fireRate: 5
|
||||
soundGunshot:
|
||||
path: /Audio/Weapons/Guns/Gunshots/ak.ogg
|
||||
- type: WeaponModules
|
||||
- type: ChamberMagazineAmmoProvider
|
||||
soundRack:
|
||||
path: /Audio/Weapons/Guns/Cock/ltrifle_cock.ogg
|
||||
@@ -122,12 +126,21 @@
|
||||
whitelist:
|
||||
tags:
|
||||
- BaseBarrelModule
|
||||
aim_module:
|
||||
name: Aim Module
|
||||
insertSound: /Audio/White/Gun/Modules/insertmodule.ogg
|
||||
ejectSound: /Audio/White/Gun/Modules/ejectmodule.ogg
|
||||
priority: 3
|
||||
whitelist:
|
||||
tags:
|
||||
- BaseAimModule
|
||||
- type: ContainerContainer
|
||||
containers:
|
||||
gun_magazine: !type:ContainerSlot
|
||||
gun_chamber: !type:ContainerSlot
|
||||
handguard_module: !type:ContainerSlot
|
||||
barrel_module: !type:ContainerSlot
|
||||
aim_module: !type:ContainerSlot
|
||||
- type: MagazineVisuals
|
||||
magState: mag
|
||||
steps: 1
|
||||
@@ -201,11 +214,16 @@
|
||||
visible: false
|
||||
sprite: White/Objects/Weapons/modulesOnWeapon.rsi
|
||||
map: [ "enum.ModuleVisualState.HandGuardModule" ]
|
||||
- state: aim_module
|
||||
visible: false
|
||||
sprite: White/Objects/Weapons/modulesOnWeapon.rsi
|
||||
map: [ "enum.ModuleVisualState.AimModule" ]
|
||||
- type: Clothing
|
||||
sprite: Objects/Weapons/Guns/Rifles/lecter.rsi
|
||||
- type: Gun
|
||||
soundGunshot:
|
||||
path: /Audio/Weapons/Guns/Gunshots/ltrifle.ogg
|
||||
- type: WeaponModules
|
||||
- type: ItemSlots
|
||||
slots:
|
||||
gun_magazine:
|
||||
@@ -240,12 +258,21 @@
|
||||
whitelist:
|
||||
tags:
|
||||
- BaseBarrelModule
|
||||
aim_module:
|
||||
name: Aim Module
|
||||
insertSound: /Audio/White/Gun/Modules/insertmodule.ogg
|
||||
ejectSound: /Audio/White/Gun/Modules/ejectmodule.ogg
|
||||
priority: 3
|
||||
whitelist:
|
||||
tags:
|
||||
- BaseAimModule
|
||||
- type: ContainerContainer
|
||||
containers:
|
||||
gun_magazine: !type:ContainerSlot
|
||||
gun_chamber: !type:ContainerSlot
|
||||
handguard_module: !type:ContainerSlot
|
||||
barrel_module: !type:ContainerSlot
|
||||
aim_module: !type:ContainerSlot
|
||||
- type: MagazineVisuals
|
||||
magState: mag
|
||||
steps: 1
|
||||
@@ -261,6 +288,7 @@
|
||||
id: WeaponRifleLecterRubber
|
||||
suffix: Non-lethal
|
||||
components:
|
||||
- type: WeaponModules
|
||||
- type: ItemSlots
|
||||
slots:
|
||||
gun_magazine:
|
||||
@@ -295,3 +323,11 @@
|
||||
whitelist:
|
||||
tags:
|
||||
- BaseBarrelModule
|
||||
aim_module:
|
||||
name: Aim Module
|
||||
insertSound: /Audio/White/Gun/Modules/insertmodule.ogg
|
||||
ejectSound: /Audio/White/Gun/Modules/ejectmodule.ogg
|
||||
priority: 3
|
||||
whitelist:
|
||||
tags:
|
||||
- BaseAimModule
|
||||
|
||||
@@ -108,6 +108,10 @@
|
||||
visible: false
|
||||
sprite: White/Objects/Weapons/modulesOnSMGs.rsi
|
||||
map: [ "enum.ModuleVisualState.HandGuardModule" ]
|
||||
- state: aim_module
|
||||
visible: false
|
||||
sprite: White/Objects/Weapons/modulesOnSMGs.rsi
|
||||
map: [ "enum.ModuleVisualState.AimModule" ]
|
||||
- type: Clothing
|
||||
sprite: Objects/Weapons/Guns/SMGs/c20r.rsi
|
||||
- type: Gun
|
||||
@@ -150,12 +154,21 @@
|
||||
whitelist:
|
||||
tags:
|
||||
- BaseHandGuardModule
|
||||
aim_module:
|
||||
name: Aim Module
|
||||
insertSound: /Audio/White/Gun/Modules/insertmodule.ogg
|
||||
ejectSound: /Audio/White/Gun/Modules/ejectmodule.ogg
|
||||
priority: 3
|
||||
whitelist:
|
||||
tags:
|
||||
- BaseAimModule
|
||||
- type: ContainerContainer
|
||||
containers:
|
||||
gun_magazine: !type:ContainerSlot
|
||||
gun_chamber: !type:ContainerSlot
|
||||
handguard_module: !type:ContainerSlot
|
||||
barrel_module: !type:ContainerSlot
|
||||
aim_module: !type:ContainerSlot
|
||||
- type: MagazineVisuals
|
||||
magState: mag
|
||||
steps: 6
|
||||
@@ -186,6 +199,10 @@
|
||||
visible: false
|
||||
sprite: White/Objects/Weapons/modulesOnWeapon.rsi
|
||||
map: [ "enum.ModuleVisualState.HandGuardModule" ]
|
||||
- state: aim_module
|
||||
visible: false
|
||||
sprite: White/Objects/Weapons/modulesOnWeapon.rsi
|
||||
map: [ "enum.ModuleVisualState.AimModule" ]
|
||||
- type: Clothing
|
||||
sprite: Objects/Weapons/Guns/SMGs/drozd.rsi
|
||||
- type: Gun
|
||||
@@ -230,12 +247,21 @@
|
||||
whitelist:
|
||||
tags:
|
||||
- BaseHandGuardModule
|
||||
aim_module:
|
||||
name: Aim Module
|
||||
insertSound: /Audio/White/Gun/Modules/insertmodule.ogg
|
||||
ejectSound: /Audio/White/Gun/Modules/ejectmodule.ogg
|
||||
priority: 3
|
||||
whitelist:
|
||||
tags:
|
||||
- BaseAimModule
|
||||
- type: ContainerContainer
|
||||
containers:
|
||||
gun_magazine: !type:ContainerSlot
|
||||
gun_chamber: !type:ContainerSlot
|
||||
handguard_module: !type:ContainerSlot
|
||||
barrel_module: !type:ContainerSlot
|
||||
aim_module: !type:ContainerSlot
|
||||
- type: MagazineVisuals
|
||||
magState: mag
|
||||
steps: 1
|
||||
@@ -319,6 +345,10 @@
|
||||
visible: false
|
||||
sprite: White/Objects/Weapons/modulesOnWeapon.rsi
|
||||
map: [ "enum.ModuleVisualState.HandGuardModule" ]
|
||||
- state: aim_module
|
||||
visible: false
|
||||
sprite: White/Objects/Weapons/modulesOnWeapon.rsi
|
||||
map: [ "enum.ModuleVisualState.AimModule" ]
|
||||
- type: Clothing
|
||||
sprite: Objects/Weapons/Guns/SMGs/wt550.rsi
|
||||
- type: ChamberMagazineAmmoProvider
|
||||
@@ -363,12 +393,21 @@
|
||||
whitelist:
|
||||
tags:
|
||||
- BaseHandGuardModule
|
||||
aim_module:
|
||||
name: Aim Module
|
||||
insertSound: /Audio/White/Gun/Modules/insertmodule.ogg
|
||||
ejectSound: /Audio/White/Gun/Modules/ejectmodule.ogg
|
||||
priority: 2
|
||||
whitelist:
|
||||
tags:
|
||||
- BaseAimModule
|
||||
- type: ContainerContainer
|
||||
containers:
|
||||
gun_magazine: !type:ContainerSlot
|
||||
gun_chamber: !type:ContainerSlot
|
||||
handguard_module: !type:ContainerSlot
|
||||
barrel_module: !type:ContainerSlot
|
||||
aim_module: !type:ContainerSlot
|
||||
- type: MagazineVisuals
|
||||
magState: mag
|
||||
steps: 6
|
||||
@@ -419,6 +458,14 @@
|
||||
whitelist:
|
||||
tags:
|
||||
- BaseHandGuardModule
|
||||
aim_module:
|
||||
name: Aim Module
|
||||
insertSound: /Audio/White/Gun/Modules/insertmodule.ogg
|
||||
ejectSound: /Audio/White/Gun/Modules/ejectmodule.ogg
|
||||
priority: 3
|
||||
whitelist:
|
||||
tags:
|
||||
- BaseAimModule
|
||||
|
||||
- type: entity
|
||||
name: Vector
|
||||
|
||||
@@ -701,3 +701,12 @@
|
||||
Plastic: 1000
|
||||
Glass: 500
|
||||
Gold: 1000
|
||||
|
||||
- type: latheRecipe
|
||||
id: EightAimRecipe
|
||||
result: EightAimModule
|
||||
completetime: 15
|
||||
materials:
|
||||
Steel: 500
|
||||
Plastic: 700
|
||||
Glass: 300
|
||||
@@ -32,6 +32,23 @@
|
||||
- 0,0,0,0
|
||||
- type: Appearance
|
||||
|
||||
- type: entity
|
||||
id: BaseAimModule
|
||||
parent: BaseItem
|
||||
abstract: true
|
||||
components:
|
||||
- type: Sprite
|
||||
sprite: White/Objects/Weapons/modules.rsi
|
||||
- type: Tag
|
||||
tags:
|
||||
- BaseAimModule
|
||||
- type: Item
|
||||
sprite: White/Objects/Weapons/modules.rsi
|
||||
size: Small
|
||||
shape:
|
||||
- 0,0,0,0
|
||||
- type: Appearance
|
||||
|
||||
# modules
|
||||
- type: entity
|
||||
id: LightModule
|
||||
@@ -97,3 +114,16 @@
|
||||
- type: Sprite
|
||||
state: accelerator
|
||||
- type: Appearance
|
||||
|
||||
- type: entity
|
||||
id: EightAimModule
|
||||
description: 8X Aim Module for rifles.
|
||||
name: "aim module"
|
||||
parent: BaseAimModule
|
||||
components:
|
||||
- type: AimModule
|
||||
value: "eightaim"
|
||||
module_type: "aim_module"
|
||||
- type: Sprite
|
||||
state: eightaim
|
||||
- type: Appearance
|
||||
@@ -75,3 +75,6 @@
|
||||
|
||||
- type: Tag
|
||||
id: BaseHandGuardModule
|
||||
|
||||
- type: Tag
|
||||
id: BaseAimModule
|
||||
|
||||
Binary file not shown.
|
After Width: | Height: | Size: 2.7 KiB |
Binary file not shown.
|
After Width: | Height: | Size: 2.7 KiB |
@@ -22,11 +22,17 @@
|
||||
{
|
||||
"name": "accelerator"
|
||||
},
|
||||
{
|
||||
"name": "eightaim"
|
||||
},
|
||||
{
|
||||
"name": "barrel_module"
|
||||
},
|
||||
{
|
||||
"name": "handguard_module"
|
||||
},
|
||||
{
|
||||
"name": "aim_module"
|
||||
}
|
||||
]
|
||||
}
|
||||
|
||||
Binary file not shown.
|
After Width: | Height: | Size: 157 B |
Binary file not shown.
|
After Width: | Height: | Size: 157 B |
@@ -22,11 +22,17 @@
|
||||
{
|
||||
"name": "accelerator"
|
||||
},
|
||||
{
|
||||
"name": "eightaim"
|
||||
},
|
||||
{
|
||||
"name": "handguard_module"
|
||||
},
|
||||
{
|
||||
"name": "barrel_module"
|
||||
},
|
||||
{
|
||||
"name": "aim_module"
|
||||
}
|
||||
]
|
||||
}
|
||||
|
||||
Binary file not shown.
|
After Width: | Height: | Size: 157 B |
Binary file not shown.
|
After Width: | Height: | Size: 157 B |
@@ -22,11 +22,17 @@
|
||||
{
|
||||
"name": "accelerator"
|
||||
},
|
||||
{
|
||||
"name": "eightaim"
|
||||
},
|
||||
{
|
||||
"name": "handguard_module"
|
||||
},
|
||||
{
|
||||
"name": "barrel_module"
|
||||
},
|
||||
{
|
||||
"name": "aim_module"
|
||||
}
|
||||
]
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user