From 313112d9a982c7ab23bebe5121940a0326f6db08 Mon Sep 17 00:00:00 2001 From: Fen Dweller Date: Fri, 12 Mar 2021 13:23:47 -0500 Subject: [PATCH] Add a sofa for the new Furniture category Also tweak the function for making groups of entity so that it only adds model scales for vehicles, and so that the directory it works in can be set. This still needs to be spun out into a more generic function, though. --- macrovision.html | 1 + macrovision.js | 1 + media/attribution.js | 11 ++ media/furniture/Sofas/Two Seat-Front.svg | 128 +++++++++++++++++++++++ media/furniture/Sofas/Two Seat-Side.svg | 62 +++++++++++ media/furniture/Sofas/Two Seat-Top.svg | 101 ++++++++++++++++++ presets/furniture.js | 29 +++++ presets/vehicles.js | 55 +++++----- 8 files changed, 360 insertions(+), 28 deletions(-) create mode 100644 media/furniture/Sofas/Two Seat-Front.svg create mode 100644 media/furniture/Sofas/Two Seat-Side.svg create mode 100644 media/furniture/Sofas/Two Seat-Top.svg create mode 100644 presets/furniture.js diff --git a/macrovision.html b/macrovision.html index c34d5e5c..d50db2ca 100644 --- a/macrovision.html +++ b/macrovision.html @@ -23,6 +23,7 @@ + diff --git a/macrovision.js b/macrovision.js index b0a19f46..a5c51dfe 100644 --- a/macrovision.js +++ b/macrovision.js @@ -3164,6 +3164,7 @@ function prepareEntities() { availableEntities["dildos"] = makeDildos(); availableEntities["fiction"] = makeFiction(); availableEntities["food"] = makeFood(); + availableEntities["furniture"] = makeFurniture(); availableEntities["landmarks"] = makeLandmarks(); availableEntities["naturals"] = makeNaturals(); availableEntities["objects"] = makeObjects(); diff --git a/media/attribution.js b/media/attribution.js index 557bb24d..fd61f52a 100644 --- a/media/attribution.js +++ b/media/attribution.js @@ -15181,6 +15181,17 @@ const attributionData = { "dimensions-guide" ] }, + { + prefix: "./media/furniture/Sofas/", + files: [ + { name: "Two Seat-Front.svg", source: "https://www.dimensions.com/element/theatre-sofa" }, + { name: "Two Seat-Side.svg", source: "https://www.dimensions.com/element/theatre-sofa" }, + { name: "Two Seat-Top.svg", source: "https://www.dimensions.com/element/theatre-sofa" }, + ], + authors: [ + "dimensions-guide" + ] + }, { prefix: "./media/landmarks/", files: [ diff --git a/media/furniture/Sofas/Two Seat-Front.svg b/media/furniture/Sofas/Two Seat-Front.svg new file mode 100644 index 00000000..65431024 --- /dev/null +++ b/media/furniture/Sofas/Two Seat-Front.svg @@ -0,0 +1,128 @@ + + + + + + + + + + + + + + + + + + + + + diff --git a/media/furniture/Sofas/Two Seat-Side.svg b/media/furniture/Sofas/Two Seat-Side.svg new file mode 100644 index 00000000..ecde11bf --- /dev/null +++ b/media/furniture/Sofas/Two Seat-Side.svg @@ -0,0 +1,62 @@ + + + + + + + + + + + + + diff --git a/media/furniture/Sofas/Two Seat-Top.svg b/media/furniture/Sofas/Two Seat-Top.svg new file mode 100644 index 00000000..77c6a028 --- /dev/null +++ b/media/furniture/Sofas/Two Seat-Top.svg @@ -0,0 +1,101 @@ + + + + + + + + + + + + + diff --git a/presets/furniture.js b/presets/furniture.js new file mode 100644 index 00000000..c14020ac --- /dev/null +++ b/presets/furniture.js @@ -0,0 +1,29 @@ +function makeFurniture() { + results = []; + + const dataSofas = [ + { + name: "Two Seat", + sides: { + "Front": { height: math.unit(30, "inches") }, + "Side": { height: math.unit(30, "inches") }, + "Top": { height: math.unit(30.5, "inches") }, + } + }, + ] + + results.push({ + name: "Sofas", + constructor: () => makeAutoVehicleGroup(dataSofas, + "Sofas", + "furniture") + }); + + results.sort((b1, b2) => { + e1 = b1.constructor(); + e2 = b2.constructor(); + return -math.subtract(e1.views[e1.defaultView].height, e2.views[e2.defaultView].height).value; + }); + + return results; +} diff --git a/presets/vehicles.js b/presets/vehicles.js index ece0cb16..d50b795a 100644 --- a/presets/vehicles.js +++ b/presets/vehicles.js @@ -313,7 +313,7 @@ function makeVehicleGroup(info, name, prefix, directory="vehicles") { return entity; } -function makeAutoVehicleGroup(info, name) { +function makeAutoVehicleGroup(info, name, directory = "vehicles") { sides = {} let defaultHeight; @@ -327,33 +327,35 @@ function makeAutoVehicleGroup(info, name) { name: vehicle.name + " (" + sideName + ")", rename: true, height: data.height, - image: { source: "./media/vehicles/" + name + "/" + vehicle.name + "-" + sideName + ".svg" } + image: { source: "./media/" + directory + "/" + name + "/" + vehicle.name + "-" + sideName + ".svg" } }; }); }); const entity = makeMultiVehicle(name, sides); - entity.sizes.push({ - name: "1:72", - height: math.unit(math.divide(defaultHeight, 72)) - }); - entity.sizes.push({ - name: "1:24", - height: math.unit(math.divide(defaultHeight, 24)) - }); - entity.sizes.push({ - name: "1:16", - height: math.unit(math.divide(defaultHeight, 16)) - }); - entity.sizes.push({ - name: "1:8", - height: math.unit(math.divide(defaultHeight, 8)) - }); - entity.sizes.push({ - name: "1:4", - height: math.unit(math.divide(defaultHeight, 4)) - }); + if (directory == "vehicles") { + entity.sizes.push({ + name: "1:72", + height: math.unit(math.divide(defaultHeight, 72)) + }); + entity.sizes.push({ + name: "1:24", + height: math.unit(math.divide(defaultHeight, 24)) + }); + entity.sizes.push({ + name: "1:16", + height: math.unit(math.divide(defaultHeight, 16)) + }); + entity.sizes.push({ + name: "1:8", + height: math.unit(math.divide(defaultHeight, 8)) + }); + entity.sizes.push({ + name: "1:4", + height: math.unit(math.divide(defaultHeight, 4)) + }); + } return entity; } @@ -612,8 +614,7 @@ function makeVehicles() { results.push({ name: "Warships", constructor: () => makeAutoVehicleGroup(dataWarships, - "Warships", - "") + "Warships") }); const dataTanks = [ @@ -847,8 +848,7 @@ function makeVehicles() { name: "Tanks", constructor: () => makeAutoVehicleGroup( dataTanks, - "Tanks", - "") + "Tanks") }); const dataEveOnline = [ @@ -970,8 +970,7 @@ function makeVehicles() { name: "Eve Online", constructor: () => makeAutoVehicleGroup( dataEveOnline, - "Eve Online", - "") + "Eve Online") }); results.push({