News:

Simutrans Tools
Know our tools that can help you to create add-ons, install and customize Simutrans.

command_x(tool_remover) does not clean the tile

Started by Yona-TYT, October 25, 2020, 01:41:37 PM

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

Yona-TYT

When building a mail extension building in the tutorial for pak64 I ran into this problem, it seems that cleaning urban buildings on a slope using "command (tool remover)" does not clean the tile.

You can do the tests with this minimal script attached below.
When you start the you will clear the coordinate (111,182, 2) and then try to build an extension building there.
Savegame: http://www.mediafire.com/file/w69si7uza68xi6j/tutorial_pak64-ch5-err.sve/file

Andarix

command_x(tool_remover) remove one object from tile

You have to call the tool in a loop until the tile is empty.


local tool = command_x(tool_remover)

gui.add_message_at(our_player, "remove tile " + coord3d_to_string(tiles), tiles)
while(true){
tool.work(our_player, tiles)
if (tiles.is_empty())
break
}



If there is a slope there, you must also determine the bottom of the field after the demolition.


local build_tile = square_x(tiles.x, tiles.y).get_ground_tile()


Example

remove tile 111,182, 2
build tile 111,182, 1

Yona-TYT

Quote from: Andarix on October 25, 2020, 03:10:29 PMcommand_x(tool_remover) remove one object from tile You have to call the tool in a loop until the tile is empty. local tool = command_x(tool_remover) gui.add_message_at(our_player, "remove tile " + coord3d_to_string(tiles), tiles) while(true){ tool.work(our_player, tiles) if (tiles.is_empty()) break } If there is a slope there, you must also determine the bottom of the field after the demolition. local build_tile = square_x(tiles.x, tiles.y).get_ground_tile() Example remove tile 111,182, 2 build tile 111,182, 1
Usp, I think this is a general bug, because I have the same problem even without using script.

Move this topic. (this had already happened a while ago).

prissi

This is not a bug. A building on a slope is at level, but one higher than the normal ground with a slope. Removing a building, will restore the slope. Hence the z coordinate goes one done. This is an intentional design and will stay like this to avoid ugly cities.

Yona-TYT

#4
Quote from: prissi on October 25, 2020, 11:44:03 PMThis is not a bug. A building on a slope is at level, but one higher than the normal ground with a slope. Removing a building, will restore the slope. Hence the z coordinate goes one done. This is an intentional design and will stay like this to avoid ugly cities.
I understand your point, but shouldn't it allow a new building to be built on that slope. ?  ???

prissi

That ground tile does not exist after removal, just the ground tile one down. You should be able to build on that.

There is a internal function to change the building descriptor of an existing building, but you cannot exchange a factory with normal building, attraction, nor monument this way. Also the player cannot do that, and hence this function was not exposed to API.

Yona-TYT


Quote from: prissi on October 26, 2020, 01:58:08 AMThat ground tile does not exist after removal, just the ground tile one down. You should be able to build on that. There is a internal function to change the building descriptor of an existing building, but you cannot exchange a factory with normal building, attraction, nor monument this way. Also the player cannot do that, and hence this function was not exposed to API.
Understood, I am going to modify the terrain, thank you !.  :P