-
Notifications
You must be signed in to change notification settings - Fork 55
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
modern emotePanel removed, "type: UserInterface" fixes bullets, ads, eva and synd .rsi fixes TODO: RANDOM BOOKS TODO: ChangelingRule other ЛУЧШАЯ РАБОТА В МИРЕ
- Loading branch information
Showing
77 changed files
with
2,014 additions
and
2,003 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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; } | ||
// } |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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); | ||
// } | ||
// } | ||
// } | ||
// } | ||
// } |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.