Skip to content

Commit

Permalink
corvax loadout removed,
Browse files Browse the repository at this point in the history
modern emotePanel removed,
"type: UserInterface" fixes
bullets, ads,
eva and synd .rsi fixes
TODO: RANDOM BOOKS
TODO: ChangelingRule
other
ЛУЧШАЯ РАБОТА В МИРЕ
  • Loading branch information
modern-nm committed May 23, 2024
1 parent 71e8aad commit 3749f2e
Show file tree
Hide file tree
Showing 77 changed files with 2,014 additions and 2,003 deletions.
44 changes: 22 additions & 22 deletions Content.Server/Corvax/Loadout/LoadoutPrototype.cs
Original file line number Diff line number Diff line change
@@ -1,29 +1,29 @@
using Content.Shared.Roles;
using Robust.Shared.Prototypes;
using Robust.Shared.Serialization.TypeSerializers.Implementations.Custom.Prototype;
using Robust.Shared.Serialization.TypeSerializers.Implementations.Custom.Prototype.List;
// using Content.Shared.Roles;
// using Robust.Shared.Prototypes;
// using Robust.Shared.Serialization.TypeSerializers.Implementations.Custom.Prototype;
// using Robust.Shared.Serialization.TypeSerializers.Implementations.Custom.Prototype.List;

namespace Content.Server.Corvax.Loadout;
// namespace Content.Server.Corvax.Loadout;

[Prototype("loadout")]
public sealed class LoadoutItemPrototype : IPrototype
{
[IdDataFieldAttribute] public string ID { get; } = default!;
// [Prototype("loadout")]
// public sealed class LoadoutItemPrototype : IPrototype
// {
// [IdDataFieldAttribute] public string ID { get; } = default!;

[DataField("entity", required: true, customTypeSerializer: typeof(PrototypeIdSerializer<EntityPrototype>))]
public string EntityId { get; } = default!;
// [DataField("entity", required: true, customTypeSerializer: typeof(PrototypeIdSerializer<EntityPrototype>))]
// public string EntityId { get; } = default!;

// Corvax-Sponsors-Start
[DataField("sponsorOnly")]
public bool SponsorOnly = false;
// Corvax-Sponsors-End
// // Corvax-Sponsors-Start
// [DataField("sponsorOnly")]
// public bool SponsorOnly = false;
// // Corvax-Sponsors-End

[DataField("whitelistJobs", customTypeSerializer: typeof(PrototypeIdListSerializer<JobPrototype>))]
public List<string>? WhitelistJobs { get; }
// [DataField("whitelistJobs", customTypeSerializer: typeof(PrototypeIdListSerializer<JobPrototype>))]
// public List<string>? WhitelistJobs { get; }

[DataField("blacklistJobs", customTypeSerializer: typeof(PrototypeIdListSerializer<JobPrototype>))]
public List<string>? BlacklistJobs { get; }
// [DataField("blacklistJobs", customTypeSerializer: typeof(PrototypeIdListSerializer<JobPrototype>))]
// public List<string>? BlacklistJobs { get; }

[DataField("speciesRestriction")]
public List<string>? SpeciesRestrictions { get; }
}
// [DataField("speciesRestriction")]
// public List<string>? SpeciesRestrictions { get; }
// }
188 changes: 94 additions & 94 deletions Content.Server/Corvax/Loadout/LoadoutSystem.cs
Original file line number Diff line number Diff line change
@@ -1,109 +1,109 @@
using System.Linq;
using Content.Server.Corvax.OwOAction;
using Content.Server.Corvax.Sponsors;
using Content.Server.GameTicking;
using Content.Server.Hands.Systems;
using Content.Server.Storage.EntitySystems;
using Content.Shared.Clothing.Components;
using Content.Shared.Inventory;
using Robust.Shared.Prototypes;
// using System.Linq;
// using Content.Server.Corvax.OwOAction;
// using Content.Server.Corvax.Sponsors;
// using Content.Server.GameTicking;
// using Content.Server.Hands.Systems;
// using Content.Server.Storage.EntitySystems;
// using Content.Shared.Clothing.Components;
// using Content.Shared.Inventory;
// using Robust.Shared.Prototypes;

namespace Content.Server.Corvax.Loadout;
// namespace Content.Server.Corvax.Loadout;

