From 5d9f410fbb399b1f5b9f1e29595bf65d37602341 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E7=BE=BD=20=E5=AD=A6?= <1242509682@qq.com> Date: Sat, 13 Jul 2024 04:19:48 +0800 Subject: [PATCH] =?UTF-8?q?=E6=9B=B4=E6=96=B0=EF=BC=9A=E7=94=9F=E6=88=90?= =?UTF-8?q?=E5=9F=BA=E7=A1=80=E5=BB=BA=E8=AE=BE=20v1.4.0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- SpawnInfra/Configuration.cs | 29 ++++--- SpawnInfra/Plugin.cs | 154 +++++++++++++++++++++++------------- SpawnInfra/README.md | 35 +++++--- 3 files changed, 139 insertions(+), 79 deletions(-) diff --git a/SpawnInfra/Configuration.cs b/SpawnInfra/Configuration.cs index bcc06a20..26e42dc6 100644 --- a/SpawnInfra/Configuration.cs +++ b/SpawnInfra/Configuration.cs @@ -6,9 +6,9 @@ namespace SpawnInfra internal class Configuration { [JsonProperty("使用说明", Order = -15)] - public string Text { get; set; } = "[左海平台]没适配好不推荐用,[刷怪场缩放值]不建议乱动(影响站立位/箱子位/计时位/岩浆区)"; + public string Text { get; set; } = "[微光直通车]的高度是从[世界平台]到湖中心"; [JsonProperty("使用说明2", Order = -14)] - public string Text2 { get; set; } = "出生点过低会引起[世界平台]贯穿海洋或地图太小容易上太空,建议自己根据情况调整,[微光直通车]的高度是从[世界平台]到湖中心"; + public string Text2 { get; set; } = "[世界平台]与[左海…]判断高度为太空层往下的距离,[刷怪场比例缩放]为倍数放大,建议不要调太高"; [JsonProperty("使用说明3", Order = -13)] public string Text3 { get; set; } = "改[箱子数量]要同时改[出生点偏移X],改[箱子层数]要同时改[出生点偏移Y],[层数间隔]和[箱子宽度]不建议动"; [JsonProperty("使用说明4", Order = -12)] @@ -147,18 +147,20 @@ public class ItemData2 public bool Enabled { get; set; } = true; [JsonProperty("是否建世界轨道", Order = -7)] public bool Enabled2 { get; set; } = true; - [JsonProperty("是否建左海平台", Order = -7)] - public bool Enabled3 { get; set; } = false; + [JsonProperty("是否建左海平台", Order = -6)] + public bool Enabled3 { get; set; } = true; [JsonProperty("世界平台图格", Order = 2)] public int ID { get; set; } [JsonProperty("世界平台样式", Order = 3)] public int Style { get; set; } [JsonProperty("世界平台高度", Order = 5)] - public int SpawnTileY { get; set; } + public int SkyY { get; set; } [JsonProperty("平台清理高度", Order = 6)] public int Height { get; set; } + [JsonProperty("世界平台禁入左海距离", Order = 7)] + public int Limit { get; set; } [JsonProperty("左海平台长度", Order = 8)] public int Wide { get; set; } [JsonProperty("左海平台高度", Order = 9)] @@ -166,12 +168,13 @@ public class ItemData2 [JsonProperty("左海平台间隔", Order = 10)] public int Interval { get; set; } - public ItemData2(int id, int style,int tileY, int height, int wide,int height2,int interval ) + public ItemData2(int id, int style,int tileY, int height,int limit, int wide,int height2,int interval ) { ID = id; Style = style; - SpawnTileY = tileY; + SkyY = tileY; Height = height; + Limit = limit; Wide = wide; Height2 = height2; Interval = interval; @@ -192,8 +195,10 @@ public class ItemData3 public bool Enabled4 { get; set; } = true; [JsonProperty("是否建刷怪场", Order = -2)] public bool Enabled5 { get; set; } = true; - [JsonProperty("刷怪场只清不建", Order = -1)] + [JsonProperty("只清刷怪区域", Order = -1)] public bool Enabled6 { get; set; } = false; + [JsonProperty("直通车贯穿刷怪场", Order = 0)] + public bool Enabled7 { get; set; } = true; [JsonProperty("方块图格", Order = 1)] public ushort ID { get; set; } @@ -218,9 +223,9 @@ public class ItemData3 [JsonProperty("刷怪场清理深度", Order = 10)] public int Height { get; set; } - [JsonProperty("刷怪场清理宽度", Order = 10)] + [JsonProperty("刷怪场清理宽度", Order = 11)] public int Width3 { get; set; } - [JsonProperty("刷怪中心偏移", Order = 10)] + [JsonProperty("刷怪场比例缩放", Order = 12)] public int Center { get; set; } @@ -257,12 +262,12 @@ public void Ints() WorldPlatform = new List { - new ItemData2(19, 43, -150,35,270,218,30), + new ItemData2(19, 43, -150,35,200,270,200,30), }; HellTunnel = new List { - new ItemData3(38, 214, 19, 43, 0, 0,5,40,2,150,150,0), + new ItemData3(38, 214, 19, 43, 0, 0,5,40,2,200,200,2), }; } #endregion diff --git a/SpawnInfra/Plugin.cs b/SpawnInfra/Plugin.cs index f6ba649e..14252be6 100644 --- a/SpawnInfra/Plugin.cs +++ b/SpawnInfra/Plugin.cs @@ -12,7 +12,7 @@ public class Plugin : TerrariaPlugin #region 插件信息 public override string Name => "生成基础建设"; public override string Author => "羽学"; - public override Version Version => new Version(1, 3, 0); + public override Version Version => new Version(1, 4, 0); public override string Description => "给新世界创建NPC住房、仓库、洞穴刷怪场、地狱/微光直通车、地表和地狱世界级平台(轨道)"; #endregion @@ -25,7 +25,7 @@ public override void Initialize() ServerApi.Hooks.GamePostInitialize.Register(this, OnGamePostInitialize); Commands.ChatCommands.Add(new Command("room.use", Comds.Comd, "rm", "基建") { - HelpText = "自动建监狱" + HelpText = "生成基础建设" }); } protected override void Dispose(bool disposing) @@ -64,16 +64,28 @@ private static void OnGamePostInitialize(EventArgs args) foreach (var item in Config.HellTunnel) { - RockTrialField(Main.rockLayer, item.Height, item.Width3); + if (Config.HellTunnel[0].Enabled7) + { + RockTrialField(Main.rockLayer, item.Height, item.Width3, item.Center); + HellTunnel(Main.spawnTileX + item.SpawnTileX, Main.spawnTileY + item.SpawnTileY, item.Width); + } + else + { + HellTunnel(Main.spawnTileX + item.SpawnTileX, Main.spawnTileY + item.SpawnTileY, item.Width); + + RockTrialField(Main.rockLayer, item.Height, item.Width3, item.Center); + } + ShimmerBiome(item.Width2); - HellTunnel(Main.spawnTileX + item.SpawnTileX, Main.spawnTileY + item.SpawnTileY, item.Width); UnderworldPlatform(Main.UnderworldLayer + item.PlatformY, item.PlatformY); } + //太空层 + var sky = Main.worldSurface * 0.3499999940395355; foreach (var item in Config.WorldPlatform) { - WorldPlatform(Main.spawnTileY + item.SpawnTileY, item.Height); - BuildOceanPlatforms(item.Wide, item.Height2, item.Interval); + WorldPlatform((int)sky - item.SkyY, item.Height); + BuildOceanPlatforms(item.Wide, item.Height2, item.Interval, item.Interval - 1); } foreach (var item in Config.Chests) @@ -95,19 +107,19 @@ private static void OnGamePostInitialize(EventArgs args) #endregion #region 刷怪场 - private static void RockTrialField(double posY, int Height, int Width) + private static void RockTrialField(double posY, int Height, int Width, int CenterVal) { int clear = (int)posY - Height; // 计算顶部、底部和中间位置 int top = clear + Height * 2; int bottom = (int)posY + Height * 2; - int middle = (top + bottom) / 2; + int middle = (top + bottom) / 2 + CenterVal; - int left = Math.Max(Main.maxTilesX / 2 - Width, 0); - int right = Math.Min(Main.maxTilesX / 2 + Width, Main.maxTilesX); + int left = Math.Max(Main.spawnTileX - Width, 0); + int right = Math.Min(Main.spawnTileX + Width, Main.maxTilesX); - int CenterLeft = Main.maxTilesX / 2 - 15 - Config.HellTunnel[0].Center; - int CenterRight = Main.maxTilesX / 2 + 15 + Config.HellTunnel[0].Center; + int CenterLeft = Main.spawnTileX - 8 - CenterVal; + int CenterRight = Main.spawnTileX + 8 + CenterVal; if (Config.HellTunnel[0].Enabled5) { @@ -116,18 +128,23 @@ private static void RockTrialField(double posY, int Height, int Width) for (int x = left; x < right; x++) { Main.tile[x, y + Height * 2].ClearEverything(); // 清除方块 + WorldGen.PlaceTile(x, top, Config.HellTunnel[0].ID, false, true, -1, 0); // 在清理顶部放1层(防液体流进刷怪场) + WorldGen.PlaceTile(x, bottom, Config.HellTunnel[0].ID, false, true, -1, 0); //刷怪场底部放1层 WorldGen.PlaceTile(x, middle, Config.HellTunnel[0].ID, false, true, -1, 0); //刷怪场中间放1层(刷怪用) - WorldGen.PlaceTile(x, middle + 8 + Config.HellTunnel[0].Center, Config.HellTunnel[0].PlatformID, false, true, -1, Config.HellTunnel[0].PlatformStyle);//中间下8格放一层方便站人 - for (int wallY = middle + 1 + Config.HellTunnel[0].Center; wallY <= middle + 7 + Config.HellTunnel[0].Center; wallY++) + WorldGen.PlaceTile(x, middle + 8 + CenterVal, Config.HellTunnel[0].PlatformID, false, true, -1, Config.HellTunnel[0].PlatformStyle);//中间下8格放一层方便站人 + + + for (int wallY = middle + 1; wallY <= middle + 7 + CenterVal; wallY++) { Main.tile[x, wallY].wall = 155; // 放置墙壁 } - WorldGen.PlaceTile(x, middle + 11 + Config.HellTunnel[0].Center, Config.HellTunnel[0].ID, false, true, -1, 0); //中间下11格放箱子的实体块 - WorldGen.PlaceTile(x, middle + 10 + Config.HellTunnel[0].Center, Config.Chests[0].ChestID, false, true, -1, Config.Chests[0].ChestStyle); //中间下10格放箱子 + + WorldGen.PlaceTile(x, middle + 11 + CenterVal, Config.HellTunnel[0].ID, false, true, -1, 0); //中间下11格放箱子的实体块 + WorldGen.PlaceTile(x, middle + 10 + CenterVal, Config.Chests[0].ChestID, false, true, -1, Config.Chests[0].ChestStyle); //中间下10格放箱子 WorldGen.PlaceTile(x, middle + 2, Config.HellTunnel[0].ID, false, true, -1, 0); //放计时器的平台 @@ -140,33 +157,51 @@ private static void RockTrialField(double posY, int Height, int Width) // 如果x值在中心范围内,放置10格高的方块 if (x >= CenterLeft && x <= CenterRight) { - //定刷怪区 - for (int i = 0; i <= 3; i++) - { - WorldGen.PlaceTile(CenterLeft - 61, middle + i, Config.HellTunnel[0].ID, false, true, -1, 0); - WorldGen.PlaceTile(CenterRight + 61, middle + i, Config.HellTunnel[0].ID, false, true, -1, 0); - WorldGen.PlaceTile(CenterLeft - 85, middle + i, Config.HellTunnel[0].ID, false, true, -1, 0); - WorldGen.PlaceTile(CenterRight + 85, middle + i, Config.HellTunnel[0].ID, false, true, -1, 0); - } - - for (int wallY = middle - 21 - Config.HellTunnel[0].Center; wallY <= middle - 1; wallY++) + for (int wallY = middle - 10 - CenterVal; wallY <= middle - 1; wallY++) { // 创建矩形判断 - if (wallY >= middle - 21 - Config.HellTunnel[0].Center && wallY <= middle - 1 && x >= CenterLeft + 1 && x <= CenterRight - 1) + if (wallY >= middle - 10 - CenterVal && wallY <= middle - 1 && x >= CenterLeft + 1 && x <= CenterRight - 1) // 挖空方块 Main.tile[x, wallY].ClearEverything(); else + { // 在矩形范围外放置方块 - WorldGen.PlaceTile(x, wallY + 1, Config.HellTunnel[0].ID, false, true, -1, 0); + WorldGen.PlaceTile(x, wallY, Config.HellTunnel[0].ID, false, true, -1, 0); + } // 检查是否在中间位置,如果是则放置岩浆 - if (wallY == middle - 21 - Config.HellTunnel[0].Center) + if (wallY == middle - 10 - CenterVal) { - Main.tile[x, wallY].liquid = 60; //设置1格液体 - Main.tile[x, wallY].liquidType(1); // 设置为岩浆 - WorldGen.SquareTileFrame(x, wallY, false); + Main.tile[x - 1, wallY + 2].liquid = 60; //设置1格液体 + Main.tile[x - 1, wallY + 2].liquidType(1); // 设置为岩浆 + WorldGen.SquareTileFrame(x, wallY + 2, false); + //加一排尖球 + for (int j = 1; j <= 5 + CenterVal; j++) + { + WorldGen.PlaceWire(x - j, wallY - j); + WorldGen.PlaceWire(x + j, wallY - j); + WorldGen.PlaceTile(x - j, wallY - j, 137, true, false, -1, 3); + WorldGen.PlaceTile(x + j, wallY - j, 137, true, false, -1, 3); + WorldGen.PlaceActuator(x - j, wallY - j); + WorldGen.PlaceActuator(x + j, wallY - j); + } + //给尖球加电线 + for (int j = 2; j <= 10 + CenterVal; j++) + { + WorldGen.PlaceWire(CenterLeft - 1, middle - j); + WorldGen.PlaceWire(CenterRight + 1, middle - j); + } } } + + //定刷怪区 + for (int i = 0; i <= 3; i++) + { + WorldGen.PlaceTile(CenterLeft - 61, middle + i, Config.HellTunnel[0].ID, false, true, -1, 0); + WorldGen.PlaceTile(CenterRight + 61, middle + i, Config.HellTunnel[0].ID, false, true, -1, 0); + WorldGen.PlaceTile(CenterLeft - 85, middle + i, Config.HellTunnel[0].ID, false, true, -1, 0); + WorldGen.PlaceTile(CenterRight + 85, middle + i, Config.HellTunnel[0].ID, false, true, -1, 0); + } } else //不在中心 左右生成半砖推怪平台 { @@ -175,7 +210,7 @@ private static void RockTrialField(double posY, int Height, int Width) Main.tile[x, middle - 1].halfBrick(false); // 根据x值确定斜坡方向 - if (x < Main.maxTilesX / 2) + if (x < Main.spawnTileX) { Main.tile[x, middle - 1].slope(3); // 设置为右斜坡 } @@ -206,15 +241,8 @@ private static void RockTrialField(double posY, int Height, int Width) WorldGen.PlaceTile(CenterRight + 1, middle + 5, 136, false, true, -1, 0); } - //计时器上面加1个尖球机关 - for (int j = 2; j <= 20 + Config.HellTunnel[0].Center; j++) - { - WorldGen.PlaceWire(CenterLeft - 1, middle - j); - WorldGen.PlaceWire(CenterRight + 1, middle - j); - WorldGen.PlaceTile(CenterLeft - 1, middle - 20 - Config.HellTunnel[0].Center, 137, true, false, -1, 3); - WorldGen.PlaceTile(CenterRight + 1, middle - 20 - Config.HellTunnel[0].Center, 137, true, false, -1, 3); - } - + //放个花园侏儒 + WorldGen.PlaceGnome(CenterLeft - 5, middle + 7, 0); } } } @@ -222,7 +250,6 @@ private static void RockTrialField(double posY, int Height, int Width) //只清不建 else if (Config.HellTunnel[0].Enabled6) { - for (int y = (int)posY; y > clear; y--) { for (int x = left; x < right; x++) @@ -371,21 +398,31 @@ private static void SpawnChest(int posX, int posY, int hight, int width, int cou #endregion #region 左海平台 - private static void BuildOceanPlatforms(int wide, int hight, int interval) + private static void BuildOceanPlatforms(int wide, int hight, int interval, int IntlClear) { if (!Config.WorldPlatform[0].Enabled3) return; - //第一层比间隔层高10格 - int y = Main.oceanBG + interval - 10; + var sky = Main.worldSurface * 0.3499999940395355; + int clear = Math.Max(3, hight); - while (y < Main.worldSurface - hight) + for (int y = Main.oceanBG + interval; y < sky + clear; y += interval) { + // 清理平台下方的方块 + for (int yBelow = y - IntlClear; yBelow < y; yBelow++) + { + for (int x = 0; x < wide; x++) + { + Main.tile[x, yBelow].ClearEverything(); + } + } + + // 放置平台 for (int x = 0; x < wide; x++) { + Main.tile[x, y].ClearEverything(); if (x >= Main.maxTilesX || x < 0) continue; WorldGen.PlaceTile(x, y, Config.WorldPlatform[0].ID, false, true, -1, Config.WorldPlatform[0].Style); } - y += interval; } } #endregion @@ -395,12 +432,11 @@ private static void WorldPlatform(int posY, int hight) { int clear = Math.Max(3, hight); - for (int x = 0; x < Main.maxTilesX; x++) { if (Config.WorldPlatform[0].Enabled3) { - if (x - clear <= Main.oceanBG + 200) continue; + if (x - clear <= Main.oceanBG + Config.WorldPlatform[0].Limit) continue; } for (int y = posY - clear; y <= posY; y++) @@ -408,7 +444,6 @@ private static void WorldPlatform(int posY, int hight) Main.tile[x, y].ClearEverything(); } - if (Config.WorldPlatform[0].Enabled) WorldGen.PlaceTile(x, posY, Config.WorldPlatform[0].ID, false, true, -1, Config.WorldPlatform[0].Style); if (Config.WorldPlatform[0].Enabled2) @@ -452,14 +487,14 @@ private static int HellTunnel(int posX, int posY, int Width) val.ClearEverything(); if (cx == Xstart + Width / 2) { - val.type = Config.HellTunnel[0].ID2; + val.type = Config.HellTunnel[0].ID2; //绳子 val.active(true); val.slope(0); val.halfBrick(false); } else if (cx == Xstart || cx == Xstart + Width - 1) { - val.type = Config.HellTunnel[0].ID; + val.type = Config.HellTunnel[0].ID; //边界方块 val.active(true); val.slope(0); val.halfBrick(false); @@ -467,12 +502,16 @@ private static int HellTunnel(int posX, int posY, int Width) }); }); - //确保平台与直通车等宽 int platformStart = Xstart + 1; int platformEnd = Xstart + Width - 2; + //确保平台与直通车等宽 for (int px = platformStart; px <= platformEnd; px++) { WorldGen.PlaceTile(px, posY, Config.HellTunnel[0].PlatformID, false, true, -1, Config.HellTunnel[0].PlatformStyle); + for (int cy = posY + 1; cy <= hell; cy++) + { + Main.tile[px, cy].wall = 155; // 放置墙壁 + } } } return hell; @@ -497,7 +536,7 @@ private static void UnderworldPlatform(int posY, int hight) } #endregion - #region 微光湖 + #region 微光湖直通车 private static void ShimmerBiome(int Width) { if (!Config.HellTunnel[0].Enabled4) return; @@ -550,8 +589,9 @@ private static void ShimmerBiome(int Width) int CenterX = (x + Right) / 2; //深度到为中心湖面 int CenterY = (y + Bottom) / 2 - 8; - //中止条件为出生点到世界轨道的距离 - int Height = Main.spawnTileY + Config.WorldPlatform[0].SpawnTileY; + //中止条件为世界轨道的距离 + var sky = Main.worldSurface * 0.3499999940395355; + int Height = (int)sky - Config.WorldPlatform[0].SkyY; // 从微光湖中心点向上挖通道直至地表 for (int TunnelY = CenterY; TunnelY >= Height; TunnelY--) diff --git a/SpawnInfra/README.md b/SpawnInfra/README.md index 87ef7c5b..2fefe4f8 100644 --- a/SpawnInfra/README.md +++ b/SpawnInfra/README.md @@ -3,9 +3,9 @@ - 作者: 羽学 - 出处: [TShockWorldModify](https://github.com/hufang360/TShockWorldModify) - 在新世界出生点右侧脚下建一个监狱集群 -- 出生点上方150格生成世界平台与世界轨道 +- 出生点上方生成世界平台与世界轨道 - 出生点脚下生成地狱直通车, -- 直通车洞穴层下方生成简易刷怪场(150 * 150 *2) +- 直通车洞穴层下方生成简易刷怪场(200 * 200) * 2边 - 在世界轨道能找到微光湖直通车(底下放了雨云块防摔) - 在出生点左下角生成8*14个箱子 - 从地狱层往下深40格生成地狱平台与轨道 @@ -13,6 +13,19 @@ ## 更新日志 ``` +v1.4.0 +修复了左海平台离地太近导致穿插沙滩的问题 +世界平台与左海平台不再以出生点为起点定高度 +改为从太空层往下数,主要适配小世界 +左海平台默认会清理每层间隔内的所有方块 +加入了世界平台禁入左海的配置项 +加入了直通车贯穿刷怪场的开关 +给地狱直通车通道加了发光墙 +修正了刷怪场中心点为出生点X轴 +修正了刷怪场比例缩放 +给刷怪场放个花园侏儒 + + v1.3.0 加入了微光湖直通车 地狱直通车洞穴层下方加入了刷怪场(无特殊环境,简易电路) @@ -46,8 +59,8 @@ v1.0.0 ```json { - "使用说明": "[左海平台]没适配好不推荐用,[刷怪场缩放值]不建议乱动(影响站立位/箱子位/计时位/岩浆区)", - "使用说明2": "出生点过低会引起[世界平台]贯穿海洋或地图太小容易上太空,建议自己根据情况调整,[微光直通车]的高度是从[世界平台]到湖中心", + "使用说明": "[微光直通车]的高度是从[世界平台]到湖中心", + "使用说明2": "[世界平台]与[左海…]判断高度为太空层往下的距离,[刷怪场比例缩放]为倍数放大,建议不要调太高", "使用说明3": "改[箱子数量]要同时改[出生点偏移X],改[箱子层数]要同时改[出生点偏移Y],[层数间隔]和[箱子宽度]不建议动", "使用说明4": "给玩家用的建晶塔房指令:/rm 数量 权限名:room.use (千万别在出生点用,有炸图风险)", "使用说明5": "每次重置服务器前使用一遍:/rm 重置,或者直接把这个指令写进重置插件里", @@ -87,13 +100,14 @@ v1.0.0 { "是否建世界平台": true, "是否建世界轨道": true, - "是否建左海平台": false, + "是否建左海平台": true, "世界平台图格": 19, "世界平台样式": 43, "世界平台高度": -150, "平台清理高度": 35, + "世界平台禁入左海距离": 200, "左海平台长度": 270, - "左海平台高度": 218, + "左海平台高度": 200, "左海平台间隔": 30 } ], @@ -104,7 +118,8 @@ v1.0.0 "是否建地狱轨道": true, "是否建微光直通车": true, "是否建刷怪场": true, - "刷怪场只清不建": false, + "只清刷怪区域": false, + "直通车贯穿刷怪场": true, "方块图格": 38, "绳子图格": 214, "平台图格": 19, @@ -114,9 +129,9 @@ v1.0.0 "地狱直通车宽度": 5, "地狱平台深度": 40, "微光直通车宽度": 2, - "刷怪场清理深度": 150, - "刷怪场清理宽度": 150, - "刷怪中心偏移": 0 + "刷怪场清理深度": 200, + "刷怪场清理宽度": 200, + "刷怪场比例缩放": 2 } ] }