Skip to main content

No project description provided

Project description

rwmapeditor-exgcdwu

一个铁锈战争 (Rusted Warfare) 地图编辑 python 库

released version

目标

python实现铁锈地图文件地块编辑和宾语编辑。

暂时不打算接触地块集。

重点减轻城市争夺地图的宾语编辑工作量

基本框架已完成。

地块组框架已完成。

安装

pip install rwmapeditor-exgcdwu

使用之前

1.使用地图编辑器(Tiled,notTiled)创建新地图

地图格式:zlib、gzip

渲染顺序:右下(right-down)

方向:orthogonal

2.手动载入地块集

3.手动创建所需的地块层和宾语层

4.即可使用python库改变地块和宾语

简易使用例子

# coding: utf-8
import rwmap as rw

map_dir = 'D:/Game/steam/steamapps/common/Rusted Warfare/mods/maps/'#此为地图所在文件夹
map_name = '[p2]example_skirmish_(2p).tmx'#输入地图
map_name_out = '[p2]example_skirmish_(2p)(1).tmx'#输出地图

mygraph:rw.RWmap = rw.RWmap.init_mapfile(map_dir + map_name)#地图载入
print(mygraph)#地图输出【部分】

mygraph.addObject(#添加宾语:第一项图层名称(Triggers),第二项默认属性,第三项可选属性
    "Triggers", 
    {"id": "100", "name": "刷兵实验", "type": "unitAdd", "x": "1500", "y":"1000", "width": "20", "height": "20"}, 
    {"resetActivationAfter":"5s", "spawnUnits": "heavyTank*10", "team" :"0", "warmup":"5s"})

mygraph.addTile("Ground", rw.Coordinate(1, 0), "Long Grass", rw.Coordinate(0, 0))
mygraph.addTile("Ground", rw.Coordinate(2, 0), "Long Grass", rw.Coordinate(1, 2))
mygraph.addTile("Ground", rw.Coordinate(0, 1), "Long Grass", rw.Coordinate(0, 0))
#改变地块类型:第一项地块层名称,第二项地块层改变位置,第三项地块集名称(全名),第四项所用地块位置(在地块集中)

mygraph.addTile_square("Ground", rw.Rectangle(rw.Coordinate(5, 5), rw.Coordinate(10, 10)), "Deep Water", rw.Coordinate(0, 0))
mygraph.addTile_square("Ground", rw.Rectangle(rw.Coordinate(20, 5), rw.Coordinate(30, 10)), "Long Grass", rw.Coordinate(2, 1))
#改变地块类型(矩形):第一项地块层名称,第二项地块层改变位置(前者为起始位置,后者为增量),第三项地块集名称(全名),第四项所用地块位置(在地块集中)

mygraph.addTile_group(rw.Coordinate(5, 20), rw.data.tile_group_grid.fill_tile_group_one_ground_water_28_24)
#改变地块类型(地块组):第一项位置,第二项地块组(使用默认)

tilegroup_matrix = rw.tile.TileGroup_Matrix([['a'] * 6  if i % 2 == 0 else ['b'] * 6 for i in range(10)])
#创建匿名地块组
tilegroup_addlayer = rw.tile.TileGroup_AddLayer.init_tilegroup_matrix("Ground", tilegroup_matrix)
#匿名地块组确定地块层
tile_dict = {
    "a": rw.TagCoordinate("Long Grass", rw.Coordinate(0, 0)), 
    "b": rw.TagCoordinate("Dirt", rw.Coordinate(0, 0))
}
tilegroup_one = rw.tile.TileGroup_One.init_tilegroup_addlayer(
    tile_dict, tilegroup_addlayer)
#匿名地块组确定地块类型

mygraph.addTile_group(rw.Coordinate(20, 20), tilegroup_one)
#添加地块组

mygraph.write_file(map_dir + map_name_out)
#输出到新地图文件

Project details


Release history Release notifications | RSS feed

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

rwmapeditor_exgcdwu-1.2.5.tar.gz (1.2 MB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

rwmapeditor_exgcdwu-1.2.5-py3-none-any.whl (1.3 MB view details)

Uploaded Python 3

File details

Details for the file rwmapeditor_exgcdwu-1.2.5.tar.gz.

File metadata

  • Download URL: rwmapeditor_exgcdwu-1.2.5.tar.gz
  • Upload date:
  • Size: 1.2 MB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/5.0.0 CPython/3.9.19

File hashes

Hashes for rwmapeditor_exgcdwu-1.2.5.tar.gz
Algorithm Hash digest
SHA256 b8ccf290416bd2f3ab5a672d62b553a1fde9ea6a5d54f0140e97084221d5cb83
MD5 1eb45e591f110087fd3a6c89c43d8a53
BLAKE2b-256 ad4bc5ade0b306f34158d368e356da04beb8581296694f29678a2adbc685853b

See more details on using hashes here.

File details

Details for the file rwmapeditor_exgcdwu-1.2.5-py3-none-any.whl.

File metadata

File hashes

Hashes for rwmapeditor_exgcdwu-1.2.5-py3-none-any.whl
Algorithm Hash digest
SHA256 3fc47cf15957934d10fadf1d4ab212286b929a9fce4d97c8a314aa512c3f425b
MD5 68aaf919834a97224748e6ae8fe39711
BLAKE2b-256 e31d268f90a4424406d6b30214185d5ebde836c9b901fb1e477900d63b9210bf

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page