1
0
mirror of https://github.com/ComfyFactory/ComfyFactorio.git synced 2025-01-04 00:15:45 +02:00

junkyard map info

This commit is contained in:
Gerkiz 2019-11-06 20:36:18 +01:00
parent 9227fda072
commit 9d5eec2235
2 changed files with 34 additions and 92 deletions

View File

@ -12,8 +12,7 @@ require "modules.biters_yield_coins"
require "modules.dangerous_nights"
require "modules.dangerous_goods"
require "maps.junkyard_map_intro"
local Map = require 'modules.map_info'
local unearthing_worm = require "functions.unearthing_worm"
local unearthing_biters = require "functions.unearthing_biters"
local tick_tack_trap = require "functions.tick_tack_trap"
@ -489,7 +488,39 @@ end
local function on_research_finished(event)
event.research.force.character_inventory_slots_bonus = game.forces.player.mining_drill_productivity_bonus * 300
end
local on_init = function()
local T = Map.Pop_info()
T.main_caption = "J u n k y a r d"
T.sub_caption = " ..the scrap is your friend.."
T.text = table.concat({
"Citizen Log #468-2A-3287, Freelancer Cole\n",
"\n",
"To whoever is reading this message,\n",
"i have most likely already left this doomed place, or... well..\n",
"\n",
"I am stranded on this foreign world since months and i have given up on fixing my ships transceiver.\n",
"Things aren't looking too good, i must admit.\n",
"The rust and devastation tells a story of an advanced civilization,\n",
"which seems to have evacuated their home long time ago.\n",
"\n",
"Any natural resources are rare and the ones worth while are too hard for me to reach.\n",
"Luckily, the wrecks yield all kinds of useful scraps, but also various dangers.\n",
"Almost lost half a leg some days ago while digging out a crate.\n",
"\n",
"The wildlife is extremely aggressive, especially at the time of night.\n",
"Most of these insect appearing like creatures seem to live underground.\n",
"Stay near your light sources, if you want to have a chance of surviving here!!\n",
"\n",
"I must make a move now, hopefully will find those missing parts.\n",
"\n",
"###Log End###"
})
T.main_caption_color = {r = 150, g = 150, b = 0}
T.sub_caption_color = {r = 0, g = 150, b = 0}
end
event.on_init(on_init)
event.add(defines.events.on_research_finished, on_research_finished)
event.add(defines.events.on_marked_for_deconstruction, on_marked_for_deconstruction)
event.add(defines.events.on_player_joined_game, on_player_joined_game)

View File

@ -1,89 +0,0 @@
local event = require 'utils.event'
--local main_caption = " --Junkyard-- "
--local sub_caption = "Some may call this junk. Me, I call them treasures."
local info = [[
Citizen Log #468-2A-3287, Freelancer Cole
To whoever is reading this message,
i have most likely already left this doomed place, or... well..
I am stranded on this foreign world since months and i have given up on fixing my ships transceiver.
Things aren't looking too good, i must admit.
The rust and devastation tells a story of an advanced civilization,
which seems to have evacuated their home long time ago.
Any natural resources are rare and the ones worth while are too hard for me to reach.
Luckily, the wrecks yield all kinds of useful scraps, but also various dangers.
Almost lost half a leg some days ago while digging out a crate.
The wildlife is extremely aggressive, especially at the time of night.
Most of these insect appearing like creatures seem to live underground.
Stay near your light sources, if you want to have a chance of surviving here!!
I must make a move now, hopefully will find those missing parts.
###Log End###
]]
local function create_map_intro_button(player)
if player.gui.top["map_intro_button"] then return end
local b = player.gui.top.add({type = "sprite-button", caption = "?", name = "map_intro_button", tooltip = "Map Info"})
b.style.font_color = {r = 0.8, g = 0.8, b = 0.8}
b.style.font = "heading-1"
b.style.minimal_height = 38
b.style.minimal_width = 38
b.style.top_padding = 2
b.style.left_padding = 4
b.style.right_padding = 4
b.style.bottom_padding = 2
end
local function create_map_intro(player)
if player.gui.left["map_intro_frame"] then player.gui.left["map_intro_frame"].destroy() end
local frame = player.gui.left.add {type = "frame", name = "map_intro_frame", direction = "vertical"}
local t = frame.add {type = "table", column_count = 1}
local b = frame.add {type = "button", caption = "Close", name = "close_map_intro_frame", align = "right"}
b.style.font = "default"
b.style.minimal_height = 30
b.style.minimal_width = 30
b.style.top_padding = 2
b.style.left_padding = 4
b.style.right_padding = 4
b.style.bottom_padding = 2
local frame = t.add {type = "frame"}
local l = frame.add {type = "label", caption = info}
l.style.single_line = false
l.style.font = "heading-3"
l.style.font_color = {r=0.95, g=0.95, b=0.95}
end
local function on_player_joined_game(event)
local player = game.players[event.player_index]
create_map_intro_button(player)
if player.online_time == 0 then
create_map_intro(player)
end
end
local function on_gui_click(event)
if not event then return end
if not event.element then return end
if not event.element.valid then return end
local player = game.players[event.element.player_index]
if event.element.name == "close_map_intro_frame" then player.gui.left["map_intro_frame"].destroy() return end
if event.element.name == "map_intro_button" then
if player.gui.left["map_intro_frame"] then
player.gui.left["map_intro_frame"].destroy()
else
create_map_intro(player)
end
return
end
end
event.add(defines.events.on_player_joined_game, on_player_joined_game)
event.add(defines.events.on_gui_click, on_gui_click)