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

Merge pull request #1159 from Refactorio/airstrike_improvements

Added some rendering to make airstrike nicer to use
This commit is contained in:
Jayefuu 2021-01-26 07:52:17 +00:00 committed by GitHub
commit 6973042ce6
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -358,6 +358,25 @@ function Public.control(config)
set_timeout_in_ticks(60*30, map_chart_tag_clear_callback, tag) -- To clear the tag after 30 seconds set_timeout_in_ticks(60*30, map_chart_tag_clear_callback, tag) -- To clear the tag after 30 seconds
end) end)
local function render_crosshair(data)
local red = {r = 0.5, g = 0, b = 0, a = 0.5}
local timeout = 5*60
local line_width = 10
local line_length = 2
local s = data.player.surface
local f = data.player.force
rendering.draw_circle{color=red, radius=1.5, width=line_width, filled=false, target=data.position, surface=s, time_to_live=timeout, forces={f}}
rendering.draw_line{color=red, width=line_width, from={data.position.x-line_length, data.position.y}, to={data.position.x+line_length, data.position.y}, surface=s, time_to_live=timeout, forces={f}}
rendering.draw_line{color=red, width=line_width, from={data.position.x, data.position.y-line_length}, to={data.position.x, data.position.y+line_length}, surface=s, time_to_live=timeout, forces={f}}
s.create_entity{name="flying-text", position={data.position.x+3, data.position.y}, text = "[item=poison-capsule] "..data.player.name, color = {r = 1, g = 1, b = 1, a = 1} }
end
local function render_radius(data)
local timeout = 20*60
local blue = {r = 0, g = 0, b = 0.1, a = 0.1}
rendering.draw_circle{color=blue, radius=data.radius+10, filled=true, target=data.position, surface=data.player.surface, time_to_live=timeout, players={data.player}}
end
local function strike(args, player) local function strike(args, player)
local s = player.surface local s = player.surface
local location_string = args.location local location_string = args.location
@ -430,6 +449,8 @@ function Public.control(config)
set_timeout_in_ticks(60 * j, chart_area_callback, {player = player, xpos = xpos, ypos = ypos}) set_timeout_in_ticks(60 * j, chart_area_callback, {player = player, xpos = xpos, ypos = ypos})
end end
player.force.chart(s, {{xpos - 32, ypos - 32}, {xpos + 32, ypos + 32}}) player.force.chart(s, {{xpos - 32, ypos - 32}, {xpos + 32, ypos + 32}})
render_crosshair({position = {x = xpos, y = ypos}, player = player})
render_radius({position = {x = xpos, y = ypos}, player = player, radius = radius})
set_timeout_in_ticks(60, map_chart_tag_place_callback, {player = player, xpos = xpos, ypos = ypos}) set_timeout_in_ticks(60, map_chart_tag_place_callback, {player = player, xpos = xpos, ypos = ypos})
end end