2017-06-13 13:16:07 +02:00
|
|
|
local function create_info_button(event)
|
|
|
|
local player = game.players[event.player_index]
|
2017-07-09 02:28:01 +02:00
|
|
|
|
2017-06-30 17:10:19 +02:00
|
|
|
if player.gui.top.info_button == nil then
|
2017-07-09 02:28:01 +02:00
|
|
|
local button = player.gui.top.add({ type = "sprite-button", name = "info_button", sprite = "item/raw-fish" })
|
2017-06-13 13:16:07 +02:00
|
|
|
button.style.minimal_height = 38
|
|
|
|
button.style.minimal_width = 38
|
|
|
|
button.style.top_padding = 2
|
|
|
|
button.style.left_padding = 4
|
|
|
|
button.style.right_padding = 4
|
|
|
|
button.style.bottom_padding = 2
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
local function info_show(player)
|
|
|
|
|
|
|
|
local infotext = [===[
|
|
|
|
Hi stranger, I'm a fish..
|
|
|
|
And this is what you ought to know:
|
|
|
|
|
2017-07-09 02:28:01 +02:00
|
|
|
- Please be nice and don't grief. Or else.. ;)
|
2017-08-05 01:01:49 +02:00
|
|
|
- Admins: Don't abuse. Don't fight other Admins.
|
|
|
|
- Don't argue with other players for silly things.
|
2017-06-13 13:16:07 +02:00
|
|
|
- No political, racist, or misogynistic content.
|
2017-07-09 02:28:01 +02:00
|
|
|
- If you suspect you desync, restart the game.
|
2017-08-10 23:15:47 +02:00
|
|
|
- Join our growing community on discord.me/redmew
|
|
|
|
- Post server pics (or didn't happen): redmew.reddit.com
|
|
|
|
- View the in-game chatlog on: log.mewmew.net
|
2017-08-05 01:01:49 +02:00
|
|
|
- Contribute to our Hookers & Blow Fund with:
|
|
|
|
Bitcoin: 13qh5uJh3UDUiWKyQaybkpxC1gfLVDB1ww
|
|
|
|
Paypal: paypal.me/redmew (5$+ get nudes)
|
2017-06-13 13:16:07 +02:00
|
|
|
]===]
|
|
|
|
|
|
|
|
player.gui.left.direction = "horizontal"
|
|
|
|
local frame = player.gui.left.add { type = "frame", name = "info_panel"}
|
|
|
|
frame.style.top_padding = 20
|
|
|
|
frame.style.left_padding = 20
|
|
|
|
frame.style.right_padding = 20
|
|
|
|
frame.style.bottom_padding = 20
|
|
|
|
local info_table = frame.add { type = "table", colspan = 1, name = "info_table" }
|
|
|
|
local headline_label = info_table.add { type = "label", name = "headline_label", caption = "redmew fishy info" }
|
|
|
|
headline_label.style.font = "default-listbox"
|
|
|
|
headline_label.style.font_color = { r=0.98, g=0.66, b=0.22}
|
|
|
|
|
2017-07-09 02:28:01 +02:00
|
|
|
|
2017-06-13 13:16:07 +02:00
|
|
|
local text_box = info_table.add { type = "text-box", text = infotext, name = "text_box" }
|
|
|
|
text_box.read_only = true
|
|
|
|
text_box.selectable = true
|
|
|
|
text_box.word_wrap = false
|
|
|
|
text_box.style.right_padding = 5
|
|
|
|
text_box.style.top_padding = 5
|
|
|
|
text_box.style.left_padding = 5
|
|
|
|
text_box.style.bottom_padding = 5
|
2017-07-09 02:28:01 +02:00
|
|
|
|
2017-06-13 13:16:07 +02:00
|
|
|
local info_table_2 = info_table.add { type = "table", colspan = 2, name = "info_table" }
|
|
|
|
info_table_2.add { type = "label", caption = " " }
|
2017-07-09 02:28:01 +02:00
|
|
|
local close_button = info_table_2.add { type = "button", caption = "CLOSE", name = "info_close_button" }
|
|
|
|
close_button.style.font = "default-listbox"
|
2017-06-13 13:16:07 +02:00
|
|
|
end
|
|
|
|
|
|
|
|
|
|
|
|
local function on_gui_click(event)
|
|
|
|
if not (event and event.element and event.element.valid) then return end
|
2017-07-09 02:28:01 +02:00
|
|
|
|
2017-06-13 13:16:07 +02:00
|
|
|
local player = game.players[event.element.player_index]
|
2017-07-09 02:28:01 +02:00
|
|
|
local name = event.element.name
|
|
|
|
local frame = player.gui.left["info_panel"]
|
|
|
|
|
2017-06-13 13:16:07 +02:00
|
|
|
if (name == "info_button") and (frame == nil) then
|
|
|
|
info_show(player)
|
|
|
|
else
|
|
|
|
if (name == "info_button") then
|
|
|
|
frame.destroy()
|
|
|
|
end
|
|
|
|
end
|
2017-07-09 02:28:01 +02:00
|
|
|
|
2017-06-13 13:16:07 +02:00
|
|
|
if (name == "info_close_button") then
|
|
|
|
frame.destroy()
|
|
|
|
end
|
2017-07-09 02:28:01 +02:00
|
|
|
|
2017-06-13 13:16:07 +02:00
|
|
|
end
|
|
|
|
|
|
|
|
|
|
|
|
Event.register(defines.events.on_gui_click, on_gui_click)
|
2017-07-09 02:28:01 +02:00
|
|
|
Event.register(defines.events.on_player_joined_game, create_info_button)
|