Skip to content

Commit 2dc06e1

Browse files
committed
some fixes
1 parent 6afeb60 commit 2dc06e1

9 files changed

Lines changed: 327 additions & 51 deletions

File tree

Content.Server/Mech/Systems/MechSystem.cs

Lines changed: 18 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -144,6 +144,14 @@ public override void Update(float frameTime)
144144
}
145145
}
146146

147+
private void AttachBatteryComponents(EntityUid mech, EntityUid battery)
148+
{
149+
var mechBattery = EnsureComp<MechBatteryComponent>(battery);
150+
mechBattery.Mech = mech;
151+
152+
EnsureComp<EmpProtectionComponent>(battery);
153+
}
154+
147155
private void OnItemRemoved(EntityUid mech, MechComponent mechComp, EntRemovedFromContainerMessage args)
148156
{
149157
Dirty(mech, mechComp);
@@ -287,7 +295,7 @@ private void OnInteractUsing(EntityUid uid, MechComponent component, InteractUsi
287295
&& TryComp<BatteryComponent>(args.Used, out var battery)
288296
&& _whitelistSystem.IsWhitelistPass(component.GasTankWhitelist, args.Used))
289297
{
290-
InsertBattery(uid, args.Used, component);
298+
InsertBattery(uid, args.Used, component, battery);
291299
UpdateCanMove(uid, component);
292300
return;
293301
}
@@ -329,6 +337,8 @@ private void OnInsertEquipment(EntityUid uid, MechComponent component, EntInsert
329337
UpdateUserInterface(uid, component);
330338
if (!(args.Container != component.BatterySlot || !TryComp<BatteryComponent>(args.Entity, out var battery)))
331339
{
340+
AttachBatteryComponents(uid, args.Entity);
341+
332342
component.Energy = battery.CurrentCharge;
333343
component.MaxEnergy = battery.MaxCharge;
334344

@@ -382,11 +392,9 @@ private void OnMapInit(EntityUid uid, MechComponent component, MapInitEvent args
382392
component.Energy = component.MaxEnergy;
383393

384394
// Forge-Change-start
385-
if (component.BatterySlot.ContainedEntity != null)
395+
if (component.BatterySlot.ContainedEntity is { } battery)
386396
{
387-
var mechBattery = EnsureComp<MechBatteryComponent>(
388-
EnsureComp<EmpProtectionComponent>(component.BatterySlot.ContainedEntity.Value).Owner);
389-
mechBattery.Mech = uid;
397+
AttachBatteryComponents(uid, battery);
390398
}
391399
// Forge-Change-end
392400

@@ -637,18 +645,18 @@ public void InsertGasTank(EntityUid uid, EntityUid toInsert, MechComponent? comp
637645
Dirty(uid, component);
638646
}
639647

640-
public void InsertBattery(EntityUid uid, EntityUid toInsert, MechComponent? component = null)
648+
public void InsertBattery(EntityUid uid, EntityUid toInsert, MechComponent? component = null, BatteryComponent? battery = null)
641649
{
642650
if (!Resolve(uid, ref component, false))
643651
return;
644652

645-
var mechBattery = EnsureComp<MechBatteryComponent>(toInsert);
646-
mechBattery.Mech = uid;
647-
EnsureComp<EmpProtectionComponent>(toInsert);
653+
TryComp(toInsert, out battery);
654+
655+
AttachBatteryComponents(uid, toInsert); // Forge-Change
648656

649657
_container.Insert(toInsert, component.BatterySlot);
650658

651-
if (TryComp<BatteryComponent>(toInsert, out var battery))
659+
if (battery != null)
652660
{
653661
component.Energy = battery.CurrentCharge;
654662
component.MaxEnergy = battery.MaxCharge;
Lines changed: 244 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,244 @@
1+
#region Tier 3
2+
- type: entity
3+
name: gygax
4+
categories: [ HideSpawnMenu ]
5+
parent:
6+
- MobStaminaSpecial
7+
- MobMercenaryBase
8+
#- MobLaserReflect # Added to prevent laser abuse from players
9+
id: MobMercenaryGygax
10+
description: |-
11+
While lightly armored, the Gygax has incredible mobility thanks to its ability that lets it smash through walls at high speeds.
12+
components:
13+
- type: Loadout
14+
prototypes:
15+
- MobHumanoidExplorerGearMechT3
16+
- type: Damageable
17+
damageModifierSet: MobRogueSiliconDamageModifierSet
18+
- type: Sprite
19+
drawdepth: Mobs
20+
sprite: Objects/Specific/Mech/mecha.rsi
21+
layers:
22+
- map: [ "enum.MechVisualLayers.Base" ]
23+
state: gygax
24+
- type: DamageStateVisuals
25+
states:
26+
Alive:
27+
Base: gygax
28+
Critical:
29+
Base: gygax-broken
30+
Dead:
31+
Base: gygax-broken
32+
- type: Bloodstream
33+
bloodReagent: WeldingFuel
34+
bloodMaxVolume: 100
35+
- type: MobThresholds
36+
thresholds:
37+
0: Alive
38+
205: Dead
39+
- type: Destructible
40+
thresholds:
41+
- trigger:
42+
!type:DamageTrigger
43+
damage: 200
44+
behaviors:
45+
- !type:PlaySoundBehavior
46+
sound:
47+
collection: GlassBreak
48+
- !type:SpawnEntitiesBehavior
49+
spawn:
50+
SpawnMobMercenaryT2:
51+
min: 1
52+
max: 1
53+
GygaxChassis:
54+
min: 1
55+
max: 1
56+
GygaxCentralElectronics:
57+
min: 1
58+
max: 1
59+
GygaxPeripheralsElectronics:
60+
min: 1
61+
max: 1
62+
GygaxTargetingElectronics:
63+
min: 1
64+
max: 1
65+
- !type:DoActsBehavior
66+
acts: [ "Destruction" ]
67+
- type: FootstepModifier
68+
footstepSoundCollection:
69+
path: /Audio/Mecha/sound_mecha_powerloader_step.ogg
70+
- type: PointLight
71+
color: green
72+
radius: 5
73+
energy: 2
74+
- type: Gun
75+
fireRate: 6
76+
shotsPerBurst: 3
77+
burstCooldown: 3
78+
selectedMode: Burst
79+
availableModes:
80+
- Burst
81+
soundGunshot:
82+
path: /Audio/Weapons/Guns/Gunshots/shotgun.ogg
83+
- type: BasicEntityAmmoProvider
84+
proto: NFCartridgeRifle30
85+
capacity: 6
86+
count: 6
87+
- type: MovementSpeedModifier
88+
baseWalkSpeed: 3
89+
baseSprintSpeed: 4
90+
91+
- type: entity
92+
name: durand
93+
categories: [ HideSpawnMenu ]
94+
parent:
95+
- MobStaminaSpecial
96+
- MobMercenaryBase
97+
#- MobLaserReflect # Added to prevent laser abuse from players
98+
id: MobMercenaryDurand
99+
description: |-
100+
A slow but beefy combat exosuit that is extra scary in confined spaces due to its punches. Xenos hate it!
101+
components:
102+
- type: Loadout
103+
prototypes:
104+
- MobHumanoidExplorerGearMechT3
105+
- type: Damageable
106+
damageModifierSet: MobRogueSiliconDamageModifierSet
107+
- type: Sprite
108+
drawdepth: Mobs
109+
sprite: Objects/Specific/Mech/mecha.rsi
110+
layers:
111+
- map: [ "enum.MechVisualLayers.Base" ]
112+
state: durand
113+
- type: DamageStateVisuals
114+
states:
115+
Alive:
116+
Base: durand
117+
Critical:
118+
Base: durand-broken
119+
Dead:
120+
Base: durand-broken
121+
- type: Bloodstream
122+
bloodReagent: WeldingFuel
123+
bloodMaxVolume: 100
124+
- type: MobThresholds
125+
thresholds:
126+
0: Alive
127+
255: Dead
128+
- type: Destructible
129+
thresholds:
130+
- trigger:
131+
!type:DamageTrigger
132+
damage: 250
133+
behaviors:
134+
- !type:PlaySoundBehavior
135+
sound:
136+
collection: GlassBreak
137+
- !type:SpawnEntitiesBehavior
138+
spawn:
139+
SpawnMobMercenaryT2:
140+
min: 1
141+
max: 1
142+
DurandChassis:
143+
min: 1
144+
max: 1
145+
DurandCentralElectronics:
146+
min: 1
147+
max: 1
148+
DurandPeripheralsElectronics:
149+
min: 1
150+
max: 1
151+
DurandTargetingElectronics:
152+
min: 1
153+
max: 1
154+
- !type:DoActsBehavior
155+
acts: [ "Destruction" ]
156+
- type: FootstepModifier
157+
footstepSoundCollection:
158+
path: /Audio/Mecha/sound_mecha_powerloader_step.ogg
159+
- type: PointLight
160+
color: green
161+
radius: 5
162+
energy: 2
163+
- type: BasicEntityAmmoProvider
164+
proto: NFShellShotgunBuckshot
165+
capacity: 2
166+
count: 2
167+
- type: Gun
168+
showExamineText: false
169+
fireRate: 1.5
170+
selectedMode: FullAuto
171+
availableModes:
172+
- FullAuto
173+
soundGunshot:
174+
path: /Audio/Weapons/Guns/Gunshots/shotgun.ogg
175+
- type: MovementSpeedModifier
176+
baseWalkSpeed: 1.5
177+
baseSprintSpeed: 2
178+
179+
#region Space, T3
180+
- type: entity
181+
id: MobMercenaryGygaxEVA
182+
parent: MobMercenaryGygax
183+
components:
184+
- type: Destructible
185+
thresholds:
186+
- trigger:
187+
!type:DamageTrigger
188+
damage: 155
189+
behaviors:
190+
- !type:PlaySoundBehavior
191+
sound:
192+
collection: GlassBreak
193+
- !type:SpawnEntitiesBehavior
194+
spawn:
195+
SpawnMobMercenaryEVAT2:
196+
min: 1
197+
max: 1
198+
GygaxChassis:
199+
min: 1
200+
max: 1
201+
GygaxCentralElectronics:
202+
min: 1
203+
max: 1
204+
GygaxPeripheralsElectronics:
205+
min: 1
206+
max: 1
207+
GygaxTargetingElectronics:
208+
min: 1
209+
max: 1
210+
- !type:DoActsBehavior
211+
acts: [ "Destruction" ]
212+
213+
- type: entity
214+
id: MobMercenaryDurandEVA
215+
parent: MobMercenaryDurand
216+
components:
217+
- type: Destructible
218+
thresholds:
219+
- trigger:
220+
!type:DamageTrigger
221+
damage: 155
222+
behaviors:
223+
- !type:PlaySoundBehavior
224+
sound:
225+
collection: GlassBreak
226+
- !type:SpawnEntitiesBehavior
227+
spawn:
228+
SpawnMobMercenaryEVAT2:
229+
min: 1
230+
max: 1
231+
DurandChassis:
232+
min: 1
233+
max: 1
234+
DurandCentralElectronics:
235+
min: 1
236+
max: 1
237+
DurandPeripheralsElectronics:
238+
min: 1
239+
max: 1
240+
DurandTargetingElectronics:
241+
min: 1
242+
max: 1
243+
- !type:DoActsBehavior
244+
acts: [ "Destruction" ]

Resources/Prototypes/Recipes/Lathes/Packs/robotics.yml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,12 @@
77
- PositronicBrain
88
- SciFlash
99
- CyborgEndoskeleton
10+
#Forge-Change Mechs
1011
- MechAirTank
1112
- MechThruster
13+
- PowerCageHigh
14+
- PowerCageMedium
15+
- PowerCageSmall
1216

1317
- type: latheRecipePack
1418
id: BorgModulesStatic

Resources/Prototypes/_Forge/Recipes/Lathes/Packs/CorvaxPacks.yml

Lines changed: 0 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -31,31 +31,6 @@
3131
- ShuttleRifleAmmoBox
3232
- ShuttleMagnumRifleAmmoBox
3333

34-
- type: latheRecipePack
35-
id: CorvaxMechsWeaponsNFSDDynamic
36-
recipes:
37-
- MechEquipmentUltraRifle
38-
- MechEquipmentShotgun
39-
- MechEquipmentShotgunIncendiary
40-
- MechEquipmentFiredartLaser
41-
- MechEquipmentSolarisLaser
42-
- MechEquipmentImmolationGun
43-
- MechEquipmentXRayProjector
44-
- MechEquipmentMissileRack8
45-
- MechEquipmentMissileRack6
46-
47-
- type: latheRecipePack
48-
id: CorvaxMechsWeaponsDynamic
49-
recipes:
50-
- MechEquipmentUltraRifle
51-
- MechEquipmentShotgun
52-
- MechEquipmentShotgunIncendiary
53-
- MechEquipmentFiredartLaser
54-
- MechEquipmentSolarisLaser
55-
- MechEquipmentImmolationGun
56-
- MechEquipmentXRayProjector
57-
- MechEquipmentMissileRack8
58-
5934
#Снаряжение
6035
- type: latheRecipePack
6136
id: CorvaxEquipment

Resources/Prototypes/_Forge/Recipes/Lathes/Packs/salvage_techfab.yml

Lines changed: 0 additions & 7 deletions
This file was deleted.

0 commit comments

Comments
 (0)