Last active
December 9, 2019 10:43
-
-
Save Nakilon/46c059c4a07582845d30f5198c86497f to your computer and use it in GitHub Desktop.
7 Days to Die -- best building blocks (by glue and mass)
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
blocks = Hash[ File.read("blocks.xml").scan(/<block .*?<\/block>/m).each_with_object({}){ |m, h| | |
xml = Nokogiri::XML m | |
if mat = xml.at("[name=Material]") | |
h[xml.root[:name]] = mat[:value] | |
elsif ext = xml.at("[name=Extends]") | |
h[xml.root[:name]] = ->{ h.fetch ext[:value] } | |
end | |
}.map{ |k, v| [k, MLL::nest_while[v, ->_{ _.call }, ->_{ _.respond_to? :call }]] rescue nil }.compact. | |
group_by(&:last).map{ |mat, g| [mat, g.map(&:first)] } ] | |
fail unless blocks.values.flatten.include? "woodCatwalkRailing2" | |
locale = Hash[CSV.table("Localization.txt").map{ |r| [r[0], r[5]] }] | |
recipes = Hash[ File.read("recipes.xml").scan(/<recipe .*?<\/recipe>/m).map{ |m| | |
xml = Nokogiri::XML m | |
[ | |
xml.root[:name], | |
xml.css("ingredient").map{ |i| | |
"#{locale[i[:name]] || i[:name].inspect} x#{i[:count]}" | |
}.join(" + ") | |
] | |
} ] | |
pcbr = PCBR.new | |
struct = Struct.new :id, :glue, :mass | |
File.read("materials.xml").scan(/<material .*?<\/material>/m).each{ |m| | |
xml = Nokogiri::XML m | |
glue = xml.at "[name=stability_glue]" | |
mass = xml.at "[name=Mass]" | |
mat = struct.new xml.root[:id], (glue[:value].to_i if glue), (mass[:value].to_i if mass) | |
pcbr.store mat, [mat.glue, -mat.mass] if glue || mass | |
} | |
puts MLL::grid[ | |
pcbr.table.sort_by{ |r| [-r.last, -r.first.glue] }. | |
map{ |r| | |
m = r.first | |
(blocks.assoc(m.id) || [m.id.inspect, []]).tap{ |_| | |
_.replace [_.first, r.first.glue, r.first.mass, _.last] | |
break if _.last.empty? | |
_[-1] = _[-1].map{ |b| [locale[b] || b, recipes[b]] if recipes[b] }.compact | |
break if _[-1].empty? | |
_[-1] = MLL::grid[_[-1], spacings: [1.5, -0.5], alignment: :left] | |
} | |
}.compact, | |
spacings: [1, 0] | |
] |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
D:\STEAM\steamapps\common\7 Days To Die\Data\Config>ruby -rnokogiri -rmll -rpcbr -rcsv c:\temp\materials.rb | |
MmetalDrawbridge 300 5 Reinforced Drawbridge Forged Iron x100 + Wood x1000 + Spring x20 + Mechanical Parts x30 | |
Reinforced Drawbridge (Powered) Forged Iron x100 + Wood x1000 + Spring x20 + Mechanical Parts x30 + Electrical Parts x30 | |
MwoodCatwalk 40 4 Wood CatWalks / Stairs Wood x8 | |
MwoodReinforced 40 5 Secure Storage Chest Wood x10 | |
Mwood_weak 40 5 Cooler Scrap Polymers x8 | |
Tripwire Post Wood x5 + Electrical Parts x1 | |
Loose Boards Block 1x1 Nails x5 + Wood x20 | |
Loose Boards Plate 1x1 Nails x5 + Wood x20 | |
Loose Boards Block 3x3 Nails x30 + Wood x180 | |
Wood Frame Block Wood x2 | |
Wood Fences and Railings Wood x2 | |
MclothStable 40 5 Awning Block Wood x4 + Cloth Fragment x10 | |
Mwood_regular 40 5 Wood Arrow Slit Wood x6 | |
Wood Log Wood x10 | |
Wood Stairs, Railing Left Wood x6 | |
Wood Stairs, Railing Right Wood x6 | |
Wood Pole Wood x6 | |
Wood Wedge Tip Wood x6 | |
Wood Ramp Incline Wood x6 | |
Wood Ramp Incline Filler Wood x6 | |
Wood Ctr Plate Wood x6 | |
wood Pole Centered Wood x6 | |
Wood Arrow Block Wood x6 | |
Wood Plate Wood x6 | |
Wood Support Beam Wood x6 | |
Wood Pillar 100 Wood x6 | |
Wood Stairs Wood x6 | |
Wood Bars Centered Wood x6 | |
Wood Bars Wood x6 | |
Secure Wood Door Wood x4 | |
Wooden Hatch Wood x6 | |
Wooden Storage / Furniture Nails x10 + Wood x10 | |
Wooden Signs Nails x10 + Wood x10 | |
Mmetal_thin 10 1 End Table Lamp Wood x5 + Headlight x1 + Electrical Parts x3 + Duct Tape x4 + Scrap Polymers x4 | |
Mwood_ladders 20 5 Wooden Ladder Wood x3 | |
MtrapSpikesWood 20 5 Wood Spikes Trap Wood x20 | |
Mpaper 20 5 Candle Table Candle x1 | |
MelectricParts 20 5 TV Electrical Parts x12 + Glass Block x1 + Scrap Polymers x8 | |
TV Large, Left Electrical Parts x12 + Glass Block x1 + Scrap Polymers x8 | |
TV Large, Right Electrical Parts x12 + Glass Block x1 + Scrap Polymers x8 | |
MbarbedFence 20 5 Barbed Wire Fence Iron x8 + Wood x10 | |
Mglass 20 5 Basic Light Bulb Forged Iron x2 + Electrical Parts x4 | |
Lantern Forged Iron x5 + Headlight x1 + Electrical Parts x3 + Duct Tape x4 + Oil x5 | |
Wood Window Wood x4 + Glass Block x1 | |
Business Glass Centered (Trap) "unit_glass" x20 + "unit_stone" x5 + "unit_lead" x5 + "unit_clay" x3 | |
Business Glass Pane (Trap) "unit_glass" x20 + "unit_stone" x5 + "unit_lead" x5 + "unit_clay" x3 | |
Glass Block "unit_glass" x14 + "unit_lead" x5 + "unit_clay" x2 | |
Mbrick 120 10 Brick Block "unit_stone" x10 + "unit_clay" x60 | |
Mconcrete 120 10 Asphalt Crushed Sand x8 + Small Stone x17 + Oil Shale x5 | |
Wet Concrete Block Concrete Mix x10 | |
Mmetal_rebar 120 10 Rebar Frame Block "unit_iron" x5 + "unit_clay" x1 | |
Mstone 120 10 Stone Crushed Sand x10 + Small Stone x18 + Cement x4 | |
Flagstone Block Cobblestone Rocks x4 | |
Mmetal_weak 120 10 Beverage Cooler Forged Iron x4 + Short Iron Pipe x3 + Electrical Parts x6 | |
An Old Bed Cloth Fragment x20 + Cotton x20 + Spring x10 + Short Iron Pipe x10 | |
Battery Bank Forged Iron x10 + Electrical Parts x11 + Scrap Polymers x6 | |
Electric Wire Relay Forged Iron x2 + Electrical Parts x1 | |
Switch Forged Iron x2 + Mechanical Parts x1 + Electrical Parts x1 | |
Motion Sensor Forged Iron x2 + Mechanical Parts x1 + Electrical Parts x5 | |
Electric Timer Relay Forged Iron x2 + Electrical Parts x5 | |
Speaker Forged Iron x4 + Electrical Parts x3 | |
Electric Fence Post Forged Iron x5 + Electrical Parts x2 | |
Metal Letters / Numbers "unit_iron" x15 + "unit_clay" x3 | |
Toilet Bucket of Water x1 + Short Iron Pipe x2 + Mechanical Parts x1 + Wood x4 | |
Mmushrooms 1 1 Mushroom Spores (Seed) Mushrooms x5 + Clay Soil x2 | |
MglassBulletproof 60 10 Bulletproof Glass Block "unit_glass" x110 + "unit_stone" x10 + "unit_lead" x40 + "unit_iron" x20 + "unit_clay" x20 | |
Mmetal_hard 300 20 Wall Safe Forged Iron x10 + Spring x2 + Mechanical Parts x3 | |
Desk Safe Forged Iron x20 + Spring x2 + Mechanical Parts x3 | |
Gun Safe Forged Steel x40 + Spring x5 + Mechanical Parts x5 | |
Drawer Forged Steel x8 | |
Trigger Plate 1x5 Forged Iron x50 + Mechanical Parts x8 + Electrical Parts x6 | |
Dart Trap Forged Iron x20 + Mechanical Parts x6 + Electrical Parts x4 + Oil x5 | |
Blade Trap Forged Iron x10 + Forged Steel x10 + Mechanical Parts x8 + Electrical Parts x6 + Oil x10 | |
Iron Bars Centered "unit_iron" x100 + "unit_clay" x20 | |
Iron Bars "unit_iron" x100 + "unit_clay" x20 | |
Iron Door Forged Iron x10 | |
Mmetal_medium 300 20 Iron Arrow Slit "unit_iron" x40 + "unit_clay" x5 | |
Iron Stairs, Railing Left "unit_iron" x40 + "unit_clay" x5 | |
Iron Stairs, Railing Right "unit_iron" x40 + "unit_clay" x5 | |
Iron Pole Centered "unit_iron" x40 + "unit_clay" x5 | |
Iron Stairs "unit_iron" x40 + "unit_clay" x5 | |
Iron Sheet "unit_iron" x40 + "unit_clay" x5 | |
Generator Bank Forged Iron x10 + Mechanical Parts x10 + Electrical Parts x14 | |
Trigger Plate 1x1 Forged Iron x10 + Mechanical Parts x2 + Electrical Parts x2 | |
SMG Auto Turret Motion Sensor x1 + Forged Steel x30 + Handgun Parts x3 + Oil x10 + Scrap Polymers x5 | |
Shotgun Auto Turret Forged Steel x40 + Shotgun Parts x3 + Oil x10 + Scrap Polymers x10 + Motion Sensor x1 | |
Iron Hatch Iron x40 | |
Metal Trussing / I-Beams "unit_iron" x40 + "unit_clay" x5 | |
Msteel 300 20 Steel Ladder Forged Steel x5 | |
Land Claim Block Small Stone x5 | |
Vault Door Forged Steel x12 + Spring x2 + Mechanical Parts x4 | |
Vault Door 03 (Powered) Forged Steel x36 + Spring x6 + Mechanical Parts x12 + Electrical Parts x24 | |
Steel Garage Door 3x2 (Powered) Forged Steel x40 + Spring x6 + Mechanical Parts x12 + Electrical Parts x12 | |
Steel Garage Door 5x3 (Powered) Forged Steel x60 + Spring x12 + Mechanical Parts x24 + Electrical Parts x20 | |
Vault Hatch Forged Steel x12 + Spring x2 + Mechanical Parts x4 | |
Vault Hatch v3 (Powered) Forged Steel x36 + Spring x6 + Mechanical Parts x12 + Electrical Parts x24 | |
Mmetal 300 20 Iron Ladder Forged Iron x5 | |
Workbench Forged Iron x25 + Mechanical Parts x20 + Wrench x1 + Claw Hammer x1 + Wood x50 | |
Spotlight Headlight x1 + Electrical Parts x8 + Duct Tape x2 + Iron x50 | |
Industrial Light Forged Iron x4 + Electrical Parts x4 | |
Industrial Light Bulb Forged Iron x4 + Electrical Parts x4 | |
Burning Barrel Forged Iron x3 + Wood x10 | |
Iron Garage Door 3x2 Forged Iron x20 + Spring x6 + Mechanical Parts x12 | |
Rolling Garage Door 5x3 Forged Iron x90 + Spring x12 + Mechanical Parts x15 | |
Metal Fences and Railings "unit_iron" x15 + "unit_clay" x1 | |
Metal Furniture Forged Iron x3 | |
MtrapSpikesIron 300 20 Iron Spikes Trap Forged Iron x4 | |
Mmetal_frame 300 20 Iron Frame Block "unit_iron" x15 + "unit_clay" x4 | |
Mcorn 0 1 Yucca (Seed) Yucca Fruit x5 | |
Aloe Vera (Seed) Aloe Vera Leaf x5 | |
Corn (Seed) Ear of Corn x5 | |
Super Corn (Seed) Ear of Super Corn x5 | |
Pumpkin (Seed) Pumpkin x5 | |
Mtallgrass 0 1 Grass (Seed) Plant Fibers x5 | |
MstoneNoGlue 0 1 Campfire Small Stone x5 | |
Mplants 0 1 Cotton (Seed) Cotton x5 | |
Coffee (Seed) Coffee Beans x5 | |
Goldenrod (Seed) Goldenrod Flower x5 | |
Blueberry (Seed) Blueberries x5 | |
Potato (Seed) Potato x5 | |
Chrysanthemum (Seed) Chrysanthemum x5 | |
Hop (Seed) Hops Flower x5 | |
Jack o' Lantern Pumpkin x1 + Candle x1 | |
Bedroll Plant Fibers x10 | |
Mleather 5 5 Office Chair Leather x8 + Cotton x10 + Mechanical Parts x4 + Forged Iron x4 | |
Mfurniture 5 5 Sofa 01 Cloth Fragment x15 + Nails x10 + Wood x15 | |
Sofa Chair 01 Cloth Fragment x15 + Nails x10 + Wood x15 | |
Leather Sofa 02 Leather x15 + Nails x10 + Wood x15 | |
Leather Sofa Chair 02 Leather x15 + Nails x10 + Wood x15 | |
King Size Bed Cloth Fragment x40 + Cotton x40 + Spring x20 + Wood x20 + Short Iron Pipe x10 | |
Sectional Leather Couch Leather x5 + Nails x10 + Wood x10 | |
Sectional Old Couch Cloth Fragment x5 + Nails x10 + Wood x10 | |
Mfarmland 20 10 Farm Plot Wood x4 + Rotting Flesh x10 + Nitrate Powder x25 + Clay Soil x100 | |
Mrubble 20 10 Destroyed Stone Small Stone x18 | |
Mdirt 20 10 Dirt Clay Soil x16 | |
Topsoil Clay Soil x16 | |
Mstone_scrap 10 10 Forge Small Stone x50 + Clay Soil x60 + Leather x10 + Duct Tape x3 + Short Iron Pipe x3 | |
MLandMine 0 5 Tin Land Mine Iron x4 + Gun Powder x4 + Candy Tin Can x1 + Nails x1 | |
Pressure Plate Mine Iron x30 + Gun Powder x8 + Duct Tape x1 | |
Cooking Pot Mine Iron x5 + Gun Powder x5 + Cooking Pot x1 + Nails x1 | |
Hubcap Land Mine Iron x8 + Gun Powder x8 + Hub Cap x1 + Spring x1 | |
Air Filter Land Mine Iron x12 + Gun Powder x12 + Car Air Filter x1 + Spring x1 | |
Mhay 0 5 Hay Bale Plant Fibers x10 | |
MfertilizedClayPlanter 0 5 Potted Plant Plant Fibers x4 + Clay Soil x8 | |
Miron_scrap 20 20 Cement Mixer Forged Iron x25 + Spring x4 + Engine x1 + Mechanical Parts x10 | |
Chemistry Station Beaker x1 + Burning Barrel x1 + Cooking Pot x3 + Short Iron Pipe x15 + Wood x40 | |
Table Saw Forged Iron x25 + Mechanical Parts x20 + Electrical Parts x10 + Spring x4 | |
Mgravel 4 10 Gravel Crushed Sand x11 + Small Stone x11 | |
Msand 4 10 Sandbags Crushed Sand x4 + Cloth Fragment x2 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment