Fix item shapes: mod sprites need an opaque pixel at the centre of every cell
The game decides which cells an item occupies by the alpha of one pixel at the centre of each 16x16 cell. The rig's rack bays left gaps exactly on the centre rows, so 8 of 9 cells counted as empty and other items were placed underneath it; the terminal's stand did the same. The rig gets a solid back plate, the terminal's stand is widened, and art/sprites.py now checks every cell the way the game does and refuses to write a sprite with a hole. Verified in game: new rigs are 3x3 solid, new terminals 2x2 solid. Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
This commit is contained in:
1 parent
1841338fbb
commit
a2a4d12ad3
6 files changed
+19
-4
No files matched your search
@@ -10,3 +10,5 @@
|
||||
- 杰克逊博士上货(游戏给 mod 的进货钩子,夜间去他店里或他每周来本店摆摊时):没有矿架时必有一个,有了之后 30% 再上;基础显卡每次两张;进阶显卡第 10 天起 60%(再 30% 多一张);旗舰第 30 天起 25%,特供货事件时第 20 天起必有。全新真货,价格为物品价值加他的加价。加入 Web3 治理社区后才上货。开发者模式 F9 有测试入口。
|
||||
- 命名:币为 PSC,合规交易所为 Poinbase,入口人脉升级为 Web3 治理社区。
|
||||
- 入口升级归入游戏原有的"服务"栏(和 Probably Automated 一样),图标用交易终端。
|
||||
- 修复矿架、交易终端与别的物品重叠:游戏按 mod 物品图每格中心的一个像素判断这一格算不算占用,矿架的卡位之间有缝,缝正好落在中心行上,8 格被当成空格。矿架加了实心背板、终端支架拉通;art/sprites.py 生成时按游戏的方式检查每格中心,有透明格就报错。
|
||||
|
||||
Binary file not shown.
+16
-4
@@ -110,7 +110,7 @@ def gpu(accent, accent_dark, burnt=False):
|
||||
def rig():
|
||||
"""矿架(48×48,3×3 格):开放式机架,四层显卡位,左下电源。"""
|
||||
c = Canvas(48, 48)
|
||||
c.box(2, 3, 45, 44, None)
|
||||
c.box(2, 3, 45, 44, 'd') # 外框 + 背板:内部不透明,否则游戏按格子中心像素判断占格会把空隙当成空格
|
||||
for y in range(4, 44):
|
||||
c.put(3, y, 'b'); c.put(44, y, 'd')
|
||||
for x in range(3, 45):
|
||||
@@ -139,7 +139,7 @@ def terminal():
|
||||
for x, top, bot in candles:
|
||||
c.rect(x, top, x, bot, 'S')
|
||||
c.put(x, top - 1, 'T')
|
||||
c.rect(13, 22, 18, 23, 'd') # 支架
|
||||
c.rect(3, 22, 28, 23, 'd') # 支架(拉通,保证每格中心点不透明)
|
||||
c.box(2, 24, 29, 30, 'b') # 键盘
|
||||
for y in (26, 28):
|
||||
for x in range(4, 28, 2):
|
||||
@@ -155,14 +155,26 @@ SPRITES = {
|
||||
'terminal': terminal,
|
||||
}
|
||||
|
||||
def check_cells(canvas, name):
|
||||
"""游戏按 mod 物品图每格的中心像素是否不透明来判断占格(行从图的下沿往上数)。有空格就报错。"""
|
||||
cols, rows = canvas.w // 16, canvas.h // 16
|
||||
bad = [(q, r) for r in range(rows) for q in range(cols) if canvas.px[canvas.h - 1 - (r * 16 + 8)][q * 16 + 8] is None]
|
||||
if bad:
|
||||
raise SystemExit(f"{name}: 这些格子中心像素透明(游戏会当成空格,别的物品会叠上来):{bad}")
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
||||
here = os.path.dirname(os.path.abspath(__file__))
|
||||
if len(sys.argv) == 3 and sys.argv[1] == '--preview':
|
||||
for name, make in SPRITES.items():
|
||||
make().png(os.path.join(sys.argv[2], name + '.png'), scale=6, bg=(0xA0, 0xA8, 0x9C))
|
||||
canvas = make()
|
||||
check_cells(canvas, name)
|
||||
canvas.png(os.path.join(sys.argv[2], name + '.png'), scale=6, bg=(0xA0, 0xA8, 0x9C))
|
||||
print(sys.argv[2])
|
||||
else:
|
||||
out = os.path.normpath(os.path.join(here, '..', 'src', 'Decentralized', 'ModFiles', 'Textures', 'Items'))
|
||||
for name, make in SPRITES.items():
|
||||
make().png(os.path.join(out, name + '.png'))
|
||||
canvas = make()
|
||||
check_cells(canvas, name)
|
||||
canvas.png(os.path.join(out, name + '.png'))
|
||||
print(out)
|
||||
@@ -14,6 +14,7 @@ namespace Decentralized
|
||||
{
|
||||
ModHook.OnPlaceInventorInventoryItemLate += OnPlace;
|
||||
// 开发者模式(F9)里的测试入口:像到了杰克逊店里一样,清空并扩大柜台后上货
|
||||
ModHelper.AddDebugFunction(ModInfo.Id, ModInfo.Name, "Give rig x3 (test)", () => { for (int i = 0; i < 3; i++) Items.Give(ModHelper.SpawnItem(Items.Rig)); });
|
||||
ModHelper.AddDebugFunction(ModInfo.Id, ModInfo.Name, "Dr. Jackson stock (test)", () =>
|
||||
{
|
||||
EmporiumEntry.Instance.ClearFrontInv();
|
||||
|
||||
Binary file not shown.
|
Before Width: | Height: | Size: 255 B After Width: | Height: | Size: 246 B |
Binary file not shown.
|
Before Width: | Height: | Size: 234 B After Width: | Height: | Size: 229 B |
Reference in new issue
Block a user