Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Тюрьма #150

Merged
merged 5 commits into from
Jul 11, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
namespace Content.Server._Sunrise.SpacePrison;
[RegisterComponent]
public sealed partial class PrisonShuttleComponent : Component
{

}
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
using Content.Server.Maps;
using Content.Shared.Parallax.Biomes;
using Robust.Shared.Map;
using Robust.Shared.Prototypes;
using Robust.Shared.Serialization.TypeSerializers.Implementations.Custom.Prototype;
using Robust.Shared.Serialization.TypeSerializers.Implementations.Custom.Prototype.List;
using Robust.Shared.Serialization.TypeSerializers.Implementations.Custom.Prototype.Set;

namespace Content.Server._Sunrise.SpacePrison;
[RegisterComponent]
public sealed partial class SpacePrisonStationComponent : Component
{
[DataField("stations", customTypeSerializer: typeof(PrototypeIdHashSetSerializer<GameMapPrototype>), required: true)]
public HashSet<string> Stations = new(0);

public MapId MapId = MapId.Nullspace;

[DataField]
public EntityUid Entity = EntityUid.Invalid;

[DataField(customTypeSerializer: typeof(PrototypeIdListSerializer<BiomeTemplatePrototype>))]
public List<string> Bioms = new()
{ "Grasslands", "LowDesert", "Snow", "Asteroid", "Caves", "Shadow", "Lava", "Continental" };

}
83 changes: 83 additions & 0 deletions Content.Server/_Sunrise/SpacePrison/SpacePrisonStationSystem.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,83 @@
using Content.Server.Chat.Managers;
using Content.Server.GameTicking;
using Content.Server.Maps;
using Content.Server.Parallax;
using Content.Shared._Sunrise.SunriseCCVars;
using Content.Shared.Parallax.Biomes;
using Robust.Server.GameObjects;
using Robust.Server.Maps;
using Robust.Shared.Configuration;
using Robust.Shared.Map;
using Robust.Shared.Player;
using Robust.Shared.Prototypes;
using Robust.Shared.Random;
using Robust.Shared.Timing;

namespace Content.Server._Sunrise.SpacePrison;

public sealed class SpacePrisonStationSystem : EntitySystem
{
[Dependency] private readonly ISharedPlayerManager _player = default!;
[Dependency] private readonly IConfigurationManager _cfg = default!;
[Dependency] private readonly IChatManager _chat = default!;
[Dependency] private readonly IRobustRandom _random = default!;
[Dependency] private readonly MapSystem _map = default!;
[Dependency] private readonly MapLoaderSystem _mapLoader = default!;
[Dependency] private readonly IPrototypeManager _prototypeManager = default!;
[Dependency] private readonly GameTicker _gameTicker = default!;
[Dependency] private readonly EntityManager _entityManager = default!;
[Dependency] private readonly IMapManager _mapManager = default!;
[Dependency] private readonly SharedTransformSystem _transform = default!;
[Dependency] private readonly BiomeSystem _biomeSystem = default!;
[Dependency] private readonly IPrototypeManager _protoManager = default!;

public override void Initialize()
{
SubscribeLocalEvent<SpacePrisonStationComponent, ComponentInit>(OnSpacePrisonStationInit);
SubscribeLocalEvent<SpacePrisonStationComponent, ComponentShutdown>(OnCentcommShutdown);
}
private void OnCentcommShutdown(EntityUid uid, SpacePrisonStationComponent component, ComponentShutdown args)
{
QueueDel(component.Entity);
component.Entity = EntityUid.Invalid;

if (_mapManager.MapExists(component.MapId))
_mapManager.DeleteMap(component.MapId);

component.MapId = MapId.Nullspace;
}

private void OnSpacePrisonStationInit(EntityUid uid, SpacePrisonStationComponent component, ComponentInit args)
{
var minPlayers = _cfg.GetCVar(SunriseCCVars.MinPlayersSpacePrison);
if (_player.PlayerCount <= minPlayers)
{
_chat.DispatchServerAnnouncement($"Недостаточно игроков для Космической Тюрьмы! Необходимо минимум {minPlayers}.", Color.OrangeRed);
return;
}
AddSpacePrison(component);
}

private void AddSpacePrison(SpacePrisonStationComponent component)
{
var mapId = _mapManager.CreateMap();
_mapManager.AddUninitializedMap(mapId);
component.MapId = mapId;
var station = _random.Pick(component.Stations);

var mapOptions = new MapLoadOptions()
{
LoadMap = false
};
var biom = _random.Pick(component.Bioms);
var MapUid = _mapManager.GetMapEntityId(mapId);

// Biome
if (_prototypeManager.TryIndex<GameMapPrototype>(station, out var gameMap))
{
_gameTicker.LoadGameMap(gameMap, mapId, mapOptions);
_map.InitializeMap(mapId);
_biomeSystem.EnsurePlanet(MapUid, _protoManager.Index<BiomeTemplatePrototype>(biom));
}
}
}
7 changes: 7 additions & 0 deletions Content.Shared/_Sunrise/SunriseCCVars/SunriseCCVars.cs
Original file line number Diff line number Diff line change
Expand Up @@ -136,4 +136,11 @@ public sealed class SunriseCCVars

