From 97be613e3d26b5c1272fe0b5c627cf1bd66d8885 Mon Sep 17 00:00:00 2001 From: Zahir Khan Date: Wed, 27 Nov 2019 20:26:37 -0500 Subject: [PATCH 1/6] Added random turkey message every 10min --- map_gen/maps/turkey.lua | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/map_gen/maps/turkey.lua b/map_gen/maps/turkey.lua index ce9fdc85..fe7c4200 100644 --- a/map_gen/maps/turkey.lua +++ b/map_gen/maps/turkey.lua @@ -2,6 +2,8 @@ local b = require "map_gen.shared.builders" local pic = require "map_gen.data.presets.turkey" local RS = require 'map_gen.shared.redmew_surface' local MGSP = require 'resources.map_gen_settings' +local Event = require 'utils.event' +local turkey_message_random = require 'resources.turkey_messages' RS.set_map_gen_settings( { @@ -9,6 +11,16 @@ RS.set_map_gen_settings( } ) +Event.add( + defines.events.on_tick, + function(event) + if event.tick % 60*600 == 0 then + local message = turkey_message_random[math.random(#turkey_message_random)] + game.print(message) + end + end +) + pic = b.decompress(pic) local shape = b.picture(pic) From 837eedcc2c60542bee58c7c127b62e402ce8516b Mon Sep 17 00:00:00 2001 From: Zahir Khan Date: Wed, 27 Nov 2019 20:39:26 -0500 Subject: [PATCH 2/6] Update turkey.lua --- map_gen/maps/turkey.lua | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/map_gen/maps/turkey.lua b/map_gen/maps/turkey.lua index fe7c4200..8d0facb3 100644 --- a/map_gen/maps/turkey.lua +++ b/map_gen/maps/turkey.lua @@ -14,7 +14,7 @@ RS.set_map_gen_settings( Event.add( defines.events.on_tick, function(event) - if event.tick % 60*600 == 0 then + if event.tick % 36000 == 0 then local message = turkey_message_random[math.random(#turkey_message_random)] game.print(message) end From 9a6e978a272c9abebfde43ef1a68f741f10b4fae Mon Sep 17 00:00:00 2001 From: Zahir Khan Date: Wed, 27 Nov 2019 21:01:49 -0500 Subject: [PATCH 3/6] Update turkey.lua --- map_gen/maps/turkey.lua | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/map_gen/maps/turkey.lua b/map_gen/maps/turkey.lua index 8d0facb3..6abc7da5 100644 --- a/map_gen/maps/turkey.lua +++ b/map_gen/maps/turkey.lua @@ -16,7 +16,7 @@ Event.add( function(event) if event.tick % 36000 == 0 then local message = turkey_message_random[math.random(#turkey_message_random)] - game.print(message) + game.print('[color=yellow][font=compi]' .. message .. '[/font][/color]') end end ) From bd8e289e585cdbb19e3c8eba53420b94a129440d Mon Sep 17 00:00:00 2001 From: theorangeangle <36866626+theorangeangle@users.noreply.github.com> Date: Wed, 27 Nov 2019 23:10:50 -0600 Subject: [PATCH 4/6] i wanted to add the turkey ores from the 2018 map onto the 2019 terrain but can't clear out all the errors. going to have inebriate myself and see if that makes things better or worse. -11:10pm local --- map_gen/maps/turkey.lua | 133 ++++++++++++++++++++++++++++++++++++++++ 1 file changed, 133 insertions(+) diff --git a/map_gen/maps/turkey.lua b/map_gen/maps/turkey.lua index 6abc7da5..194575d8 100644 --- a/map_gen/maps/turkey.lua +++ b/map_gen/maps/turkey.lua @@ -1,4 +1,6 @@ local b = require "map_gen.shared.builders" +local Random = require 'map_gen.shared.random' +local table = require 'utils.table' local pic = require "map_gen.data.presets.turkey" local RS = require 'map_gen.shared.redmew_surface' local MGSP = require 'resources.map_gen_settings' @@ -11,6 +13,136 @@ RS.set_map_gen_settings( } ) +local ore_seed = 3000 + +local turkey_pic = require 'map_gen.data.presets.turkey_bw' +local turkey = b.picture(turkey_pic) +turkey = b.invert(turkey) +local bounds = b.rectangle(turkey_pic.width, turkey_pic.height) +turkey = b.all {bounds, turkey} + +local ham = b.picture(require 'map_gen.data.presets.ham') + +ham = b.scale(ham, 64 / 127) --0.5 +turkey = b.scale(turkey, 0.2) + +local function value(base, mult, pow) + return function(x, y) + local d = math.sqrt(x * x + y * y) + return base + mult * d ^ pow + end +end + +local function non_transform(shape) + return shape +end + +local function uranium_transform(shape) + return b.scale(shape, 0.5) +end + +local function oil_transform(shape) + shape = b.scale(shape, 0.3) + shape = b.throttle_world_xy(shape, 1, 5, 1, 5) + return shape +end + +local ores = { + {weight = 150}, + {transform = non_transform, resource = 'iron-ore', value = value(250, 0.75, 1.2), weight = 16}, + {transform = non_transform, resource = 'copper-ore', value = value(200, 0.75, 1.2), weight = 10}, + {transform = non_transform, resource = 'stone', value = value(125, 0.3, 1.05), weight = 7}, + {transform = non_transform, resource = 'coal', value = value(200, 0.8, 1.075), weight = 8}, + {transform = uranium_transform, resource = 'uranium-ore', value = value(100, 0.3, 1.025), weight = 3}, + {transform = oil_transform, resource = 'crude-oil', value = value(100000, 50, 1.1), weight = 6} +} + +local total_ore_weights = {} +local ore_t = 0 +for _, v in ipairs(ores) do + ore_t = ore_t + v.weight + table.insert(total_ore_weights, ore_t) +end + +local random_ore = Random.new(ore_seed, ore_seed * 2) +local ore_pattern = {} + +for r = 1, 50 do + local row = {} + ore_pattern[r] = row + local even_r = r % 2 == 0 + for c = 1, 50 do + local even_c = c % 2 == 0 + local shape + if even_r == even_c then + shape = turkey + else + shape = ham + end + + local i = random_ore:next_int(1, ore_t) + local index = table.binary_search(total_ore_weights, i) + if (index < 0) then + index = bit32.bnot(index) + end + local ore_data = ores[index] + + local transform = ore_data.transform + if not transform then + row[c] = b.no_entity + else + local ore_shape = transform(shape) + --local ore_shape = shape + + local x = random_ore:next_int(-24, 24) + local y = random_ore:next_int(-24, 24) + ore_shape = b.translate(ore_shape, x, y) + + local ore = b.resource(ore_shape, ore_data.resource, ore_data.value) + row[c] = ore + end + end +end + +local start_turkey = + b.segment_pattern { + b.resource( + turkey, + 'iron-ore', + function() + return 1000 + end + ), + b.resource( + turkey, + 'copper-ore', + function() + return 500 + end + ), + b.resource( + turkey, + 'coal', + function() + return 750 + end + ), + b.resource( + turkey, + 'stone', + function() + return 300 + end + ) +} + +ore_pattern[1][1] = start_turkey + +local ore_grid = b.grid_pattern_full_overlap(ore_pattern, 50, 50, 96, 96) + +ore_grid = b.translate(ore_grid, -60, -20) + + Event.add( defines.events.on_tick, function(event) @@ -21,6 +153,7 @@ Event.add( end ) + pic = b.decompress(pic) local shape = b.picture(pic) From 9e72495790a64ed1f5784aa8381d473d7f45e12e Mon Sep 17 00:00:00 2001 From: theorangeangle <36866626+theorangeangle@users.noreply.github.com> Date: Wed, 27 Nov 2019 23:43:45 -0600 Subject: [PATCH 5/6] after playing whack a mole for 20 mins i think it's working now. local time 11:43pm --- map_gen/maps/turkey.lua | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/map_gen/maps/turkey.lua b/map_gen/maps/turkey.lua index 194575d8..c78aeced 100644 --- a/map_gen/maps/turkey.lua +++ b/map_gen/maps/turkey.lua @@ -159,5 +159,5 @@ pic = b.decompress(pic) local shape = b.picture(pic) shape = b.scale(shape, 4, 4) shape = b.translate(shape, -300, 500) - +shape = b.apply_entity(shape, ore_grid) return shape From 2225f5363f65e0ea67e4a5ec8b8feae1b01704ed Mon Sep 17 00:00:00 2001 From: theorangeangle <36866626+theorangeangle@users.noreply.github.com> Date: Wed, 27 Nov 2019 23:49:24 -0600 Subject: [PATCH 6/6] added vauge documentation that will come back to haunt me later local time 11:49 pm and travis better approve this by midnight! --- map_gen/maps/turkey.lua | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/map_gen/maps/turkey.lua b/map_gen/maps/turkey.lua index c78aeced..0c37b53f 100644 --- a/map_gen/maps/turkey.lua +++ b/map_gen/maps/turkey.lua @@ -1,3 +1,4 @@ +--RedMew's 2019 turkey/thanksgiving map! Thanks to all the contributors from world_map_thanksgiving.lua and to TheKidOZ. local b = require "map_gen.shared.builders" local Random = require 'map_gen.shared.random' local table = require 'utils.table' @@ -13,6 +14,8 @@ RS.set_map_gen_settings( } ) + +--everything from here to line 145 is all to generate the fancy ore; it should prob be cleaned up at some point. local ore_seed = 3000 local turkey_pic = require 'map_gen.data.presets.turkey_bw' @@ -142,7 +145,7 @@ local ore_grid = b.grid_pattern_full_overlap(ore_pattern, 50, 50, 96, 96) ore_grid = b.translate(ore_grid, -60, -20) - +--spews a random turkey fact in chat every 10 minutes. Event.add( defines.events.on_tick, function(event) @@ -156,6 +159,7 @@ Event.add( pic = b.decompress(pic) +--idk why this works but it does, played whack a mole/whack a variable to get it to clear all errors local shape = b.picture(pic) shape = b.scale(shape, 4, 4) shape = b.translate(shape, -300, 500)