* delete round seed

* delete worldEdge locale

* Update CP14BiomeSpawnerSystem.cs

* nails to 50 max stack

* wood planks stack increase

* flora material stack edit

* Update EntityTest.cs

* Update EntityTest.cs
This commit is contained in:
Ed
2025-01-31 18:24:54 +03:00
committed by GitHub
parent b3eed32588
commit 3f70d8600c
14 changed files with 71 additions and 124 deletions

View File

@@ -39,6 +39,7 @@ namespace Content.IntegrationTests.Tests
.Where(p => !p.Abstract)
.Where(p => !pair.IsTestPrototype(p))
.Where(p => !p.Components.ContainsKey("MapGrid")) // This will smash stuff otherwise.
.Where(p => !p.Components.ContainsKey("RoomFill")) // CP14 Boilerplate - TODO: Remove it after wizden fix
.Select(p => p.ID)
.ToList();
@@ -101,6 +102,7 @@ namespace Content.IntegrationTests.Tests
.Where(p => !p.Abstract)
.Where(p => !pair.IsTestPrototype(p))
.Where(p => !p.Components.ContainsKey("MapGrid")) // This will smash stuff otherwise.
.Where(p => !p.Components.ContainsKey("RoomFill")) // CP14 Boilerplate - TODO: Remove it after wizden fix
.Select(p => p.ID)
.ToList();
foreach (var protoId in protoIds)
@@ -161,6 +163,7 @@ namespace Content.IntegrationTests.Tests
.Where(p => !p.Abstract)
.Where(p => !pair.IsTestPrototype(p))
.Where(p => !p.Components.ContainsKey("MapGrid")) // This will smash stuff otherwise.
.Where(p => !p.Components.ContainsKey("RoomFill")) // CP14 Boilerplate - TODO: Remove it after wizden fix
.Select(p => p.ID)
.ToList();
@@ -235,6 +238,7 @@ namespace Content.IntegrationTests.Tests
var excluded = new[]
{
"MapGrid",
"RoomFill", // CP14 Boilerplate - TODO: Remove it after wizden fix
"StationEvent",
"TimedDespawn",
@@ -341,6 +345,7 @@ namespace Content.IntegrationTests.Tests
"DebugExceptionInitialize",
"DebugExceptionStartup",
"GridFill",
"RoomFill", // CP14 Boilerplate - TODO: Remove it after wizden fix
"Map", // We aren't testing a map entity in this test
"MapGrid",
"Broadphase",

View File

@@ -5,7 +5,6 @@
using System.Linq;
using Content.Server._CP14.BiomeSpawner.Components;
using Content.Server._CP14.RoundSeed;
using Content.Server.Decals;
using Content.Server.Parallax;
using Content.Shared.Whitelist;
@@ -13,6 +12,7 @@ using Robust.Server.GameObjects;
using Robust.Shared.Map;
using Robust.Shared.Map.Components;
using Robust.Shared.Prototypes;
using Robust.Shared.Random;
namespace Content.Server._CP14.BiomeSpawner.EntitySystems;
@@ -24,12 +24,21 @@ public sealed class CP14BiomeSpawnerSystem : EntitySystem
[Dependency] private readonly SharedMapSystem _maps = default!;
[Dependency] private readonly DecalSystem _decals = default!;
[Dependency] private readonly EntityLookupSystem _lookup = default!;
[Dependency] private readonly CP14RoundSeedSystem _roundSeed = default!;
[Dependency] private readonly EntityWhitelistSystem _whitelist = default!;
[Dependency] private readonly IRobustRandom _random = default!;
private int _globalSeed = 0;
public override void Initialize()
{
SubscribeLocalEvent<CP14BiomeSpawnerComponent, MapInitEvent>(OnMapInit);
SubscribeLocalEvent<Shared.GameTicking.RoundEndMessageEvent>(OnRoundEnd);
UpdateSeed();
}
private void OnRoundEnd(Shared.GameTicking.RoundEndMessageEvent ev)
{
UpdateSeed();
}
private void OnMapInit(Entity<CP14BiomeSpawnerComponent> ent, ref MapInitEvent args)
@@ -38,6 +47,11 @@ public sealed class CP14BiomeSpawnerSystem : EntitySystem
QueueDel(ent);
}
private void UpdateSeed()
{
_globalSeed = _random.Next(int.MinValue, int.MaxValue);
}
private void SpawnBiome(Entity<CP14BiomeSpawnerComponent> ent)
{
var biome = _proto.Index(ent.Comp.Biome);
@@ -50,11 +64,9 @@ public sealed class CP14BiomeSpawnerSystem : EntitySystem
if (!TryComp<MapGridComponent>(gridUid, out var map))
return;
var seed = _roundSeed.GetSeed();
var vec = _transform.GetGridOrMapTilePosition(ent);
if (!_biome.TryGetTile(vec, biome.Layers, seed, map, out var tile))
if (!_biome.TryGetTile(vec, biome.Layers, _globalSeed, map, out var tile))
return;
// Set new tile
@@ -70,7 +82,7 @@ public sealed class CP14BiomeSpawnerSystem : EntitySystem
}
//Add decals
if (_biome.TryGetDecals(vec, biome.Layers, seed, map, out var decals))
if (_biome.TryGetDecals(vec, biome.Layers, _globalSeed, map, out var decals))
{
foreach (var decal in decals)
{
@@ -87,7 +99,7 @@ public sealed class CP14BiomeSpawnerSystem : EntitySystem
QueueDel(entToRemove);
}
if (_biome.TryGetEntity(vec, biome.Layers, tile.Value, seed, map, out var entityProto))
if (_biome.TryGetEntity(vec, biome.Layers, tile.Value, _globalSeed, map, out var entityProto))
Spawn(entityProto, new EntityCoordinates(gridUid, tileCenterVec));
}
}