public static readonly CVarDef<float> LobbyOpacity =
CVarDef.Create("lobby.lobby_opacity", 0.90f, CVar.CLIENTONLY | CVar.ARCHIVE);

/*
* Space Prison
*/

public static readonly CVarDef<int> MinPlayersSpacePrison =
CVarDef.Create("space_prison.min_players", 0, CVar.SERVERONLY);
}
135,556 changes: 135,556 additions & 0 deletions Resources/Maps/_Sunrise/alteros_prison.yml

Large diffs are not rendered by default.

121,316 changes: 121,316 additions & 0 deletions Resources/Maps/_Sunrise/sunrise_planetary_prison.yml

Large diffs are not rendered by default.

98,972 changes: 98,972 additions & 0 deletions Resources/Maps/_Sunrise/sunrise_prison.yml

Large diffs are not rendered by default.

1 change: 1 addition & 0 deletions Resources/Prototypes/Entities/Stations/nanotrasen.yml
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@
# Sunrise-Start
- BaseStationTransitHub
- BaseStationDontSelling
- BaseStationPlanetPrison
- BaseStationGoal
# Sunrise-End
noSpawn: true
Expand Down
31 changes: 31 additions & 0 deletions Resources/Prototypes/_Sunrise/Catalog/Fills/lockers.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
- type: entity
id: LockerHeadOfPrisonFilled
name: шкафчик начальника тюрьмы
suffix: Filled
parent: LockerHeadOfSecurity
components:
- type: StorageFill
contents:
- id: ClothingEyesHudSecurity
- id: WeaponDisabler
- id: PrisonCommsComputerCircuitboard
- id: ClothingUniformJumpsuitHoSGrey
prob: 0.5
- id: ClothingUniformJumpsuitHoSParadeMale
prob: 0.1
- id: ClothingUniformJumpskirtHoSParadeMale
prob: 0.1
- id: DrinkVacuumFlask
prob: 0.8
- id: ClothingBeltSecurityFilled
- id: ClothingHeadsetAltSecurity
- id: ClothingEyesGlassesSecurity
- id: ClothingShoesBootsJack
- id: CigarGoldCase
prob: 0.50
- id: DoorRemoteSecurity
- id: ClothingUniformJumpskirtHosFormal
- id: ClothingUniformJumpsuitHosFormal
- id: RubberStampHos
- id: BoxEncryptionKeySecurity
- id: HoloprojectorSecurity
Original file line number Diff line number Diff line change
Expand Up @@ -41,3 +41,12 @@
components:
- type: Sprite
sprite: _Sunrise/Clothing/Back/Backpacks/blueshield.rsi

- type: entity
parent: ClothingBackpack
id: ClothingBackpackPrisonGuard
name: рюкзак сотрудника кт
description: На стиле.
components:
- type: Sprite
sprite: _Sunrise/Clothing/Back/Backpacks/guard.rsi
Original file line number Diff line number Diff line change
Expand Up @@ -28,3 +28,12 @@
components:
- type: Sprite
sprite: _Sunrise/Clothing/Back/Duffels/blueshield.rsi

- type: entity
parent: ClothingBackpackDuffel
id: ClothingBackpackDuffelPrisonGuard
name: вещмешок сотрудника кт
description: На стиле.
components:
- type: Sprite
sprite: _Sunrise/Clothing/Back/Duffels/guard.rsi
Original file line number Diff line number Diff line change
Expand Up @@ -22,9 +22,9 @@

- type: entity
parent: ClothingBackpackSatchel
id: ClothingBackpackSatchelBlueShield
name: сумка офицера «синий щит»
id: ClothingBackpackSatchelPrisonGuard
name: сумка сотрудника кт
description: На стиле.
components:
- type: Sprite
sprite: _Sunrise/Clothing/Back/Satchels/blueshield.rsi
sprite: _Sunrise/Clothing/Back/Satchels/guard.rsi
17 changes: 17 additions & 0 deletions Resources/Prototypes/_Sunrise/Entities/Clothing/Belt/belts.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,3 +8,20 @@
sprite: _Sunrise/Clothing/Belt/blueshield_webbing.rsi
- type: Clothing
sprite: _Sunrise/Clothing/Belt/blueshield_webbing.rsi

