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)#地图载入
#第二项可以是自己的铁锈地块集默认文件夹(maps)文件夹,也可以省略
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)
#输出到新地图文件

其他

外部文件

本库使用了铁锈战争的默认地块集,存放在rwmap/other_data/maps/

第三方库依赖

numpy

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.7.tar.gz (1.6 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.7-py3-none-any.whl (1.6 MB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: rwmapeditor_exgcdwu-1.2.7.tar.gz
  • Upload date:
  • Size: 1.6 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.7.tar.gz
Algorithm Hash digest
SHA256 e3b8217fb778fe42c339da4254784bbac03d7e91d753ee5ecdc6375c955d4091
MD5 f4c77b3f99123b4d0be3cd0241105bdb
BLAKE2b-256 84479f2344c1c639cf212ec05cc2f7f41505ac1f703130739560bd6c692d270a

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for rwmapeditor_exgcdwu-1.2.7-py3-none-any.whl
Algorithm Hash digest
SHA256 d8a78a02c8a5826a7b8414a4373b87f2e20d5015a89cf7d81153c677b978015f
MD5 58eee605de95af8b1e6864cf8371a1da
BLAKE2b-256 e6ccc0234254b0e64550202a433cfe7a5d0689c9464542dea4558ec7ed7bdb9b

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