1
0
mirror of https://github.com/Refactorio/RedMew.git synced 2025-03-03 14:53:01 +02:00

Merge pull request #213 from grilledham/develop

Tasklist rewrite + fruit loops changes + /report command
This commit is contained in:
Valansch 2018-08-20 16:20:14 +02:00 committed by GitHub
commit cde2ae60ab
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
6 changed files with 1206 additions and 219 deletions

View File

@ -484,7 +484,7 @@ local function find_player(cmd)
return
end
player.add_custom_alert(target, {type = 'virtual', name = 'signal-F'}, player.name, true)
player.add_custom_alert(target, {type = 'virtual', name = 'signal-F'}, name, true)
end
local function jail_player(cmd)
@ -624,14 +624,14 @@ end
local function admin_chat(cmd)
if not game.player or game.player.admin then --admins AND server
for _,p in pairs(game.players) do
for _, p in pairs(game.players) do
if p.admin then
local tag = ''
if game.player.tag and game.player.tag ~= '' then
tag = ' ' .. game.player.tag
end
p.print(string.format("(Admin) %s%s: %s", game.player.name, tag, cmd.parameter), game.player.chat_color)
end
p.print(string.format('(Admin) %s%s: %s', game.player.name, tag, cmd.parameter), game.player.chat_color)
end
end
end
end
@ -697,10 +697,37 @@ commands.add_command(
commands.add_command('a', 'Admin chat. Messages all other admins (Admins only)', admin_chat)
local Report = require('report')
commands.add_command('showreports', 'Shows user reports (Admins only)',
function(event)
if game.player and game.player.admin then
Report.show_reports(game.players[event.player_index])
local function report(cmd)
local reporting_player = game.player
if reporting_player then
local params = {}
for param in string.gmatch(cmd.parameter, '%S+') do
table.insert(params, param)
end
if #params < 2 then
reporting_player.print('Please enter then name of the offender and the reason for the report.')
return nil
end
local reported_player_name = params[1] or ''
local reported_player = game.players[reported_player_name]
if not reported_player then
reporting_player.print(reported_player_name .. ' does not exist.')
return nil
end
Report.report(reporting_player, reported_player, string.sub(cmd.parameter, string.len(params[1]) + 2))
end
end
commands.add_command('report', '<griefer-name> <message> Reports a user to admins', report)
commands.add_command(
'showreports',
'Shows user reports (Admins only)',
function(event)
if game.player and game.player.admin then
Report.show_reports(game.players[event.player_index])
end
end
)

View File

@ -325,7 +325,7 @@ be sure to show off your creatively.]]
}
tag_label.style.single_line = false
grid.add {type = 'sprite', sprite = 'item/discharge-defense-remote'}
grid.add {type = 'sprite', sprite = 'item/repair-pack'}
local task = grid.add {type = 'label', caption = 'Tasks'}
task.style.font = 'default-listbox'
local task_label =

View File

