Fixed bug with negative coordinates in remoteMap

This commit is contained in:
Daniel Vestøl committed 2019-02-08 09:16:57 +01:00
1 parent 9377eb9544
commit e731fcb4a9
4 files changed
+11 -3

No files matched your search

+4
View File
@@ -63,3 +63,7 @@ sharedPlugins/scenario_loader/scenarios
sharedPlugins/*/DISABLED
\.cache-require-paths\.json
\.vs/
bin/
BIN
View File
Binary file not shown.
View File
Whitespace-only changes.
+7 -3
View File
@@ -80,15 +80,15 @@ class masterPlugin {
.split("|") // split into entities
.map(str => str.replace("\n","")) // remove newlines that happen at the end of the last entity (maybe more as well???)
.filter(str => str.length > 0) // remove blank entities
.filter(str => !str.includes("tree") && // don't send entities that can't be rendered anyways
.filter(str =>
// !str.includes("tree") && // don't send entities that can't be rendered anyways
!str.includes("dead") &&
!str.includes("rock") &&
// !str.includes("rock") &&
!str.includes("crude-oil") &&
!str.includes("remnants") &&
!str.includes("cliff") &&
!str.includes("player") &&
!str.includes("ore"))
.map(ent => ent.replace(/[-]/g, "_")) // replace - with _
.map(ent => ent.split(",") // split entity into properties
.map(prop => [prop.split(":")[0], prop.split(":")[1]]) // split properties into KV pairs
)
@@ -97,6 +97,10 @@ class masterPlugin {
entity.forEach(property => entityObj[property[0]] = property[1])
return entityObj
})
.map(entity => {
entity.name = entity.name.replace(/[-]/g, "_") // replace - with _ in entity names as thats what factorio.blueprint-editor preffers
return entity
})
.filter(entity => Object.keys(entity).length > 1)
)
})