Skip to content

Commit

Permalink
Фелинидам не место в мехах для больших дядь
Browse files Browse the repository at this point in the history
  • Loading branch information
VigersRay committed Feb 9, 2025
1 parent 733ec19 commit 1e617b9
Show file tree
Hide file tree
Showing 7 changed files with 98 additions and 8 deletions.
10 changes: 8 additions & 2 deletions Content.Server/Mech/Systems/MechSystem.cs
Original file line number Diff line number Diff line change
Expand Up @@ -253,6 +253,12 @@ private void OnMechEntry(EntityUid uid, MechComponent component, MechEntryEvent
return;
}

if (_whitelistSystem.IsWhitelistPass(component.PilotBlacklist, args.User))
{
_popup.PopupEntity(Loc.GetString("mech-no-enter", ("item", uid)), args.User);
return;
}

if (TryComp<AccessReaderComponent>(uid, out var accessReader))
if (!_accessReader.IsAllowed(args.Args.User, uid, accessReader))
{
Expand Down Expand Up @@ -290,7 +296,7 @@ private void OnDamageChanged(EntityUid uid, MechComponent component, DamageChang
if (_mobThresholdSystem.TryGetThresholdForState(uid, MobState.Critical, out var critThreshold) && critThreshold != null)
component.MaxIntegrity = critThreshold.Value;
}

if (args.DamageIncreased &&
args.DamageDelta != null &&
component.PilotSlot.ContainedEntity != null)
Expand All @@ -299,7 +305,7 @@ private void OnDamageChanged(EntityUid uid, MechComponent component, DamageChang
_damageable.TryChangeDamage(component.PilotSlot.ContainedEntity, damagetoplayer);
}
}