@ -6,12 +6,13 @@ This map has isolated areas, it's recommend turning biters to peaceful to reduce
local b = require 'map_gen.shared.builders'
-- change these to change the pattern.
local seed1 = 99999
local seed2 = 66666
local seed1 = 17000
local seed2 = seed1 * 2
local function value(base, mult)
local function value(base, mult, pow)
return function(x, y)
return mult * (math.abs(x) + math.abs(y)) + base
local d = math.sqrt(x * x + y * y)
return base + mult * d ^ pow
end
end
@ -21,12 +22,12 @@ local small_circle = b.circle(24)
local ring = b.all {big_circle, b.invert(small_circle)}
local ores = {
{resource_type = 'iron-ore', value = value(125, 0.5)},
{resource_type = 'copper-ore', value = value(100, 0.4)},
{resource_type = 'stone', value = value(100, 0.2)},
{resource_type = 'coal', value = value(100, 0.1)},
{resource_type = 'uranium-ore', value = value(50, 0.1)},
{resource_type = 'crude-oil', value = value(10000, 50)}
{resource_type = 'iron-ore', value = value(75, 0.25, 1.15)},
{resource_type = 'copper-ore', value = value(65, 0.2, 1.15)},
{resource_type = 'stone', value = value(50, 0.2, 1.1)},
{resource_type = 'coal', value = value(50, 0.15, 1.1)},
{resource_type = 'uranium-ore', value = value(50, 0.1, 1.075)},
{resource_type = 'crude-oil', value = value(17500, 25, 1.15)}
}
local iron = b.resource(b.full_shape, ores[1].resource_type, ores[1].value)
@ -34,7 +35,7 @@ local copper = b.resource(b.full_shape, ores[2].resource_type, ores[2].value)
local stone = b.resource(b.full_shape, ores[3].resource_type, ores[3].value)
local coal = b.resource(b.full_shape, ores[4].resource_type, ores[4].value)
local uranium = b.resource(b.full_shape, ores[5].resource_type, ores[5].value)
local oil = b.resource(b.throttle_world_xy(b.full_shape, 1, 4, 1, 4), ores[6].resource_type, ores[6].value)
local oil = b.resource(b.throttle_world_xy(b.full_shape, 1, 8, 1, 8), ores[6].resource_type, ores[6].value)
local function striped(_, _, world)
local t = (world.x + world.y) % 4 + 1
@ -43,7 +44,7 @@ local function striped(_, _, world)
return {
name = ore.resource_type,
position = {world.x, world.y},
amount = 3 * ore.value(world.x, world.y)
amount = 5 * ore.value(world.x, world.y)
}
end
@ -54,7 +55,7 @@ local function sprinkle(_, _, world)
return {
name = ore.resource_type,
position = {world.x, world.y},
amount = 3 * ore.value(world.x, world.y)
amount = 5 * ore.value(world.x, world.y)
}
end
@ -70,37 +71,60 @@ local segmented = b.segment_pattern({iron, copper, stone, coal})
local tree = b.entity(b.throttle_world_xy(b.full_shape, 1, 3, 1, 3), 'tree-01')
local start_iron = b.resource(ring, ores[1].resource_type, value(500, 0.5))
local start_copper = b.resource(ring, ores[2].resource_type, value(400, 0.5))
local start_stone = b.resource(ring, ores[3].resource_type, value(300, 0.5))
local start_coal = b.resource(ring, ores[4].resource_type, value(300, 0.5))
local function constant(x)
return function()
return x
end
end
local tree_shape = b.throttle_world_xy(big_circle, 1, 3, 1, 3)
tree_shape = b.subtract(tree_shape, b.translate(b.circle(6), 0, 32))
local start_iron = b.resource(small_circle, ores[1].resource_type, constant(750))
local start_copper = b.resource(small_circle, ores[2].resource_type, constant(600))
local start_stone = b.resource(small_circle, ores[3].resource_type, constant(600))
local start_coal = b.resource(small_circle, ores[4].resource_type, constant(600))
local start_segmented = b.segment_pattern({start_iron, start_copper, start_stone, start_coal})
local start_tree = b.entity(b.throttle_world_xy(small_circle, 1, 3, 1, 3), 'tree-01')
local start_tree = b.entity(tree_shape, 'tree-01')
local worm_names = {
'small-worm-turret',
'medium-worm-turret',
'big-worm-turret'
}
local max_worm_chance = 1 / 128
local worm_chance_factor = 1 / (192 * 512)
local worm_names = {'small-worm-turret', 'medium-worm-turret', 'big-worm-turret'}
local factor = 1 / (1024 * 32)
local max_chance = 1 / 8
local function worms(_, _, world)
local d = math.sqrt(world.x * world.x + world.y * world.y)
local wx, wy = world.x, world.y
local d = math.sqrt(wx * wx + wy * wy)
if d < 64 then
return nil
end
local worm_chance = d - 128
local lvl
if d < 192 then
lvl = 1
elseif d < 384 then
lvl = 2
else
lvl = 3
end
if worm_chance > 0 then
worm_chance = worm_chance * worm_chance_factor
worm_chance = math.min(worm_chance, max_worm_chance)
local chance = math.min(max_chance, d * factor)
if math.random() < chance then
local worm_id = math.random(1, lvl)
return {name = worm_names[worm_id]}
if math.random() < worm_chance then
if d < 256 then
return {name = 'small-worm-turret'}
else
local max_lvl
local min_lvl
if d < 512 then
max_lvl = 2
min_lvl = 1
else
max_lvl = 3
min_lvl = 2
end
local lvl = math.random() ^ (512 / d) * max_lvl
lvl = math.ceil(lvl)
lvl = math.clamp(lvl, min_lvl, 3)
return {name = worm_names[lvl]}
end
end
end
end
@ -113,21 +137,22 @@ local oil_loop = b.apply_entities(ring, {oil, worms})
local striped_loop = b.apply_entities(ring, {striped, worms})
local sprinkle_loop = b.apply_entities(ring, {sprinkle, worms})
local segmented_loop = b.apply_entities(ring, {segmented, worms})
local tree_loop = b.apply_entity(ring, tree)
local rock_loop = b.apply_entity(ring, rocks)
local start_loop = b.apply_entity(big_circle, b.any {start_segmented, start_tree})
local tree_loop = b.apply_entities(ring, {tree, worms})
local rock_loop = b.apply_entities(ring, {rocks, worms})
local start_loop = b.apply_entities(big_circle, {start_segmented, start_tree})
start_loop = b.translate(start_loop, 0, -32)
local loops = {
{striped_loop, 3},
{sprinkle_loop, 3},
{segmented_loop, 3},
{tree_loop, 6},
{rock_loop, 6},
{tree_loop, 9},
{rock_loop, 9},
{iron_loop, 20},
{copper_loop, 12},
{stone_loop, 9},
{coal_loop, 9},
{uranium_loop, 3},
{uranium_loop, 1},
{oil_loop, 9}
}