View File

@@ -1,21 +0,0 @@
/*
* All right reserved to CrystallEdge.
*
* BUT this file is sublicensed under MIT License
*
*/
namespace Content.Server._CP14.RoundSeed;
/// <summary>
/// This is used for round seed
/// </summary>
[RegisterComponent, Access(typeof(CP14RoundSeedSystem))]
public sealed partial class CP14RoundSeedComponent : Component
{
[ViewVariables]
public static int MaxValue = 10000;
[ViewVariables]
public int Seed;
}

View File

@@ -1,53 +0,0 @@
/*
* All right reserved to CrystallEdge.
*
* BUT this file is sublicensed under MIT License
*
*/
using System.Diagnostics.CodeAnalysis;
using JetBrains.Annotations;
using Robust.Shared.Map;
using Robust.Shared.Random;
namespace Content.Server._CP14.RoundSeed;
/// <summary>
/// Provides a round seed for another systems
/// </summary>
public sealed class CP14RoundSeedSystem : EntitySystem
{
[Dependency] private readonly IRobustRandom _random = default!;
public override void Initialize()
{
SubscribeLocalEvent<CP14RoundSeedComponent, ComponentStartup>(OnComponentStartup);
}
private void OnComponentStartup(Entity<CP14RoundSeedComponent> ent, ref ComponentStartup args)
{
ent.Comp.Seed = _random.Next(CP14RoundSeedComponent.MaxValue);
}
private int SetupSeed()
{
return AddComp<CP14RoundSeedComponent>(Spawn(null, MapCoordinates.Nullspace)).Seed;
}
/// <summary>
/// Returns the round seed if assigned, otherwise assigns the round seed itself.
/// </summary>
/// <returns>seed of the round</returns>
public int GetSeed()
{
var query = EntityQuery<CP14RoundSeedComponent>();
foreach (var comp in query)
{
return comp.Seed;
}
var seed = SetupSeed();
Log.Warning($"Missing RoundSeed. Seed set to {seed}");
return seed;
}
}

View File

@@ -1,2 +0,0 @@
cp14-world-edge-pre-remove-message = [color=red]CAUTION![/color] You are leaving the game zone! If you do not return within [color=red]{$second}[/color] seconds, you will be permanently removed from the round!
cp14-world-edge-cancel-removing-message = The exit round has been canceled.

View File

@@ -1,2 +0,0 @@
cp14-world-edge-pre-remove-message = [color=red]ВНИМАНИЕ![/color] Вы покидаете игровую зону! Если вы не вернетесь назад в течении [color=red]{$second}[/color] секунд, вы будете окончательно удалены из раунда!
cp14-world-edge-cancel-removing-message = Выход из раунда отменен.

View File

@@ -75,7 +75,7 @@
- id: CP14CrystalLampBlueEmpty
- id: CP14CrystalLampOrangeEmpty
- id: CP14Rope
- id: CP14Nail10
- id: CP14Nail20
- id: CP14EnergyCrystalSmall
- id: CP14CopperCoin5
weight: 0.5

View File