- type: entity
id: ClothingBeltPrisonGuardianFilled
parent: ClothingBeltSecurity
suffix: Filled
components:
- type: StorageFill
contents:
- id: GrenadeFlashBang
- id: TearGasGrenade
- id: Stunbaton
- id: Handcuffs
- id: Handcuffs
- type: Sprite
sprite: _Sunrise/Clothing/Belt/prison_guardian.rsi
- type: Clothing
sprite: _Sunrise/Clothing/Belt/prison_guardian.rsi
33 changes: 33 additions & 0 deletions Resources/Prototypes/_Sunrise/Entities/Clothing/Head/hats.yml
Original file line number Diff line number Diff line change
Expand Up @@ -96,3 +96,36 @@
sprite: _Sunrise/Clothing/Head/Hats/blueshield.rsi
- type: Clothing
sprite: _Sunrise/Clothing/Head/Hats/blueshield.rsi

- type: entity
parent: ClothingHeadBase
id: ClothingHeadPrisonGuard
name: головной убор охраны кт
description: Дарует полную неприкосновенность при лишении других людей ОПРС, достоинства или уважения.
components:
- type: Sprite
sprite: _Sunrise/Clothing/Head/Hats/prisonguard.rsi
- type: Clothing
sprite: _Sunrise/Clothing/Head/Hats/prisonguard.rsi

- type: entity
parent: ClothingHeadBase
id: ClothingHeadHatBeretPrisonGuard
name: берет охраны кт
description: Почему не красный?
components:
- type: Sprite
sprite: _Sunrise/Clothing/Head/Hats/prisonguard_beret.rsi
- type: Clothing
sprite: _Sunrise/Clothing/Head/Hats/prisonguard_beret.rsi

- type: entity
parent: ClothingHeadBase
id: ClothingHeadCapPrisonGuard
name: кепка охраны кт
description: Почему не красный?
components:
- type: Sprite
sprite: _Sunrise/Clothing/Head/Hats/cap.rsi
- type: Clothing
sprite: _Sunrise/Clothing/Head/Hats/cap.rsi
11 changes: 11 additions & 0 deletions Resources/Prototypes/_Sunrise/Entities/Clothing/Shoes/boots.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,3 +17,14 @@
sprite: _Sunrise/Clothing/Shoes/Boots/blueshield.rsi
- type: Clothing
sprite: _Sunrise/Clothing/Shoes/Boots/blueshield.rsi

- type: entity
parent: [ClothingShoesBase, ClothingSlotBase]
id: ClothingShoesBootsPrisonerGrey
name: ботинки заключенного
description: Почему не оранжевые?
components:
- type: Sprite
sprite: _Sunrise/Clothing/Shoes/Boots/prisoner.rsi
- type: Clothing
sprite: _Sunrise/Clothing/Shoes/Boots/prisoner.rsi
Original file line number Diff line number Diff line change
Expand Up @@ -75,3 +75,25 @@
sprite: _Sunrise/Clothing/Uniforms/Jumpskirt/blueshield.rsi
- type: Clothing
sprite: _Sunrise/Clothing/Uniforms/Jumpskirt/blueshield.rsi

- type: entity
parent: ClothingUniformBase
id: ClothingUniformJumpskirtPrisonerGrey
name: юбка-комбинезон заключенной
description: Почему она не оранжевая?
components:
- type: Sprite
sprite: _Sunrise/Clothing/Uniforms/Jumpskirt/prisoner.rsi
- type: Clothing
sprite: _Sunrise/Clothing/Uniforms/Jumpskirt/prisoner.rsi

- type: entity
parent: ClothingUniformBase
id: ClothingUniformJumpskirtGuard
name: юбка-комбинезон охраны
description: Почему она не красная?
components:
- type: Sprite
sprite: _Sunrise/Clothing/Uniforms/Jumpskirt/guard.rsi
- type: Clothing
sprite: _Sunrise/Clothing/Uniforms/Jumpskirt/guard.rsi
Original file line number Diff line number Diff line change
Expand Up @@ -63,3 +63,25 @@
sprite: _Sunrise/Clothing/Uniforms/Jumpsuit/blueshield.rsi
- type: Clothing
sprite: _Sunrise/Clothing/Uniforms/Jumpsuit/blueshield.rsi

- type: entity
parent: ClothingUniformBase
id: ClothingUniformJumpsuitPrisonerGrey
name: комбинезон заключенного
description: Почему он не оранжевый?
components:
- type: Sprite
sprite: _Sunrise/Clothing/Uniforms/Jumpsuit/prisoner.rsi
- type: Clothing
sprite: _Sunrise/Clothing/Uniforms/Jumpsuit/prisoner.rsi

- type: entity
parent: ClothingUniformBase
id: ClothingUniformJumpsuitPrisonGuard
name: комбинезон охранника
description: Почему он не красный?
components:
- type: Sprite
sprite: _Sunrise/Clothing/Uniforms/Jumpsuit/guard.rsi
- type: Clothing
sprite: _Sunrise/Clothing/Uniforms/Jumpsuit/guard.rsi
Loading
Loading