55// SPDX-FileCopyrightText: 2023 ShadowCommander <10494922+ShadowCommander@users.noreply.github.com>
66// SPDX-FileCopyrightText: 2023 TemporalOroboros <TemporalOroboros@gmail.com>
77// SPDX-FileCopyrightText: 2023 eoineoineoin <github@eoinrul.es>
8- // SPDX-FileCopyrightText: 2024 Jajsha <101492056+Zap527@users.noreply.github.com>
98// SPDX-FileCopyrightText: 2024 LucasTheDrgn <kirbyfan.95@gmail.com>
109// SPDX-FileCopyrightText: 2024 Nemanja <98561806+EmoGarbage404@users.noreply.github.com>
1110// SPDX-FileCopyrightText: 2024 Piras314 <p1r4s@proton.me>
1918// SPDX-FileCopyrightText: 2025 Tay <td12233a@gmail.com>
2019// SPDX-FileCopyrightText: 2025 ThatOneMoon <91613003+ThatOneMoon@users.noreply.github.com>
2120// SPDX-FileCopyrightText: 2025 ThatOneMoon <juozas.dringelis@gmail.com>
22- // SPDX-FileCopyrightText: 2025 Tyranex <bobthezombie4@gmail.com>
2321// SPDX-FileCopyrightText: 2025 pa.pecherskij <pa.pecherskij@interfax.ru>
2422// SPDX-FileCopyrightText: 2025 taydeo <td12233a@gmail.com>
2523// SPDX-FileCopyrightText: 2025 willow <willowzeta632146@proton.me>
3836using Content . Shared . Chemistry . Components ;
3937using Content . Shared . Chemistry . Components . SolutionManager ;
4038using Content . Shared . Chemistry . EntitySystems ;
41- using Content . Shared . Damage ;
4239using Content . Shared . Database ;
4340using Content . Shared . Destructible ;
4441using Content . Shared . Emag . Components ;
@@ -70,7 +67,6 @@ public sealed class MaterialReclaimerSystem : SharedMaterialReclaimerSystem
7067 [ Dependency ] private readonly PopupSystem _popup = default ! ;
7168 [ Dependency ] private readonly SharedSolutionContainerSystem _solutionContainer = default ! ;
7269 [ Dependency ] private readonly SharedBodySystem _body = default ! ; //bobby
73- [ Dependency ] private readonly DamageableSystem _damageable = default ! ; //Harmony
7470 [ Dependency ] private readonly PuddleSystem _puddle = default ! ;
7571 [ Dependency ] private readonly StackSystem _stack = default ! ;
7672 [ Dependency ] private readonly SharedMindSystem _mind = default ! ;
@@ -209,28 +205,34 @@ public override void Reclaim(EntityUid uid,
209205 if ( ! Resolve ( uid , ref component ) )
210206 return ;
211207
208+ // Allow systems to intercept processing (e.g., robotics factory conversion).
209+ var processEvent = new MaterialReclaimerProcessEntityEvent ( item ) ;
210+ RaiseLocalEvent ( uid , processEvent ) ;
211+ if ( processEvent . Handled )
212+ {
213+ return ;
214+ }
215+
212216 base . Reclaim ( uid , item , completion , component ) ;
213217
214218 var xform = Transform ( uid ) ;
215219
216220 SpawnMaterialsFromComposition ( uid , item , completion * component . Efficiency , xform : xform ) ;
217221
218- if ( CanRecycleMob ( uid , item , component ) )
222+ if ( CanGib ( uid , item , component ) )
219223 {
220- // Harmony - Recycler now deals damage instead of gibbing.
221- if ( component . Damage == null )
222- return ;
223-
224- _damageable . TryChangeDamage ( item , component . Damage , true ) ;
225- _adminLogger . Add ( LogType . Damaged , LogImpact . Medium , $ "{ ToPrettyString ( item ) : victim} was recycled by { ToPrettyString ( uid ) : entity} , dealing { component . Damage . GetTotal ( ) } damage.") ;
224+ var logImpact = HasComp < HumanoidAppearanceComponent > ( item ) ? LogImpact . Extreme : LogImpact . Medium ;
225+ _adminLogger . Add ( LogType . Gib , logImpact , $ "{ ToPrettyString ( item ) : victim} was gibbed by { ToPrettyString ( uid ) : entity} ") ;
226+ SpawnChemicalsFromComposition ( uid , item , completion , false , component , xform ) ;
227+ _body . GibBody ( item , true ) ;
226228 _appearance . SetData ( uid , RecyclerVisuals . Bloody , true ) ;
227229 }
228230 else
229231 {
230232 SpawnChemicalsFromComposition ( uid , item , completion , true , component , xform ) ;
231- QueueDel ( item ) ;
232233 }
233234
235+ QueueDel ( item ) ;
234236 }
235237
236238 private void SpawnMaterialsFromComposition ( EntityUid reclaimer ,
@@ -246,9 +248,12 @@ private void SpawnMaterialsFromComposition(EntityUid reclaimer,
246248 if ( ! Resolve ( item , ref composition , false ) )
247249 return ;
248250
251+ // If more of these checks are needed, use an event instead
252+ var modifier = CompOrNull < StackComponent > ( item ) ? . Count ?? 1.0f ;
253+
249254 foreach ( var ( material , amount ) in composition . MaterialComposition )
250255 {
251- var outputAmount = ( int ) ( amount * efficiency ) ;
256+ var outputAmount = ( int ) ( amount * efficiency * modifier ) ;
252257 _materialStorage . TryChangeMaterialAmount ( reclaimer , material , outputAmount , storage ) ;
253258 }
254259
0 commit comments