@@ -214,6 +214,14 @@
- type: Stack
count: 10
- type: entity
id: CP14WoodenPlanks20
parent: CP14WoodenPlanks1
suffix: 20
components:
- type: Stack
count: 20
- type: entity
id: CP14LucensWoodLog
parent: CP14WoodLog
@@ -270,6 +278,14 @@
- type: Stack
count: 10
- type: entity
id: CP14LucensWoodenPlanks20
parent: CP14LucensWoodenPlanks1
suffix: 20
components:
- type: Stack
count: 20
- type: entity
id: CP14Nail1
parent: BaseItem
@@ -331,12 +347,20 @@
launchForwardsMultiplier: 0
- type: entity
id: CP14Nail10
id: CP14Nail20
parent: CP14Nail1
suffix: 10
suffix: 20
components:
- type: Stack
count: 10
count: 20
- type: entity
id: CP14Nail50
parent: CP14Nail1
suffix: 50
components:
- type: Stack
count: 50
- type: entity
id: CP14FloraMaterial1
@@ -347,45 +371,29 @@
categories: [ ForkFiltered ]
components:
- type: Item
size: Tiny
size: Normal
- type: Stack
stackType: CP14FloraMaterial
count: 1
baseLayer: base
layerStates:
- grass_material1
- grass_material2
- grass_material3
- type: Sprite
sprite: _CP14/Objects/Materials/flora.rsi
layers:
- state: grass_material1
map: ["random"]
- type: RandomSprite
available:
- random:
grass_material1: ""
grass_material2: ""
grass_material3: ""
- type: Tag
tags:
- CP14FireplaceFuel
- type: Flammable
fireSpread: false
canResistFire: false
alwaysCombustible: true
canExtinguish: true
cP14FireplaceFuel: 5
damage:
types:
Heat: 1
map: ["base"]
- type: Material
- type: PhysicalComposition # точно ли это нужно?
materialComposition:
CP14FloraMaterial: 100
- type: entity
id: CP14FloraMaterial2
id: CP14FloraMaterial10
parent: CP14FloraMaterial1
suffix: 2
suffix: 10
components:
- type: Stack
count: 2
count: 10
- type: entity
id: CP14String

View File

@@ -5,7 +5,6 @@
components:
- type: GameRule
cP14Allowed: true
- type: CP14RoundSeed
- type: entity
id: CP14RoundObjectivesRule

View File

@@ -98,7 +98,7 @@
result: CP14ClothingOuterClothingCuirassLeg
- type: CP14Recipe
id: CP14Nail10
id: CP14Nail20
tag: CP14RecipeAnvil
craftTime: 4
requirements:
@@ -107,7 +107,7 @@
count: 2
- !type:KnowledgeRequired
knowledge: MetallForging
result: CP14Nail10
result: CP14Nail20
- type: CP14Recipe
id: CP14CrystalLampBlueEmpty

View File

@@ -17,14 +17,14 @@
name: cp14-stack-wood-planks
spawn: CP14WoodenPlanks1
icon: { sprite: _CP14/Objects/Materials/wood.rsi, state: planks_2 }
maxCount: 10
maxCount: 20
- type: stack
id: CP14Nail
name: cp14-stack-nails
spawn: CP14Nail1
icon: { sprite: _CP14/Objects/Materials/nails.rsi, state: nail_2 }
maxCount: 10
maxCount: 50
- type: stack
id: CP14Cloth
@@ -66,7 +66,7 @@
name: cp14-material-lucens-planks
spawn: CP14LucensWoodenPlanks1
icon: { sprite: _CP14/Objects/Materials/lucens_wood.rsi, state: planks_2 }
maxCount: 10
maxCount: 20
- type: stack
id: CP14GlassSheet
@@ -80,11 +80,11 @@
name: cp14-stack-flora
icon: { sprite: "_CP14/Objects/Materials/flora.rsi", state: grass_material1 }
spawn: CP14FloraMaterial1
maxCount: 2
maxCount: 10
- type: stack
id: CP14Ash
name: cp14-stack-ash-pile
icon: { sprite: "_CP14/Objects/Materials/ash.rsi", state: ash_1 }
spawn: CP14Ash1
maxCount: 3
maxCount: 10

Binary file not shown.

Before

Width:  |  Height:  |  Size: 672 B

After

Width:  |  Height:  |  Size: 1.0 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 610 B

After

Width:  |  Height:  |  Size: 1.3 KiB

View File

@@ -3,7 +3,7 @@
# 2024-08-24
CP14DungeonEntrance: CP14LaddersDownStoneAutoLink
CP14DungeonExit: CP14LaddersUpStoneAutoLink
CP14Nail110: CP14Nail10
CP14Nail110: CP14Nail20
# 2024-09-09
CP14AlchemyFurnaceDebug: CP14AlchemyFurnace
@@ -239,6 +239,7 @@ CP14OreCopper: CP14OreCopper1
CP14OreIron: CP14OreIron1
CP14OreGold: CP14OreGold1
CP14OreMithril: CP14OreMithril1
CP14Nail10: CP14Nail20
# <---> CrystallEdge migration zone end