private void PlayCritSound(EntityUid uid, MechComponent component, DamageableComponent damage )
{
var total = damage.TotalDamage;
Expand Down
7 changes: 5 additions & 2 deletions Content.Shared/Mech/Components/MechComponent.cs
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ public sealed partial class MechComponent : Component
/// </summary>
[ViewVariables(VVAccess.ReadWrite), AutoNetworkedField]
public bool Broken = false;

/// <summary>
/// Whether the mech has toggled lights.
/// </summary>
Expand Down Expand Up @@ -107,6 +107,9 @@ public sealed partial class MechComponent : Component
[DataField]
public EntityWhitelist? PilotWhitelist;

[DataField]
public EntityWhitelist? PilotBlacklist;

/// <summary>
/// A container for storing the equipment entities.
/// </summary>
Expand Down Expand Up @@ -151,7 +154,7 @@ public sealed partial class MechComponent : Component
/// </summary>
[DataField]
public List<EntProtoId> StartingEquipment = new();

#region Sounds
[DataField]
public SoundSpecifier EnableLightSound = new SoundPathSpecifier("/Audio/_Sunrise/Mechs/mech_lights_enabled.ogg");
Expand Down
3 changes: 3 additions & 0 deletions Content.Shared/Whitelist/EntityWhitelist.cs
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,9 @@ public sealed partial class EntityWhitelist
[DataField]
public List<ProtoId<TagPrototype>>? Tags;

[DataField]
public bool RequireAllTags;

// Sunrise-Start
[DataField]
public List<ProtoId<SpeciesPrototype>>? Species;
Expand Down
22 changes: 18 additions & 4 deletions Content.Shared/Whitelist/EntityWhitelistSystem.cs
Original file line number Diff line number Diff line change
Expand Up @@ -96,14 +96,28 @@ public bool IsValid(EntityWhitelist list, EntityUid uid)

if (list.Tags != null)
{
return list.RequireAll
? _tag.HasAllTags(uid, list.Tags)
: _tag.HasAnyTag(uid, list.Tags);
// Sunrise-Start
if (list.RequireAllTags ? _tag.HasAllTags(uid, list.Tags) : _tag.HasAnyTag(uid, list.Tags))
{
if (!list.RequireAll)
return true;
}
else if (list.RequireAll)
return false;
// Sunrise-End
}

// Sunrise-Start
if (list.Species != null && TryComp<HumanoidAppearanceComponent>(uid, out var appearance))
return list.Species.Contains(appearance.Species);
{
if (list.Species.Contains(appearance.Species))
{
if (!list.RequireAll)
return true;
}
else if (list.RequireAll)
return false;
}
// Sunrise-End

return list.RequireAll;
Expand Down
15 changes: 15 additions & 0 deletions Resources/Changelog/ChangelogSunrise.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11982,3 +11982,18 @@
type: Tweak
id: 825
time: '2025-02-09T20:38:28.533994+00:00'
- author: VigersRay
changes:
- message: "\u0424\u0435\u043B\u0438\u043D\u0438\u0434\u044B \u0431\u043E\u043B\u044C\
\u0448\u0435 \u043D\u0435 \u043C\u043E\u0433\u0443\u0442 \u043F\u0438\u043B\u043E\
\u0442\u0438\u0440\u043E\u0432\u0430\u0442\u044C \u043F\u043E\u043B\u043D\u043E\
\u0440\u0430\u0437\u043C\u0435\u0440\u043D\u044B\u0435 \u043C\u0435\u0445\u0438\
."
type: Tweak
- message: "\u0424\u0435\u043B\u0438\u043D\u0438\u0434\u044B \u0442\u0435\u043F\u0435\
\u0440\u044C \u043C\u043E\u0433\u0443\u0442 \u043F\u0438\u043B\u043E\u0442\u0438\
\u0440\u043E\u0432\u0430\u0442\u044C \u0412\u0418\u041C \u0438 \u0425\u0410\u041C\
\u042F\u041A."
type: Tweak
id: 826
time: '2025-02-09T21:39:40.572406+00:00'
46 changes: 46 additions & 0 deletions Resources/Prototypes/Entities/Objects/Specific/Mech/mechs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -208,6 +208,9 @@
pilotWhitelist:
components:
- HumanoidAppearance
pilotBlacklist:
species:
- Felinid
- type: MeleeWeapon
hidden: true
attackRate: 1
Expand Down Expand Up @@ -273,6 +276,9 @@
pilotWhitelist:
components:
- HumanoidAppearance
pilotBlacklist:
species:
- Felinid
- type: MeleeWeapon
hidden: true
attackRate: 1
Expand Down Expand Up @@ -340,6 +346,9 @@
pilotWhitelist:
components:
- HumanoidAppearance
pilotBlacklist:
species:
- Felinid
- type: MeleeWeapon
hidden: true
attackRate: 1
Expand Down Expand Up @@ -415,6 +424,9 @@
pilotWhitelist:
components:
- HumanoidAppearance
pilotBlacklist:
species:
- Felinid
equipmentWhitelist:
tags:
- IndustrialMech
Expand Down Expand Up @@ -506,6 +518,9 @@
pilotWhitelist:
components:
- HumanoidAppearance
pilotBlacklist:
species:
- Felinid
- type: Reflect
reflectProb: 0.15
spread: 180
Expand Down Expand Up @@ -569,6 +584,8 @@
pilotWhitelist:
tags:
- Hamster
species:
- Felinid
- type: MeleeWeapon
hidden: true
attackRate: 0.8
Expand Down Expand Up @@ -646,6 +663,8 @@
pilotWhitelist:
tags:
- VimPilot
species:
- Felinid
- type: MeleeWeapon
hidden: true
attackRate: 0.8
Expand Down Expand Up @@ -714,6 +733,9 @@
pilotWhitelist:
components:
- HumanoidAppearance
pilotBlacklist:
species:
- Felinid
- type: MeleeWeapon
hidden: true
attackRate: 1
Expand Down Expand Up @@ -780,6 +802,9 @@
pilotWhitelist:
components:
- HumanoidAppearance
pilotBlacklist:
species:
- Felinid
- type: MeleeWeapon
hidden: true
attackRate: 1
Expand Down Expand Up @@ -852,6 +877,9 @@
pilotWhitelist:
components:
- HumanoidAppearance
pilotBlacklist:
species:
- Felinid
- type: MeleeWeapon
hidden: true
attackRate: 1
Expand Down Expand Up @@ -922,6 +950,9 @@
pilotWhitelist:
components:
- HumanoidAppearance
pilotBlacklist:
species:
- Felinid
- type: MeleeWeapon
hidden: true
attackRate: 1
Expand Down Expand Up @@ -1007,6 +1038,9 @@
pilotWhitelist:
components:
- HumanoidAppearance
pilotBlacklist:
species:
- Felinid
- type: MeleeWeapon
hidden: true
attackRate: 1
Expand Down Expand Up @@ -1087,6 +1121,9 @@
pilotWhitelist:
components:
- HumanoidAppearance
pilotBlacklist:
species:
- Felinid
- type: MeleeWeapon
hidden: true
attackRate: 1
Expand Down Expand Up @@ -1170,6 +1207,9 @@
pilotWhitelist:
components:
- HumanoidAppearance
pilotBlacklist:
species:
- Felinid
- type: MeleeWeapon
hidden: true
attackRate: 1
Expand Down Expand Up @@ -1252,6 +1292,9 @@
pilotWhitelist:
components:
- HumanoidAppearance
pilotBlacklist:
species:
- Felinid
- type: MeleeWeapon
hidden: true
attackRate: 1
Expand Down Expand Up @@ -1329,6 +1372,9 @@
pilotWhitelist:
components:
- HumanoidAppearance
pilotBlacklist:
species:
- Felinid
- type: MeleeWeapon
hidden: true
attackRate: 1
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -157,6 +157,9 @@
pilotWhitelist:
components:
- HumanoidAppearance
pilotBlacklist:
species:
- Felinid
equipmentWhitelist:
tags:
- CombatMech
Expand Down

0 comments on commit 1e617b9

Please sign in to comment.