From 3ee8881d43da0f9334af230ea5a2e16b534dedc3 Mon Sep 17 00:00:00 2001 From: Cyberarm Date: Sun, 19 Sep 2021 08:27:58 -0500 Subject: [PATCH] Added Freight Frenzy field --- lib/pages/field_planner.rb | 4 +- lib/simulator/field.rb | 107 ++++++++++++++++++++++++++++++++++++ lib/simulator/simulation.rb | 2 +- 3 files changed, 111 insertions(+), 2 deletions(-) diff --git a/lib/pages/field_planner.rb b/lib/pages/field_planner.rb index 808b863..fb28f4e 100644 --- a/lib/pages/field_planner.rb +++ b/lib/pages/field_planner.rb @@ -56,7 +56,7 @@ module TAC end end - @field = TAC::Simulator::Field.new(container: @field_container, season: :skystone, simulation: nil) + @field = TAC::Simulator::Field.new(container: @field_container, season: :freight_frenzy, simulation: nil) @nodes = [] @unit = :inches end @@ -161,6 +161,8 @@ module TAC @points_container.clear do v1 = @nodes.first + break unless v1 + para "Vector #{inches_to_unit(v1.x).round}:#{inches_to_unit(v1.y).round} - 0 #{@unit.to_s.capitalize}" @nodes.each_with_index do |v2, i| diff --git a/lib/simulator/field.rb b/lib/simulator/field.rb index d9c0359..2a35fa0 100644 --- a/lib/simulator/field.rb +++ b/lib/simulator/field.rb @@ -159,6 +159,113 @@ module TAC end end + def draw_field_freight_frenzy + # blue ZONE + Gosu.draw_rect(24, @field_size - 24, 2, 24, @blue) + Gosu.draw_rect(24, @field_size - 24, 24, 2, @blue) + Gosu.draw_rect(48 - 2, @field_size - 24, 2, 24, @blue) + + # blue barcode 1 + Gosu.draw_rect(36 - 1, @field_size - 24 - 4, 2, 2, @blue) + Gosu.draw_rect(36 - 1, @field_size - 36 - 1, 2, 2, @blue) + Gosu.draw_rect(36 - 1, @field_size - 48 + 2, 2, 2, @blue) + + # blue barcode 2 + Gosu.draw_rect(36 - 1, 48 + 2, 2, 2, @blue) + Gosu.draw_rect(36 - 1, 60 - 1, 2, 2, @blue) + Gosu.draw_rect(36 - 1, 72 - 4, 2, 2, @blue) + + # blue wobble goal + Gosu.draw_circle(48, 84, 9, 32, @blue) + + # blue shared wobble goal + Gosu.draw_circle(@field_size / 2, 24, 9, 32, @blue) + + # red ZONE + Gosu.draw_rect(@field_size - 24 - 2, @field_size - 24, 2, 24, @red) + Gosu.draw_rect(@field_size - 48, @field_size - 24, 24, 2, @red) + Gosu.draw_rect(@field_size - 48, @field_size - 24, 2, 24, @red) + + # red barcode 1 + Gosu.draw_rect(@field_size - 36 - 1, @field_size - 24 - 4, 2, 2, @red) + Gosu.draw_rect(@field_size - 36 - 1, @field_size - 36 - 1, 2, 2, @red) + Gosu.draw_rect(@field_size - 36 - 1, @field_size - 48 + 2, 2, 2, @red) + + # red barcode 2 + Gosu.draw_rect(@field_size - 36 - 1, 48 + 2, 2, 2, @red) + Gosu.draw_rect(@field_size - 36 - 1, 60 - 1, 2, 2, @red) + Gosu.draw_rect(@field_size - 36 - 1, 72 - 4, 2, 2, @red) + + # red wobble goal + Gosu.draw_circle(@field_size - 48, 84, 9, 32, @red) + + # red shared wobble goal + Gosu.clip_to(@field_size / 2, 0, 10, 48) do + Gosu.draw_circle(@field_size / 2, 24, 9, 32, @red) + end + + # white corner left + faint_white = Gosu::Color.rgb(240, 240, 240) + + Gosu.draw_rect(0, 46 - 2, 46, 2, faint_white) + Gosu.draw_rect(46 - 2, 0, 2, 46, faint_white) + # white corner right + Gosu.draw_rect(@field_size - 46, 46 - 2, 46, 2, faint_white) + Gosu.draw_rect(@field_size - 46, 0, 2, 46, faint_white) + + # cross bars + bar_gray = Gosu::Color.rgb(50, 50, 50) + # MAIN + Gosu.draw_rect(13.75, 48 - 2, @field_size - 13.75 * 2, 1, bar_gray) + Gosu.draw_rect(13.75, 48 + 1, @field_size - 13.75 * 2, 1, bar_gray) + Gosu.draw_rect(13.75, 48 - 2, 1, 4, Gosu::Color::BLACK) + Gosu.draw_rect(@field_size - 13.75 - 1, 48 - 2, 1, 4, Gosu::Color::BLACK) + + # BLUE + Gosu.draw_rect(48 - 2, 13.75, 1, 48 - 13.75 - 2, bar_gray) + Gosu.draw_rect(48 + 1, 13.75, 1, 48 - 13.75 - 2, bar_gray) + Gosu.draw_rect(48 - 2, 13.75, 4, 1, Gosu::Color::BLACK) + Gosu.draw_rect(48 - 2, 48 - 3, 4, 1, Gosu::Color::BLACK) + + # RED + Gosu.draw_rect(@field_size - 48 - 2, 13.75, 1, 48 - 13.75 - 2, bar_gray) + Gosu.draw_rect(@field_size - 48 + 1, 13.75, 1, 48 - 13.75 - 2, bar_gray) + Gosu.draw_rect(@field_size - 48 - 2, 13.75, 4, 1, Gosu::Color::BLACK) + Gosu.draw_rect(@field_size - 48 - 2, 48 - 3, 4, 1, Gosu::Color::BLACK) + + # Duck Delivery + Gosu.draw_circle(2, @field_size - 2, 9, 16, Gosu::Color.rgb(75, 75, 75)) + Gosu.draw_circle(@field_size - 2, @field_size - 2, 9, 16, Gosu::Color.rgb(75, 75, 75)) + + # packages + soft_orange = Gosu::Color.rgb(255, 175, 0) + + 7.times do |y| + 7.times do |x| + if x.even? + Gosu.draw_rect(x * 3 + 1, y * 3 + 1, 2, 2, soft_orange) + else + Gosu.draw_circle(x * 3 + 2, y * 3 + 2, 1, 16, faint_white) + end + end + end + + 7.times do |y| + 7.times do |x| + if x.even? + Gosu.draw_rect((@field_size - 4) - x * 3 + 1, y * 3 + 1, 2, 2, soft_orange) + else + Gosu.draw_circle((@field_size - 4) - x * 3 + 2, y * 3 + 2, 1, 16, faint_white) + end + end + end + + Gosu.draw_rect(0, 60 - 1, 2, 2, soft_orange) + Gosu.draw_rect(0, 108 - 1, 2, 2, soft_orange) + Gosu.draw_rect(@field_size - 2, 60 - 1, 2, 2, soft_orange) + Gosu.draw_rect(@field_size - 2, 108 - 1, 2, 2, soft_orange) + end + def draw_tile_box(color) Gosu.draw_rect(0, 0, 24, 2, color) Gosu.draw_rect(22, 2, 2, 22, color) diff --git a/lib/simulator/simulation.rb b/lib/simulator/simulation.rb index bbb0969..a07abdc 100644 --- a/lib/simulator/simulation.rb +++ b/lib/simulator/simulation.rb @@ -7,7 +7,7 @@ module TAC @field_container = field_container @robots = [] - @field = Field.new(simulation: self, season: :ultimate_goal, container: @field_container) + @field = Field.new(simulation: self, season: :freight_frenzy, container: @field_container) @show_paths = false @last_milliseconds = Gosu.milliseconds