// NOTE: Full implementation will be in future, now just sponsor items
public sealed class LoadoutSystem : EntitySystem
{
private const string BackpackSlotId = "back";
// // NOTE: Full implementation will be in future, now just sponsor items
// public sealed class LoadoutSystem : EntitySystem
// {
// private const string BackpackSlotId = "back";

[Dependency] private readonly IPrototypeManager _prototypeManager = default!;
[Dependency] private readonly InventorySystem _inventorySystem = default!;
[Dependency] private readonly HandsSystem _handsSystem = default!;
[Dependency] private readonly StorageSystem _storageSystem = default!;
[Dependency] private readonly SponsorsManager _sponsorsManager = default!;
[Dependency] private readonly EntityManager _entityManager = default!;
// [Dependency] private readonly IPrototypeManager _prototypeManager = default!;
// [Dependency] private readonly InventorySystem _inventorySystem = default!;
// [Dependency] private readonly HandsSystem _handsSystem = default!;
// [Dependency] private readonly StorageSystem _storageSystem = default!;
// [Dependency] private readonly SponsorsManager _sponsorsManager = default!;
// [Dependency] private readonly EntityManager _entityManager = default!;

public override void Initialize()
{
SubscribeLocalEvent<PlayerSpawnCompleteEvent>(OnPlayerSpawned);
}
// public override void Initialize()
// {
// SubscribeLocalEvent<PlayerSpawnCompleteEvent>(OnPlayerSpawned);
// }

private void OnPlayerSpawned(PlayerSpawnCompleteEvent ev)
{
if (_sponsorsManager.TryGetInfo(ev.Player.UserId, out var sponsor))
{
// Тут можно снабжать компонентами спонсоров
if (sponsor.Tier >= 3)
{
_entityManager.AddComponent<OwOActionComponent>(ev.Mob);
}
// private void OnPlayerSpawned(PlayerSpawnCompleteEvent ev)
// {
// if (_sponsorsManager.TryGetInfo(ev.Player.UserId, out var sponsor))
// {
// // Тут можно снабжать компонентами спонсоров
// if (sponsor.Tier >= 3)
// {
// _entityManager.AddComponent<OwOActionComponent>(ev.Mob);
// }

foreach (var loadoutId in sponsor.AllowedMarkings)
{
// NOTE: Now is easy to not extract method because event give all info we need
if (_prototypeManager.TryIndex<LoadoutItemPrototype>(loadoutId, out var loadout))
{
var isSponsorOnly = loadout.SponsorOnly &&
!sponsor.AllowedMarkings.Contains(loadoutId);
var isWhitelisted = ev.JobId != null &&
loadout.WhitelistJobs != null &&
!loadout.WhitelistJobs.Contains(ev.JobId);
var isBlacklisted = ev.JobId != null &&
loadout.BlacklistJobs != null &&
loadout.BlacklistJobs.Contains(ev.JobId);
var isSpeciesRestricted = loadout.SpeciesRestrictions != null &&
loadout.SpeciesRestrictions.Contains(ev.Profile.Species);
// foreach (var loadoutId in sponsor.AllowedMarkings)
// {
// // NOTE: Now is easy to not extract method because event give all info we need
// if (_prototypeManager.TryIndex<LoadoutItemPrototype>(loadoutId, out var loadout))
// {
// var isSponsorOnly = loadout.SponsorOnly &&
// !sponsor.AllowedMarkings.Contains(loadoutId);
// var isWhitelisted = ev.JobId != null &&
// loadout.WhitelistJobs != null &&
// !loadout.WhitelistJobs.Contains(ev.JobId);
// var isBlacklisted = ev.JobId != null &&
// loadout.BlacklistJobs != null &&
// loadout.BlacklistJobs.Contains(ev.JobId);
// var isSpeciesRestricted = loadout.SpeciesRestrictions != null &&
// loadout.SpeciesRestrictions.Contains(ev.Profile.Species);

if (isSponsorOnly || isWhitelisted || isBlacklisted || isSpeciesRestricted)
continue;
// if (isSponsorOnly || isWhitelisted || isBlacklisted || isSpeciesRestricted)
// continue;

var entity = Spawn(loadout.EntityId, Transform(ev.Mob).Coordinates);
// var entity = Spawn(loadout.EntityId, Transform(ev.Mob).Coordinates);

// Take in hand if not clothes
if (!TryComp<ClothingComponent>(entity, out var clothing))
{
_handsSystem.TryPickup(ev.Mob, entity);
continue;
}
// // Take in hand if not clothes
// if (!TryComp<ClothingComponent>(entity, out var clothing))
// {
// _handsSystem.TryPickup(ev.Mob, entity);
// continue;
// }

// Automatically search empty slot for clothes to equip
string? firstSlotName = null;
bool isEquiped = false;
SlotDefinition[]? slots;
if (_inventorySystem.TryGetSlots(ev.Mob, out slots))
{
foreach (var slot in slots)
{
if (!clothing.Slots.HasFlag(slot.SlotFlags))
continue;
// // Automatically search empty slot for clothes to equip
// string? firstSlotName = null;
// bool isEquiped = false;
// SlotDefinition[]? slots;
// if (_inventorySystem.TryGetSlots(ev.Mob, out slots))
// {
// foreach (var slot in slots)
// {
// if (!clothing.Slots.HasFlag(slot.SlotFlags))
// continue;

if (firstSlotName == null)
firstSlotName = slot.Name;
// if (firstSlotName == null)
// firstSlotName = slot.Name;

if (_inventorySystem.TryGetSlotEntity(ev.Mob, slot.Name, out var _))
continue;
// if (_inventorySystem.TryGetSlotEntity(ev.Mob, slot.Name, out var _))
// continue;

if (_inventorySystem.TryEquip(ev.Mob, entity, slot.Name, true))
{
isEquiped = true;
break;
}
}
}
// if (_inventorySystem.TryEquip(ev.Mob, entity, slot.Name, true))
// {
// isEquiped = true;
// break;
// }
// }
// }

if (isEquiped || firstSlotName == null)
continue;
// if (isEquiped || firstSlotName == null)
// continue;

// Force equip to first valid clothes slot
// Get occupied entity -> Insert to backpack -> Equip loadout entity
if (_inventorySystem.TryGetSlotEntity(ev.Mob, firstSlotName, out var slotEntity) &&
_inventorySystem.TryGetSlotEntity(ev.Mob, BackpackSlotId, out var backEntity) &&
_storageSystem.CanInsert(backEntity.Value, slotEntity.Value, out _))
{
_storageSystem.Insert(backEntity.Value, slotEntity.Value, out _, playSound: false);
}
_inventorySystem.TryEquip(ev.Mob, entity, firstSlotName, true);
}
}
}
}
}
// // Force equip to first valid clothes slot
// // Get occupied entity -> Insert to backpack -> Equip loadout entity
// if (_inventorySystem.TryGetSlotEntity(ev.Mob, firstSlotName, out var slotEntity) &&
// _inventorySystem.TryGetSlotEntity(ev.Mob, BackpackSlotId, out var backEntity) &&
// _storageSystem.CanInsert(backEntity.Value, slotEntity.Value, out _))
// {
// _storageSystem.Insert(backEntity.Value, slotEntity.Value, out _, playSound: false);
// }
// _inventorySystem.TryEquip(ev.Mob, entity, firstSlotName, true);
// }
// }
// }
// }
// }
2 changes: 1 addition & 1 deletion Content.Server/GameTicking/Rules/ChangelingRuleSystem.cs
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ public override void Initialize()
{
base.Initialize();

SubscribeLocalEvent<RoundStartAttemptEvent>(OnStartAttempt);
//SubscribeLocalEvent<RoundStartAttemptEvent>(OnStartAttempt); // TODO-MODERN: Переписать RuleSystem
//SubscribeLocalEvent<RulePlayerJobsAssignedEvent>(OnPlayersSpawned); // TODO-MODERN: Переписать RuleSystem
SubscribeLocalEvent<PlayerSpawnCompleteEvent>(HandleLatejoin);

Expand Down
10 changes: 10 additions & 0 deletions Content.Shared/Humanoid/NamingSystem.cs
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,16 @@ public string GetName(string species, Gender? gender = null)
case SpeciesNaming.FirstDashFirst:
return Loc.GetString("namepreset-firstdashfirst",
("first1", GetFirstName(speciesProto, gender)), ("first2", GetFirstName(speciesProto, gender)));
// ADT-Drasks-START
case SpeciesNaming.FirstDashFirstDashFirst:
return Loc.GetString("namepreset-firstdashfirstdashfirst",
("first1", GetFirstName(speciesProto, gender)), ("first2", GetFirstName(speciesProto, gender)), ("first3", GetFirstName(speciesProto, gender)));
// ADT-Drasks-END
// Parkstation-Ipc-Start
case SpeciesNaming.FirstDashLast:
return Loc.GetString("namepreset-firstdashlast",
("first", GetFirstName(speciesProto, gender)), ("last", GetLastName(speciesProto)));
// Parkstation-Ipc-End
case SpeciesNaming.FirstLast:
default:
return Loc.GetString("namepreset-firstlast",
Expand Down
2 changes: 2 additions & 0 deletions Content.Shared/Humanoid/Prototypes/SpeciesPrototype.cs
Original file line number Diff line number Diff line change
Expand Up @@ -140,5 +140,7 @@ public enum SpeciesNaming : byte
First,
FirstLast,
FirstDashFirst,
FirstDashFirstDashFirst, // ADT-Drasks
TheFirstofLast,
FirstDashLast, // Parkstation-IPC
}
Loading

0 comments on commit 3749f2e

Please sign in to comment.