Skip to content

Commit

Permalink
Merge branch 'upstream-sync' of https://github.com/Rxup/space-station-14
Browse files Browse the repository at this point in the history
 into upstream-sync
  • Loading branch information
KayzelW committed Oct 6, 2023
2 parents f064c1e + 9bb034c commit 0bd0e97
Show file tree
Hide file tree
Showing 9 changed files with 87 additions and 11 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -18,5 +18,6 @@ public sealed partial class ZombieSurpriseComponent : Component
[Access(typeof(NPCZombieSystem))]
public sealed partial class ZombifiedOnSpawnComponent : Component
{

[DataField("isBoss")]
public bool IsBoss = false;
}
72 changes: 66 additions & 6 deletions Content.Server/Backmen/Shipwrecked/NPCZombieSystem.cs
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,10 @@
using Content.Server.NPC.HTN;
using Content.Server.NPC.Systems;
using Content.Server.Zombies;
using Content.Shared.Damage;
using Content.Shared.Humanoid;
using Content.Shared.Tools.Components;
using Content.Shared.Weapons.Melee;
using Content.Shared.Zombies;
using Robust.Server.GameObjects;
using Robust.Server.Physics;
Expand All @@ -16,10 +18,6 @@ namespace Content.Server.Backmen.Shipwrecked;

public sealed class NPCZombieSystem : EntitySystem
{
[Dependency] private readonly IPrototypeManager _prototypeManager = default!;
[Dependency] private readonly NpcFactionSystem _npcFactonSystem = default!;
[Dependency] private readonly JointSystem _jointSystem = default!;
[Dependency] private readonly NPCSystem _npcSystem = default!;
[Dependency] private readonly ZombieSystem _zombieSystem = default!;

public override void Initialize()
Expand All @@ -31,10 +29,72 @@ public override void Initialize()
SubscribeLocalEvent<ZombieWakeupOnTriggerComponent, TriggerEvent>(OnZombieWakeupTrigger);
}

private void ZombifyEntity(EntityUid uid, bool isBoss)
{


_zombieSystem.ZombifyEntity(uid);


var z = EnsureComp<ZombieComponent>(uid);
z.MaxZombieInfectionChance = 0.0001f;
z.MinZombieInfectionChance = 0.00001f;

var melee = EnsureComp<MeleeWeaponComponent>(uid); // npc (lower damage, like a flesh)
melee.Angle = 0;
melee.AttackRate = 1;
melee.BluntStaminaDamageFactor = 0.5;
melee.ClickDamageModifier = 1;
melee.Range = 1.5f;



if (!isBoss)
{
z.HealingOnBite = new();

DamageSpecifier dspec = new()
{
DamageDict = new()
{
{ "Slash", 8 }
}
};
melee.Damage = dspec;
z.HealingOnBite = new();
z.ZombieMovementSpeedDebuff = 0.60f;
Dirty(uid,melee);
}
else
{
DamageSpecifier dspec = new()
{
DamageDict = new()
{
{ "Slash", 14 },
{ "Piercing", 6 }
}
};
melee.Damage = dspec;
Dirty(uid,melee);
DamageSpecifier hspec = new()
{
DamageDict = new()
{
{ "Blunt", -1 },
{ "Slash", -1 },
{ "Piercing", -1 }
}
};
z.HealingOnBite = hspec;
}
Dirty(uid,z);
}

private void OnSpawnZombifiedStartup(EntityUid uid, ZombifiedOnSpawnComponent component, ComponentStartup args)
{
RemCompDeferred<ZombifiedOnSpawnComponent>(uid);
_zombieSystem.ZombifyEntity(uid);
ZombifyEntity(uid, component.IsBoss);
}

[ValidatePrototypeId<EntityPrototype>] private const string ZombieSurpriseDetector = "ZombieSurpriseDetector";
Expand All @@ -53,6 +113,6 @@ private void OnZombieWakeupTrigger(EntityUid uid, ZombieWakeupOnTriggerComponent
if (toZombify == null || Deleted(toZombify))
return;

_zombieSystem.ZombifyEntity(toZombify.Value);
ZombifyEntity(toZombify.Value, false);
}
}
3 changes: 3 additions & 0 deletions Content.Shared/Clothing/Components/LoadoutComponent.cs
Original file line number Diff line number Diff line change
Expand Up @@ -13,4 +13,7 @@ public sealed partial class LoadoutComponent : Component
/// </summary>
[DataField("prototypes", required: true, customTypeSerializer: typeof(PrototypeIdListSerializer<StartingGearPrototype>)), AutoNetworkedField]
public List<string>? Prototypes;