View File

@ -73,7 +73,7 @@ Module.show_reports = function(player)
draw_report(report_body, #reports)
end
local function report(reporting_player, reported_player, message)
function Module.report(reporting_player, reported_player, message)
table.insert(global.reports, {reporting_player_index = reporting_player.index, reported_player_index = reported_player.index, message = message, tick = game.tick})
local notified = false
@ -149,7 +149,7 @@ Module.spawn_reporting_popup = function(player, reported_player)
input.style.width = 400
input.style.height = 85
local button_flow = reporting_popup.add {type = "flow"}
submit_button = button_flow.add {type = "button", name = reporting_submit_button_name, caption="Submit"}
local submit_button = button_flow.add {type = "button", name = reporting_submit_button_name, caption="Submit"}
button_flow.add {type = "button", name = reporting_cancel_button_name, caption="Cancel"}
end
@ -178,7 +178,7 @@ Gui.on_click(
local reported_player_index = data["reported_player_index"]
Gui.destroy(frame)
report(event.player, game.players[reported_player_index], msg)
Module.report(event.player, game.players[reported_player_index], msg)
event.player.print("Sucessfully reported " .. game.players[reported_player_index].name)
end

View File

@ -98,8 +98,6 @@ return {
['delta124'] = true,
['derdu'] = true,
['df1229'] = true,
['dichromium'] = true,
['dimava'] = true,
['dmaonk'] = true,
['dpoba'] = true,
['ducktaperules'] = true,
@ -118,7 +116,6 @@ return {
['franc_ist'] = true,
['fremiamagus'] = true,
['frissi'] = true,
['fullfruntall'] = true,
['fuzz_pucker'] = true,
['fynko'] = true,
['g-h-o-s-t'] = true,
@ -131,7 +128,6 @@ return {
['grufe'] = true,
['gynox'] = true,
['hackguy'] = true,
['harmlessbeltbot'] = true,
['hazelnuthead'] = true,
['heardofsnails'] = true,
['heaser'] = true,
@ -661,5 +657,31 @@ return {
['Altafen'] = true,
['mar123322'] = true,
['Zijkhal'] = true,
['aldldl'] = true
['aldldl'] = true,
['Cooldude2606'] = true,
['jeemchan'] = true,
['Patrickle'] = true,
['eZethNesthrown'] = true,
['nathanweir'] = true,
['Novikov'] = true,
['GoatWizard'] = true,
['fargas'] = true,
['wot_tak'] = true,
['FullFruntall'] = true,
['strangeloveb52'] = true,
['Snyp'] = true,
['arron'] = true,
['UKWoody'] = true,
['Schallfalke'] = true,
['Avelix'] = true,
['Dichromium'] = true,
['Dimava'] = true,
['fantasychef'] = true,
['siniidrooq'] = true,
['Harmlessbeltbot'] = true,
['Meddleman'] = true,
['hamsterking5'] = true,
['hasuthika'] = true,
['wflagg'] = true,
['abnoeh'] = true
}

File diff suppressed because it is too large Load Diff