23 lines
677 B
GDScript
23 lines
677 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.set_road(roads[type][index], -1)
|
|
route.rpc("set_road", roads[type][index], -1)
|
|
|
|
|
|
func set_player(new_player:Player):
|
|
player = new_player
|
|
player.race_car.connect("road_entered",self,"_on_raceCar_road_entered") |