Changes
1 changed files (+19/-2)
-
-
@@ -730,6 +730,11 @@ if !(← get).grid.contains pos thenthrow s!"Could not place traffic light at {pos}" modifyf grid (·.modify pos fun p ↦ { p with control := .trafficLight t }) def deleteControl (pos : Nat3) : StateT State (Except String) Unit := do if !(← get).grid.contains pos then throw s!"Could not delete control signal at {pos}" modifyf grid (·.modify pos fun p ↦ { p with control := .none }) def addIntersection (pos : Nat3) : StateT State (Except String) Unit := do -- Main roads addRoad (pos + ⟨0, 0, 1⟩) (pos + ⟨3, 0, 1⟩) false
-
@@ -782,6 +787,7 @@ | multiRoad (isHigh : Bool)| building (variant : BuildingVariant) | yield | trafficLight (phase : Bool) | deleteControl | intersection instance : ToString Action where
-
@@ -792,6 +798,7 @@ | .multiRoad isHigh => s!"Build multilane {if isHigh then "highway" else "road"}"| .building variant => s!"Build {variant}" | .yield => "Build yield" | .trafficLight phase => s!"Build traffic light (phase {if phase then 2 else 1})" | .deleteControl => "Delete control signal" | .intersection => "Build intersection" def keyAction : List (Char × Action) := [
-
@@ -808,7 +815,8 @@ ('9', .building .factory),('Z', .yield), ('X', .trafficLight false), ('C', .trafficLight true), ('V', .intersection), ('V', .deleteControl), ('B', .intersection), ] -- TODO: Add height to existing building
-
@@ -865,6 +873,13 @@ have : dims.length = 6 := by grindaddTrafficLight ⟨dims[0], dims[1], dims[2]⟩ ⟨dims[3], dims[4], dims[5]⟩ else throw <| .userError "Failed to parse add traffic light command" | "c" :: dims => if h : dims.length = 3 then let dims := dims.map String.toNat! have : dims.length = 3 := by grind deleteControl ⟨dims[0], dims[1], dims[2]⟩ else throw <| .userError "Failed to parse delete control signal command" | "i" :: dims => if h : dims.length = 3 then let dims := dims.map String.toNat!
-
@@ -1053,6 +1068,8 @@ | _, .yield =>addYield mousePos | _, .trafficLight phase => addTrafficLight mousePos ⟨10, 10, if phase then 10 else 0⟩ | _, .deleteControl => deleteControl mousePos | _, .intersection => addIntersection mousePos | _, _ =>
-
@@ -1088,7 +1105,7 @@ if h : poses.length > 2 thendrawCubeV (poses[2].toVector3Shift s + ⟨0, 0.05, 0⟩) ⟨0.1, 0.1, 0.1⟩ .green if h : poses.length > 3 then drawCubeV (poses[3].toVector3Shift s + ⟨0, 0.05, 0⟩) ⟨0.1, 0.1, 0.1⟩ .red | _, .yield | _, .trafficLight _ => | _, .yield | _, .trafficLight _ | _, .deleteControl => drawCubeV (mousePosV3 + ⟨0, 0.075, 0⟩) ⟨0.02, 0.02, 0.02⟩ Color.Raylean.lime | _, .intersection => drawCubeV (mousePosV3 + ⟨0.15, 0, 0.15⟩) ⟨0.3, 0, 0.3⟩ Color.Raylean.gray
-