The International Simutrans Forum

Development => Scripting Scenarios and AI => Topic started by: Yona-TYT on February 04, 2018, 03:32:52 PM

Title: [Road sign] Player is authorized?
Post by: Yona-TYT on February 04, 2018, 03:32:52 PM



is it possible to know if the player is authorized to use the toll?


(http://files.simutrans.com/index.php/apps/files_sharing/ajax/publicpreview.php?x=1440&y=372&a=true&file=signial_regions.png&t=zE1veHjbOVaHwlP&scalingup=0)



Title: Re: [Road sign] Player is authorized?
Post by: Dwachs on February 04, 2018, 05:10:44 PM
I added one such function in r8378

http://dwachs.github.io/simutrans-sqapi-doc/classsign__x.html#a453ed0f181798fbd366efacb0f55ddad
Title: Re: [Road sign] Player is authorized?
Post by: Yona-TYT on February 06, 2018, 04:00:01 PM
Thanks !!, I will work with this soon ;)... I hope it works in multiplayer mode  ;D .
Title: Re: [Road sign] Player is authorized?
Post by: Yona-TYT on February 16, 2018, 10:39:53 PM
Here is a script that allows you to share the regions with several players using the toll signs.

script -> region-lite-v2.0.zip (http://files.simutrans.com/index.php/s/FHbi92UXIuww23y)

savegame -> http://files.simutrans.com/index.php/s/qBIJrhPsoVzkjpg

function region_shared(pl, tool_id, pos, result)
{
  for (j=0;j<12;j++) {
    if (j == (pl-2))
      continue
    local tile = square_x(coord_label1[j].x+1, coord_label1[j].y).get_ground_tile()
   
    local sign = tile.find_object(mo_roadsign)
    if(sign){
   
    if (sign.can_pass(player_x(pl))){
        if (pos.x+1 >= pl_reg[j].x1 && pos.x <= pl_reg[j].x2+1 && pos.y+1 >= pl_reg[j].y2 && pos.y<= pl_reg[j].y1+1 ) {
          return null
        }
    }
    }
  }
  return result
}


(http://files.simutrans.com/index.php/apps/gallery/preview/1008?width=1300&height=1300&c=615780d8413119fcd9d37d5653910a0c&requesttoken=TKlLjf08z7sgO6KfubWTHWc57MoN7d%2BJcgDCHnRPcSg%3D%3AI9syyslYqu90C5Om3fHcWlUJi5NdqZTNRWaPezg2AmQ%3D)