Permalink
Browse files

Expand Map With Cave That Can Be Entered From Mentoran

+ Add a new group to map design to model the visuals and walking nodes in the cave.
+ Add text elements to describe where the player will be offered additional interactions, which allow him to enter and leave the cave.
+ Support localizing the source of unsupported path data in map SVG: Expand parsing function to log errors to console.
+ Expand parsing of map SVG to support negative coordinates for polygon points.

The plan is to use the text elements as a mechanism to model placement of structures in the game world. The text content will be parsed to determine what is placed. The idea for the two elements introduced with this changeset is to offer the particular interactions to the player when he is located on the walk node which is closest to the text element in the SVG.
  • Loading branch information...
Viir committed Aug 1, 2018
1 parent 672aa8d commit 0c0dceee3f41cf98da07e6463541b6a0e5480c53
Showing with 12 additions and 9 deletions.
  1. +3 −5 src/GameWorld.elm
  2. +1 −1 src/MapRawXml.elm
  3. +5 −2 src/ParseSvg.elm
  4. +1 −1 src/app.elm
  5. +1 −0 src/elm-package.json
  6. +1 −0 static/map/2018-08-01T15.Freemake-map.svg
@@ -16,7 +16,7 @@ import ParseSvg exposing (VisualPolygon)
import MapRawXml
import Parser
import XmlParser
import Maybe.Extra
import Result.Extra
import Tuple2


@@ -246,10 +246,8 @@ parseMapXml mapXml =
|> List.map ParseSvg.getVisualPolygonFromXmlElement

polygons =
parsePathsResults
|> List.map Result.toMaybe
|> Maybe.Extra.combine
|> Maybe.withDefault []
(Debug.log "parsePathsResults" (parsePathsResults |> Result.Extra.combine))
|> Result.withDefault []
in
(accessNodes, { polygons = polygons })

Large diffs are not rendered by default.

Oops, something went wrong.
@@ -91,6 +91,9 @@ getOffsetFromSvgTransform transform =
{-
2018-07-23 Example of polygon in xml element from Gravit Designer:
<path d=" M 4583.5 4966 L 4663.5 5005 L 4654.5 5133 L 4477.5 5121 L 4378.5 5136 L 4469.5 4975 L 4583.5 4966 Z " id="Kerdis East" fill="rgb(216,181,143)"/>
2018-08-01 Example of polygon in xml element from Gravit Designer:
<path d=" M -1523 -171 L -154.484 -171 L -246.744 -1185 L -1343.607 -1185 L -1523 -171 Z " id="Mentoran-Cave-Base" fill="rgb(47,47,47)"/>
-}
getVisualPolygonFromXmlElement : XmlElement -> Result String VisualPolygon
getVisualPolygonFromXmlElement xmlElement =
@@ -112,7 +115,7 @@ getVisualPolygonFromXmlElement xmlElement =

polygonPointsFromSvgPathData : String -> Result String (List Point2d)
polygonPointsFromSvgPathData pathData =
case Regex.find Regex.All (Regex.regex "^\\s*M([\\s\\d\\.L]+)Z\\s*$") pathData of
case Regex.find Regex.All (Regex.regex "^\\s*M([\\-\\s\\d\\.L]+)Z\\s*$") pathData of
[ polygonMatch ] ->
case polygonMatch.submatches |> List.head of
Just (Just pointsString) ->
@@ -127,5 +130,5 @@ polygonPointsFromSvgPathData pathData =
|> Maybe.Extra.combine
|> Result.fromMaybe "Failed to parse points"
_ -> Err "No submatch in polygonMatch"
_ -> Err "Does not match overall polygon path"
_ -> Err ("Path data Does not match overall polygon path: " ++ pathData)

@@ -66,4 +66,4 @@ productVersionOverlay =
|> Html.div [ HA.style [("position","absolute"),("top","3px"),("margin","1px")]]

productVersion : String
productVersion = "2018-07-31"
productVersion = "2018-08-01"
@@ -10,6 +10,7 @@
"dependencies": {
"Fresheyeball/elm-tuple-extra": "3.0.0 <= v < 4.0.0",
"elm-community/maybe-extra": "4.0.0 <= v < 5.0.0",
"elm-community/result-extra": "2.2.0 <= v < 3.0.0",
"elm-lang/animation-frame": "1.0.1 <= v < 2.0.0",
"elm-lang/core": "5.1.1 <= v < 6.0.0",
"elm-lang/html": "2.0.0 <= v < 3.0.0",

Large diffs are not rendered by default.

Oops, something went wrong.

0 comments on commit 0c0dcee

Please sign in to comment.