The International Simutrans Forum

 

Author Topic: command_x(tool_remover) does not clean the tile  (Read 848 times)

0 Members and 1 Guest are viewing this topic.

Offline Yona-TYT

  • Devotee
  • *
  • Posts: 1845
    • Simutrans-BLOG
  • Languages: ES
command_x(tool_remover) does not clean the tile
« on: October 25, 2020, 01:41:37 PM »
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

Offline Andarix

  • *
  • Posts: 370
  • Languages: de
Re: command_x(tool_remover) does not clean the tile
« Reply #1 on: October 25, 2020, 03:10:29 PM »
command_x(tool_remover) remove one object from tile

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

Code: [Select]
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.

Code: [Select]
local build_tile = square_x(tiles.x, tiles.y).get_ground_tile()

Example

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

Offline Yona-TYT

  • Devotee
  • *
  • Posts: 1845
    • Simutrans-BLOG
  • Languages: ES
Re: command_x(tool_remover) does not clean the tile
« Reply #2 on: October 25, 2020, 03:44:50 PM »
command_x(tool_remover) remove one object from tile You have to call the tool in a loop until the tile is empty.
Code: [Select]
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.
Code: [Select]
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).

Offline prissi

  • Developer
  • Administrator
  • *
  • Posts: 11097
  • Languages: De,EN,JP
Re: command_x(tool_remover) does not clean the tile
« Reply #3 on: October 25, 2020, 11:44:03 PM »
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.

Offline Yona-TYT

  • Devotee
  • *
  • Posts: 1845
    • Simutrans-BLOG
  • Languages: ES
Re: command_x(tool_remover) does not clean the tile
« Reply #4 on: October 25, 2020, 11:55:02 PM »
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.
I understand your point, but shouldn't it allow a new building to be built on that slope. ?  ???
« Last Edit: October 26, 2020, 12:05:12 AM by Yona-TYT »

Offline prissi

  • Developer
  • Administrator
  • *
  • Posts: 11097
  • Languages: De,EN,JP
Re: command_x(tool_remover) does not clean the tile
« Reply #5 on: October 26, 2020, 01:58:08 AM »
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.

Offline Yona-TYT

  • Devotee
  • *
  • Posts: 1845
    • Simutrans-BLOG
  • Languages: ES
Re: command_x(tool_remover) does not clean the tile
« Reply #6 on: October 26, 2020, 02:28:58 AM »

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.
Understood, I am going to modify the terrain, thank you !.  :P