[DataField("force")]
public bool Force = false;
}
2 changes: 1 addition & 1 deletion Content.Shared/Clothing/LoadoutSystem.cs
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,6 @@ private void OnMapInit(EntityUid uid, LoadoutComponent component, MapInitEvent a
return;

var proto = _protoMan.Index<StartingGearPrototype>(_random.Pick(component.Prototypes));
_station.EquipStartingGear(uid, proto, null);
_station.EquipStartingGear(uid, proto, null, component.Force);
}
}
5 changes: 3 additions & 2 deletions Content.Shared/Station/SharedStationSpawningSystem.cs
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,8 @@ public abstract class SharedStationSpawningSystem : EntitySystem
/// <param name="entity">Entity to load out.</param>
/// <param name="startingGear">Starting gear to use.</param>
/// <param name="profile">Character profile to use, if any.</param>
public void EquipStartingGear(EntityUid entity, StartingGearPrototype startingGear, HumanoidCharacterProfile? profile)
/// <param name="force">force for corpses</param>
public void EquipStartingGear(EntityUid entity, StartingGearPrototype startingGear, HumanoidCharacterProfile? profile, bool force = false)
{
if (InventorySystem.TryGetSlots(entity, out var slotDefinitions))
{
Expand All @@ -27,7 +28,7 @@ public void EquipStartingGear(EntityUid entity, StartingGearPrototype startingGe
if (!string.IsNullOrEmpty(equipmentStr))
{
var equipmentEntity = EntityManager.SpawnEntity(equipmentStr, EntityManager.GetComponent<TransformComponent>(entity).Coordinates);
InventorySystem.TryEquip(entity, equipmentEntity, slot.Name, true);
InventorySystem.TryEquip(entity, equipmentEntity, slot.Name, true, force);
}
}
}
Expand Down
1 change: 1 addition & 0 deletions Resources/Prototypes/Backmen/Entities/Mobs/NPC/corpses.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@
id: CorpseUnaffiliated
components:
- type: Loadout
force: true
prototypes:
- UnaffiliatedChaplainGear
- UnaffiliatedChefGear
Expand Down
4 changes: 4 additions & 0 deletions Resources/Prototypes/Backmen/Entities/Mobs/NPC/zombies.yml
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,7 @@
path: /Audio/Items/jaws_pry.ogg
# BASE
- type: Loadout
force: true
prototypes:
- UnaffiliatedChaplainGear
- UnaffiliatedChefGear
Expand Down Expand Up @@ -85,6 +86,7 @@
path: /Audio/Items/jaws_pry.ogg
# BASE
- type: Loadout
force: true
prototypes:
- UnaffiliatedChaplainGear
- UnaffiliatedChefGear
Expand All @@ -111,6 +113,7 @@
- Moth
components:
- type: ZombifiedOnSpawn
isBoss: true
- type: MovementSpeedModifier
baseWalkSpeed : 1.5
baseSprintSpeed : 3.0
Expand All @@ -122,6 +125,7 @@
path: /Audio/Items/jaws_pry.ogg
# BASE
- type: Loadout
force: true
prototypes:
- ZombieBruteGear
- type: Damageable
Expand Down
1 change: 0 additions & 1 deletion Resources/Prototypes/Backmen/game_presets.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@
name: shipwrecked-title
description: shipwrecked-description
minPlayers: 1
maxPlayers: 15
showInVote: true
isMiniGame: true
supportedMaps: ShipwreckedPool
Expand Down
7 changes: 7 additions & 0 deletions Resources/Prototypes/Entities/Mobs/Corpses/corpses.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
suffix: Dead, Service
components:
- type: Loadout
force: true
prototypes:
- HoPGear
- ClownGear
Expand All @@ -22,6 +23,7 @@
suffix: Dead, Engineer
components:
- type: Loadout
force: true
prototypes:
- TechnicalAssistantGear
- AtmosphericTechnicianGear
Expand All @@ -33,6 +35,7 @@
suffix: Dead, Cargo
components:
- type: Loadout
force: true
prototypes:
- CargoTechGear
- SalvageSpecialistGear
Expand All @@ -43,6 +46,7 @@
suffix: Dead, Medic
components:
- type: Loadout
force: true
prototypes:
- MedicalInternGear
- PsychologistGear
Expand All @@ -55,6 +59,7 @@
suffix: Dead, Science
components:
- type: Loadout
force: true
prototypes:
- ResearchAssistantGear
- ScientistGear
Expand All @@ -65,6 +70,7 @@
suffix: Dead, Security
components:
- type: Loadout
force: true
prototypes:
- SecurityCadetGear
- SecurityOfficerGear
Expand All @@ -77,6 +83,7 @@
suffix: Dead, Command
components:
- type: Loadout
force: true
prototypes:
- HoPGear
- CentComCorvax
Expand Down

0 comments on commit 0bd0e97

Please sign in to comment.