Public repository for MUR pre alpha
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

73 lines
1.3 KiB

  1. extends Spatial
  2. class_name BaseInventory
  3. var road_straights = [
  4. roads_factory.BUMP,
  5. roads_factory.BUMP_SMALL,
  6. roads_factory.STRAIGHT,
  7. roads_factory.STRAIGHT_SMALL,
  8. ]
  9. var roads_right = [
  10. roads_factory.CURVE_RIGHT,
  11. roads_factory.CURVE_LARGE_RIGHT,
  12. roads_factory.CURVE_SMALL_RIGHT,
  13. roads_factory.SKEW_RIGHT,
  14. roads_factory.CURVED_RIGHT,
  15. ]
  16. var roads_left = [
  17. roads_factory.CURVE_LEFT,
  18. roads_factory.CURVE_LARGE_LEFT,
  19. roads_factory.CURVE_SMALL_LEFT,
  20. roads_factory.SKEW_LEFT,
  21. roads_factory.CURVED_LEFT,
  22. ]
  23. var roads_up = [
  24. roads_factory.RAMP_UP,
  25. roads_factory.RAMP_CURVED_UP,
  26. roads_factory.RAMP_SMALL_UP,
  27. ]
  28. var roads_down = [
  29. roads_factory.RAMP_DOWN,
  30. roads_factory.RAMP_CURVED_DOWN,
  31. roads_factory.RAMP_SMALL_DOWN,
  32. ]
  33. var roads_special = [
  34. roads_factory.LOOP,
  35. ]
  36. var roads = [ road_straights, roads_right, roads_left, roads_up, roads_down, roads_special ]
  37. var player:Player
  38. var route:Route
  39. var item:Road
  40. var type:int = 0
  41. var index:int = 0
  42. signal item_changed(index, player)
  43. func _ready():
  44. route = gamestate.game.route
  45. func set_player(new_player:Player):
  46. player = new_player
  47. func set_item():
  48. if is_network_master():
  49. if item:
  50. item.free()
  51. item = roads_factory.get_road_instance(roads[type][index])
  52. if player != null:
  53. item.set_color(player.get_player_color())
  54. item.rotate_y(PI/2)
  55. emit_signal("item_changed", roads[type][index], player)