This repository has been archived on 2023-12-19. You can view files and clone it, but cannot push or open issues or pull requests.
MUR/scripts/player/bot_inventory.gd

22 lines
649 B
GDScript

extends BaseInventory
var rand:RandomNumberGenerator = RandomNumberGenerator.new()
func _ready():
rand.randomize()
func _on_raceCar_road_entered(road):
if is_network_master():
if player != null:
if player.is_in_group("first"):
if route.get_last_road().get_index() <= (road.get_index() +2):
type = rand.randi_range(0,roads.size() -2) # TODO: remove special, loop need fixes!
index = rand.randi_range(0, roads[type].size() -1)
route.rpc("add_road", roads[type][index], player.get_index())
func set_player(new_player:Player):
player = new_player
player.race_car.connect("road_entered",self,"_on_raceCar_road_entered")