mirror of
https://github.com/ComfyFactory/ComfyFactorio.git
synced 2025-01-14 02:34:09 +02:00
Entity: remove filter-inserter
This commit is contained in:
parent
52c6c60a60
commit
e937f1ba83
@ -451,7 +451,6 @@ local function treasure_chest(position, distance_to_center)
|
||||
evolution_max = 0.4
|
||||
},
|
||||
{ { name = 'fast-inserter', count = math.random(8, 16) }, weight = 3, evolution_min = 0.1, evolution_max = 1 },
|
||||
{ { name = 'filter-inserter', count = math.random(8, 16) }, weight = 1, evolution_min = 0.2, evolution_max = 1 },
|
||||
{
|
||||
{ name = 'bulk-inserter', count = math.random(4, 8) },
|
||||
weight = 1,
|
||||
|
@ -293,7 +293,6 @@ local function treasure_chest(position, distance_to_center)
|
||||
{ { name = 'inserter', count = math_random(8, 16) }, weight = 3, evolution_min = 0.0, evolution_max = 0.4 },
|
||||
{ { name = 'long-handed-inserter', count = math_random(8, 16) }, weight = 3, evolution_min = 0.0, evolution_max = 0.4 },
|
||||
{ { name = 'fast-inserter', count = math_random(8, 16) }, weight = 3, evolution_min = 0.1, evolution_max = 1 },
|
||||
{ { name = 'filter-inserter', count = math_random(8, 16) }, weight = 1, evolution_min = 0.2, evolution_max = 1 },
|
||||
{ { name = 'bulk-inserter', count = math_random(4, 8) }, weight = 1, evolution_min = 0.4, evolution_max = 1 },
|
||||
{ { name = 'stack-inserter', count = math_random(4, 8) }, weight = 3, evolution_min = 0.3, evolution_max = 1 },
|
||||
{ { name = 'small-electric-pole', count = math_random(16, 24) }, weight = 3, evolution_min = 0.0, evolution_max = 0.3 },
|
||||
|
@ -29,7 +29,6 @@ local item_worths = {
|
||||
['inserter'] = 8,
|
||||
['long-handed-inserter'] = 16,
|
||||
['fast-inserter'] = 32,
|
||||
['filter-inserter'] = 40,
|
||||
['stack-inserter'] = 128,
|
||||
['bulk-inserter'] = 160,
|
||||
['small-electric-pole'] = 4,
|
||||
|
@ -60,7 +60,6 @@ local function create_shipwreck(surface, position)
|
||||
{ { name = 'inserter', count = math_random(4, 8) }, weight = 3, evolution_min = 0.0, evolution_max = 0.4 },
|
||||
{ { name = 'long-handed-inserter', count = math_random(4, 8) }, weight = 3, evolution_min = 0.0, evolution_max = 0.4 },
|
||||
{ { name = 'fast-inserter', count = math_random(4, 8) }, weight = 3, evolution_min = 0.1, evolution_max = 1 },
|
||||
{ { name = 'filter-inserter', count = math_random(4, 8) }, weight = 1, evolution_min = 0.2, evolution_max = 1 },
|
||||
{ { name = 'bulk-inserter', count = math_random(2, 4) }, weight = 1, evolution_min = 0.4, evolution_max = 1 },
|
||||
{ { name = 'stack-inserter', count = math_random(2, 4) }, weight = 3, evolution_min = 0.3, evolution_max = 1 },
|
||||
{ { name = 'small-electric-pole', count = math_random(8, 16) }, weight = 3, evolution_min = 0.0, evolution_max = 0.3 },
|
||||
|
@ -150,7 +150,6 @@ local function create_shipwreck(surface, position)
|
||||
{ { name = 'inserter', count = math_random(4, 8) }, weight = 3, evolution_min = 0.0, evolution_max = 0.4 },
|
||||
{ { name = 'long-handed-inserter', count = math_random(4, 8) }, weight = 3, evolution_min = 0.0, evolution_max = 0.4 },
|
||||
{ { name = 'fast-inserter', count = math_random(4, 8) }, weight = 3, evolution_min = 0.1, evolution_max = 1 },
|
||||
{ { name = 'filter-inserter', count = math_random(4, 8) }, weight = 1, evolution_min = 0.2, evolution_max = 1 },
|
||||
{ { name = 'bulk-inserter', count = math_random(2, 4) }, weight = 1, evolution_min = 0.4, evolution_max = 1 },
|
||||
{ { name = 'stack-inserter', count = math_random(2, 4) }, weight = 3, evolution_min = 0.3, evolution_max = 1 },
|
||||
{ { name = 'small-electric-pole', count = math_random(8, 16) }, weight = 3, evolution_min = 0.0, evolution_max = 0.3 },
|
||||
|
@ -82,7 +82,6 @@ function Public.treasure_chest(surface, position, container_name)
|
||||
{ { name = 'inserter', count = math_random(8, 16) }, weight = 3, d_min = 0.0, d_max = 0.4 },
|
||||
{ { name = 'long-handed-inserter', count = math_random(8, 16) }, weight = 3, d_min = 0.0, d_max = 0.4 },
|
||||
{ { name = 'fast-inserter', count = math_random(8, 16) }, weight = 3, d_min = 0.1, d_max = 1 },
|
||||
{ { name = 'filter-inserter', count = math_random(8, 16) }, weight = 1, d_min = 0.2, d_max = 1 },
|
||||
{ { name = 'bulk-inserter', count = math_random(4, 8) }, weight = 1, d_min = 0.4, d_max = 1 },
|
||||
{ { name = 'stack-inserter', count = math_random(4, 8) }, weight = 3, d_min = 0.3, d_max = 1 },
|
||||
{ { name = 'small-electric-pole', count = math_random(16, 24) }, weight = 3, d_min = 0.0, d_max = 0.3 },
|
||||
|
@ -767,8 +767,7 @@ local function treasure_chest(position, surface)
|
||||
{ { name = 'inserter', count = math_random(8, 16) }, weight = 3, evolution_min = 0.0, evolution_max = 0.4 },
|
||||
{ { name = 'long-handed-inserter', count = math_random(8, 16) }, weight = 3, evolution_min = 0.0, evolution_max = 0.4 },
|
||||
{ { name = 'fast-inserter', count = math_random(8, 16) }, weight = 3, evolution_min = 0.1, evolution_max = 1 },
|
||||
{ { name = 'filter-inserter', count = math_random(8, 16) }, weight = 1, evolution_min = 0.2, evolution_max = 1 },
|
||||
{ { name = 'bulk-inserter', count = math_random(4, 8) }, weight = 1, evolution_min = 0.4, evolution_max = 1 },
|
||||
{ { name = 'bulk-inserter', count = math_random(4, 8) }, weight = 1, evolution_min = 0.4, evolution_max = 1 },
|
||||
{ { name = 'stack-inserter', count = math_random(4, 8) }, weight = 3, evolution_min = 0.3, evolution_max = 1 },
|
||||
{ { name = 'small-electric-pole', count = math_random(16, 32) }, weight = 3, evolution_min = 0.0, evolution_max = 0.3 },
|
||||
{ { name = 'medium-electric-pole', count = math_random(8, 16) }, weight = 3, evolution_min = 0.2, evolution_max = 1 },
|
||||
@ -1221,13 +1220,12 @@ local function on_player_joined_game(event)
|
||||
create_labyrinth_difficulty_gui(player)
|
||||
end
|
||||
|
||||
local inserter_list = { 'inserter', 'long-handed-inserter', 'burner-inserter', 'fast-inserter', 'filter-inserter', 'bulk-inserter', 'stack-inserter' }
|
||||
local inserter_list = { 'inserter', 'long-handed-inserter', 'burner-inserter', 'fast-inserter', 'bulk-inserter', 'stack-inserter' }
|
||||
local inserters = {
|
||||
['inserter'] = true,
|
||||
['long-handed-inserter'] = true,
|
||||
['burner-inserter'] = true,
|
||||
['fast-inserter'] = true,
|
||||
['filter-inserter'] = true,
|
||||
['bulk-inserter'] = true,
|
||||
['stack-inserter'] = true
|
||||
}
|
||||
|
@ -126,7 +126,6 @@ function Public.treasure_chest_old(surface, position, container_name)
|
||||
{ { name = 'inserter', count = math_random(8, 16) }, weight = 3, d_min = 0.0, d_max = 0.4 },
|
||||
{ { name = 'long-handed-inserter', count = math_random(8, 16) }, weight = 3, d_min = 0.0, d_max = 0.4 },
|
||||
{ { name = 'fast-inserter', count = math_random(8, 16) }, weight = 3, d_min = 0.1, d_max = 1 },
|
||||
{ { name = 'filter-inserter', count = math_random(8, 16) }, weight = 1, d_min = 0.2, d_max = 1 },
|
||||
{ { name = 'bulk-inserter', count = math_random(4, 8) }, weight = 1, d_min = 0.4, d_max = 1 },
|
||||
{ { name = 'stack-inserter', count = math_random(4, 8) }, weight = 3, d_min = 0.3, d_max = 1 },
|
||||
{ { name = 'small-electric-pole', count = math_random(16, 24) }, weight = 3, d_min = 0.0, d_max = 0.3 },
|
||||
|
@ -113,7 +113,6 @@ local function spawn_shipwreck(surface, position)
|
||||
{ { name = 'inserter', count = math_random(8, 16) }, weight = 3, evolution_min = 0.0, evolution_max = 0.4 },
|
||||
{ { name = 'long-handed-inserter', count = math_random(8, 16) }, weight = 3, evolution_min = 0.0, evolution_max = 0.4 },
|
||||
{ { name = 'fast-inserter', count = math_random(8, 16) }, weight = 3, evolution_min = 0.1, evolution_max = 1 },
|
||||
{ { name = 'filter-inserter', count = math_random(8, 16) }, weight = 1, evolution_min = 0.2, evolution_max = 1 },
|
||||
{ { name = 'bulk-inserter', count = math_random(4, 8) }, weight = 1, evolution_min = 0.4, evolution_max = 1 },
|
||||
{ { name = 'stack-inserter', count = math_random(4, 8) }, weight = 3, evolution_min = 0.3, evolution_max = 1 },
|
||||
{ { name = 'small-electric-pole', count = math_random(16, 32) }, weight = 3, evolution_min = 0.0, evolution_max = 0.3 },
|
||||
|
@ -745,7 +745,7 @@ Public.merchant_offer = {
|
||||
},
|
||||
offer = {
|
||||
type = 'unlock-recipe',
|
||||
recipe = 'filter-inserter'
|
||||
recipe = 'bulk-inserter'
|
||||
}
|
||||
},
|
||||
{
|
||||
|
@ -17,7 +17,6 @@ local neutral_whitelist = {
|
||||
['express-loader'] = true,
|
||||
['fast-inserter'] = true,
|
||||
['fast-loader'] = true,
|
||||
['filter-inserter'] = true,
|
||||
['inserter'] = true,
|
||||
['iron-chest'] = true,
|
||||
['loader'] = true,
|
||||
|
@ -275,7 +275,7 @@ local function is_loader(entity)
|
||||
end
|
||||
|
||||
local function is_filtered_inserter(entity)
|
||||
return entity.name == 'filter-inserter' or entity.name == 'bulk-inserter'
|
||||
return entity.name == 'fast-inserter' or entity.name == 'bulk-inserter'
|
||||
end
|
||||
|
||||
local function max_stack_size(entity)
|
||||
@ -308,7 +308,6 @@ local function get_connected_entities(market)
|
||||
'inserter',
|
||||
'long-handed-inserter',
|
||||
'fast-inserter',
|
||||
'filter-inserter',
|
||||
'stack-inserter',
|
||||
'bulk-inserter',
|
||||
'loader',
|
||||
|
@ -82,7 +82,6 @@ local function treasure_chest(position, surface)
|
||||
{ { name = 'inserter', count = math_random(16, 32) }, weight = 3, evolution_min = 0.0, evolution_max = 0.4 },
|
||||
{ { name = 'long-handed-inserter', count = math_random(16, 32) }, weight = 3, evolution_min = 0.0, evolution_max = 0.4 },
|
||||
{ { name = 'fast-inserter', count = math_random(16, 32) }, weight = 3, evolution_min = 0.1, evolution_max = 1 },
|
||||
{ { name = 'filter-inserter', count = math_random(16, 32) }, weight = 1, evolution_min = 0.2, evolution_max = 1 },
|
||||
{ { name = 'bulk-inserter', count = math_random(4, 8) }, weight = 1, evolution_min = 0.4, evolution_max = 1 },
|
||||
{ { name = 'stack-inserter', count = math_random(4, 8) }, weight = 3, evolution_min = 0.3, evolution_max = 1 },
|
||||
{ { name = 'small-electric-pole', count = math_random(8, 16) }, weight = 3, evolution_min = 0.0, evolution_max = 0.3 },
|
||||
|
@ -151,7 +151,6 @@ function get_loot_item_stack()
|
||||
{ { name = 'inserter', count = math_random(8, 16) }, weight = 3, evolution_min = 0.0, evolution_max = 0.4 },
|
||||
{ { name = 'long-handed-inserter', count = math_random(8, 16) }, weight = 3, evolution_min = 0.0, evolution_max = 0.4 },
|
||||
{ { name = 'fast-inserter', count = math_random(8, 16) }, weight = 3, evolution_min = 0.1, evolution_max = 1 },
|
||||
{ { name = 'filter-inserter', count = math_random(8, 16) }, weight = 1, evolution_min = 0.2, evolution_max = 1 },
|
||||
{ { name = 'bulk-inserter', count = math_random(4, 8) }, weight = 1, evolution_min = 0.4, evolution_max = 1 },
|
||||
{ { name = 'stack-inserter', count = math_random(4, 8) }, weight = 3, evolution_min = 0.3, evolution_max = 1 },
|
||||
{ { name = 'small-electric-pole', count = math_random(16, 32) }, weight = 3, evolution_min = 0.0, evolution_max = 0.3 },
|
||||
|
@ -25,7 +25,6 @@ local item_worths = {
|
||||
['inserter'] = 4,
|
||||
['long-handed-inserter'] = 8,
|
||||
['fast-inserter'] = 16,
|
||||
['filter-inserter'] = 32,
|
||||
['stack-inserter'] = 128,
|
||||
['bulk-inserter'] = 160,
|
||||
['small-electric-pole'] = 2,
|
||||
|
@ -8,7 +8,7 @@ local Token = require 'utils.token'
|
||||
local Alert = require 'utils.alert'
|
||||
local Math2D = require 'math2d'
|
||||
|
||||
local level_up_floating_text_color = {0, 205, 0}
|
||||
local level_up_floating_text_color = { 0, 205, 0 }
|
||||
local visuals_delay = Public.visuals_delay
|
||||
local xp_floating_text_color = Public.xp_floating_text_color
|
||||
local experience_levels = Public.experience_levels
|
||||
@ -47,44 +47,44 @@ local travelings = {
|
||||
|
||||
local restore_crafting_boost_token =
|
||||
Token.register(
|
||||
function(event)
|
||||
local player_index = event.player_index
|
||||
local player = game.get_player(player_index)
|
||||
if not player or not player.valid then
|
||||
return
|
||||
end
|
||||
function (event)
|
||||
local player_index = event.player_index
|
||||
local player = game.get_player(player_index)
|
||||
if not player or not player.valid then
|
||||
return
|
||||
end
|
||||
|
||||
Public.restore_crafting_boost(player)
|
||||
end
|
||||
)
|
||||
Public.restore_crafting_boost(player)
|
||||
end
|
||||
)
|
||||
|
||||
local desync =
|
||||
Token.register(
|
||||
function(data)
|
||||
local entity = data.entity
|
||||
if not entity or not entity.valid then
|
||||
return
|
||||
function (data)
|
||||
local entity = data.entity
|
||||
if not entity or not entity.valid then
|
||||
return
|
||||
end
|
||||
local surface = data.surface
|
||||
local fake_shooter = surface.create_entity({ name = 'character', position = entity.position, force = 'enemy' })
|
||||
for _ = 1, 3 do
|
||||
surface.create_entity(
|
||||
{
|
||||
name = 'explosive-rocket',
|
||||
position = entity.position,
|
||||
force = 'enemy',
|
||||
speed = 1,
|
||||
max_range = 1,
|
||||
target = entity,
|
||||
source = fake_shooter
|
||||
}
|
||||
)
|
||||
end
|
||||
if fake_shooter and fake_shooter.valid then
|
||||
fake_shooter.destroy()
|
||||
end
|
||||
end
|
||||
local surface = data.surface
|
||||
local fake_shooter = surface.create_entity({name = 'character', position = entity.position, force = 'enemy'})
|
||||
for _ = 1, 3 do
|
||||
surface.create_entity(
|
||||
{
|
||||
name = 'explosive-rocket',
|
||||
position = entity.position,
|
||||
force = 'enemy',
|
||||
speed = 1,
|
||||
max_range = 1,
|
||||
target = entity,
|
||||
source = fake_shooter
|
||||
}
|
||||
)
|
||||
end
|
||||
if fake_shooter and fake_shooter.valid then
|
||||
fake_shooter.destroy()
|
||||
end
|
||||
end
|
||||
)
|
||||
)
|
||||
|
||||
local function create_healthbar(player, size)
|
||||
return rendering.draw_sprite(
|
||||
@ -95,7 +95,7 @@ local function create_healthbar(player, size)
|
||||
y_scale = size - 0.2,
|
||||
render_layer = 'light-effect',
|
||||
target = player.character,
|
||||
target_offset = {0, -2.5},
|
||||
target_offset = { 0, -2.5 },
|
||||
surface = player.surface
|
||||
}
|
||||
)
|
||||
@ -110,7 +110,7 @@ local function create_manabar(player, size)
|
||||
y_scale = size - 0.2,
|
||||
render_layer = 'light-effect',
|
||||
target = player.character,
|
||||
target_offset = {0, -2.0},
|
||||
target_offset = { 0, -2.0 },
|
||||
surface = player.surface
|
||||
}
|
||||
)
|
||||
@ -124,7 +124,7 @@ local function set_bar(min, max, id, mana)
|
||||
local x_scale = rendering.get_y_scale(id) * 8
|
||||
rendering.set_x_scale(id, x_scale * m)
|
||||
if not mana then
|
||||
rendering.set_color(id, {math.floor(255 - 255 * m), math.floor(200 * m), 0})
|
||||
rendering.set_color(id, { math.floor(255 - 255 * m), math.floor(200 * m), 0 })
|
||||
end
|
||||
end
|
||||
|
||||
@ -292,31 +292,31 @@ end
|
||||
|
||||
local repair_buildings =
|
||||
Token.register(
|
||||
function(data)
|
||||
local entity = data.entity
|
||||
if entity and entity.valid then
|
||||
local rng = 0.1
|
||||
if random(1, 5) == 1 then
|
||||
rng = 0.2
|
||||
elseif random(1, 8) == 1 then
|
||||
rng = 0.4
|
||||
end
|
||||
local to_heal = entity.prototype.max_health * rng
|
||||
if entity.health and to_heal then
|
||||
entity.health = entity.health + to_heal
|
||||
function (data)
|
||||
local entity = data.entity
|
||||
if entity and entity.valid then
|
||||
local rng = 0.1
|
||||
if random(1, 5) == 1 then
|
||||
rng = 0.2
|
||||
elseif random(1, 8) == 1 then
|
||||
rng = 0.4
|
||||
end
|
||||
local to_heal = entity.prototype.max_health * rng
|
||||
if entity.health and to_heal then
|
||||
entity.health = entity.health + to_heal
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
)
|
||||
)
|
||||
|
||||
function Public.repair_aoe(player, position)
|
||||
local entities = player.surface.find_entities_filtered {force = player.force, area = {{position.x - 8, position.y - 8}, {position.x + 8, position.y + 8}}}
|
||||
local entities = player.surface.find_entities_filtered { force = player.force, area = { { position.x - 8, position.y - 8 }, { position.x + 8, position.y + 8 } } }
|
||||
local count = 0
|
||||
for i = 1, #entities do
|
||||
local e = entities[i]
|
||||
if e.prototype.max_health ~= e.health then
|
||||
count = count + 1
|
||||
Task.set_timeout_in_ticks(10, repair_buildings, {entity = e})
|
||||
Task.set_timeout_in_ticks(10, repair_buildings, { entity = e })
|
||||
end
|
||||
end
|
||||
return count
|
||||
@ -324,26 +324,27 @@ end
|
||||
|
||||
function Public.suicidal_comfylatron(pos, surface)
|
||||
local str = travelings[random(1, #travelings)]
|
||||
local symbols = {'', '!', '!', '!!', '..'}
|
||||
local symbols = { '', '!', '!', '!!', '..' }
|
||||
str = str .. symbols[random(1, #symbols)]
|
||||
local text = str
|
||||
local e =
|
||||
surface.create_entity(
|
||||
{
|
||||
name = 'compilatron',
|
||||
position = {x = pos.x, y = pos.y + 2},
|
||||
force = 'neutral'
|
||||
}
|
||||
)
|
||||
{
|
||||
name = 'compilatron',
|
||||
position = { x = pos.x, y = pos.y + 2 },
|
||||
force = 'neutral'
|
||||
}
|
||||
)
|
||||
surface.create_entity(
|
||||
{
|
||||
name = 'compi-speech-bubble',
|
||||
position = e.position,
|
||||
source = e,
|
||||
text = text
|
||||
text = text,
|
||||
lifetime = 30
|
||||
}
|
||||
)
|
||||
local nearest_player_unit = surface.find_nearest_enemy({position = e.position, max_distance = 512, force = 'player'})
|
||||
local nearest_player_unit = surface.find_nearest_enemy({ position = e.position, max_distance = 512, force = 'player' })
|
||||
|
||||
if nearest_player_unit and nearest_player_unit.active and nearest_player_unit.force.name ~= 'player' then
|
||||
e.set_command(
|
||||
@ -359,13 +360,14 @@ function Public.suicidal_comfylatron(pos, surface)
|
||||
}
|
||||
Task.set_timeout_in_ticks(600, desync, data)
|
||||
else
|
||||
e.surface.create_entity({name = 'medium-explosion', position = e.position})
|
||||
e.surface.create_entity({ name = 'medium-explosion', position = e.position })
|
||||
e.surface.create_entity(
|
||||
{
|
||||
name = 'flying-text',
|
||||
name = 'compi-speech-bubble',
|
||||
position = e.position,
|
||||
text = 'DeSyyNC - no target found!',
|
||||
color = {r = 150, g = 0, b = 0}
|
||||
source = e,
|
||||
lifetime = 30
|
||||
}
|
||||
)
|
||||
e.die()
|
||||
@ -428,8 +430,8 @@ function Public.get_last_spell_cast(player)
|
||||
local position = player.position
|
||||
local cast_radius = 1
|
||||
local cast_area = {
|
||||
left_top = {x = rpg_t.last_spell_cast.x - cast_radius, y = rpg_t.last_spell_cast.y - cast_radius},
|
||||
right_bottom = {x = rpg_t.last_spell_cast.x + cast_radius, y = rpg_t.last_spell_cast.y + cast_radius}
|
||||
left_top = { x = rpg_t.last_spell_cast.x - cast_radius, y = rpg_t.last_spell_cast.y - cast_radius },
|
||||
right_bottom = { x = rpg_t.last_spell_cast.x + cast_radius, y = rpg_t.last_spell_cast.y + cast_radius }
|
||||
}
|
||||
|
||||
if rpg_t.last_spell_cast then
|
||||
@ -669,13 +671,13 @@ function Public.aoe_punch(cause, entity, damage, final_damage_amount)
|
||||
|
||||
local get_health_pool = has_health_boost(entity, damage, final_damage_amount, cause)
|
||||
|
||||
local base_vector = {ent_position.x - cause.position.x, ent_position.y - cause.position.y}
|
||||
local base_vector = { ent_position.x - cause.position.x, ent_position.y - cause.position.y }
|
||||
|
||||
local vector = {base_vector[1], base_vector[2]}
|
||||
local vector = { base_vector[1], base_vector[2] }
|
||||
vector[1] = vector[1] * 1000
|
||||
vector[2] = vector[2] * 1000
|
||||
|
||||
cause.surface.create_entity({name = 'blood-explosion-huge', position = ent_position})
|
||||
cause.surface.create_entity({ name = 'blood-explosion-huge', position = ent_position })
|
||||
|
||||
if abs(vector[1]) > abs(vector[2]) then
|
||||
local d = abs(vector[1])
|
||||
@ -706,9 +708,9 @@ function Public.aoe_punch(cause, entity, damage, final_damage_amount)
|
||||
for i = 1, 16, 1 do
|
||||
for x = i * -1 * a, i * a, 1 do
|
||||
for y = i * -1 * a, i * a, 1 do
|
||||
local p = {cp.x + x + vector[1] * i, cp.y + y + vector[2] * i}
|
||||
cs.create_trivial_smoke({name = 'train-smoke', position = p})
|
||||
for _, e in pairs(cs.find_entities({{p[1] - a, p[2] - a}, {p[1] + a, p[2] + a}})) do
|
||||
local p = { cp.x + x + vector[1] * i, cp.y + y + vector[2] * i }
|
||||
cs.create_trivial_smoke({ name = 'train-smoke', position = p })
|
||||
for _, e in pairs(cs.find_entities({ { p[1] - a, p[2] - a }, { p[1] + a, p[2] + a } })) do
|
||||
if e.valid then
|
||||
if e.health then
|
||||
if e.destructible and e.minable and e.force.index ~= 3 then
|
||||
@ -751,7 +753,7 @@ function Public.add_tidal_wave(cause, ent_position, shape, length, max_spread)
|
||||
local wave = {
|
||||
cause = cause,
|
||||
start_position = cause.position,
|
||||
direction = {ent_position.x - cause.position.x, ent_position.y - cause.position.y},
|
||||
direction = { ent_position.x - cause.position.x, ent_position.y - cause.position.y },
|
||||
length = length or 18,
|
||||
base_spread = 0.5,
|
||||
max_spread = max_spread or 4,
|
||||
@ -759,7 +761,7 @@ function Public.add_tidal_wave(cause, ent_position, shape, length, max_spread)
|
||||
tick = 0
|
||||
}
|
||||
local vector_length = math.sqrt(wave.direction[1] ^ 2 + wave.direction[2] ^ 2)
|
||||
wave.direction = {wave.direction[1] / vector_length, wave.direction[2] / vector_length}
|
||||
wave.direction = { wave.direction[1] / vector_length, wave.direction[2] / vector_length }
|
||||
|
||||
rpg_extra.tidal_waves = rpg_extra.tidal_waves or {}
|
||||
rpg_extra.tidal_waves[#rpg_extra.tidal_waves + 1] = wave
|
||||
@ -797,18 +799,18 @@ function Public.update_tidal_wave()
|
||||
for j = -wave.max_spread, wave.max_spread do
|
||||
local offset_x = cause_position.x + wave.direction[1] * i + j * wave.direction[2]
|
||||
local offset_y = cause_position.y + wave.direction[2] * i - j * wave.direction[1]
|
||||
local position = {offset_x, offset_y}
|
||||
local position = { offset_x, offset_y }
|
||||
|
||||
local next_offset_x = cause_position.x + wave.direction[1] * (i + 1) + j * wave.direction[2]
|
||||
local next_offset_y = cause_position.y + wave.direction[2] * (i + 1) - j * wave.direction[1]
|
||||
local next_position = {next_offset_x, next_offset_y}
|
||||
local next_position = { next_offset_x, next_offset_y }
|
||||
|
||||
surface.create_entity({name = 'water-splash', position = position})
|
||||
surface.create_entity({ name = 'water-splash', position = position })
|
||||
-- surface.create_trivial_smoke({name = 'poison-capsule-smoke', position = position})
|
||||
local sound = 'utility/build_small'
|
||||
wave_player.play_sound {path = sound, volume_modifier = 1}
|
||||
wave_player.play_sound { path = sound, volume_modifier = 1 }
|
||||
|
||||
for _, entity in pairs(surface.find_entities({{position[1] - 1, position[2] - 1}, {position[1] + 1, position[2] + 1}})) do
|
||||
for _, entity in pairs(surface.find_entities({ { position[1] - 1, position[2] - 1 }, { position[1] + 1, position[2] + 1 } })) do
|
||||
if entity.valid and entity.name ~= 'character' and entity.destructible and entity.type == 'unit' and entity.force.index ~= 3 then
|
||||
local new_pos = surface.find_non_colliding_position('character', next_position, 3, 0.5)
|
||||
if new_pos then
|
||||
@ -821,17 +823,17 @@ function Public.update_tidal_wave()
|
||||
for j = -current_spread, current_spread, wave.base_spread do
|
||||
local offset_x = cause_position.x + wave.direction[1] * i + j * wave.direction[2]
|
||||
local offset_y = cause_position.y + wave.direction[2] * i - j * wave.direction[1]
|
||||
local position = {offset_x, offset_y}
|
||||
local position = { offset_x, offset_y }
|
||||
|
||||
local next_offset_x = cause_position.x + wave.direction[1] * (i + 1) + j * wave.direction[2]
|
||||
local next_offset_y = cause_position.y + wave.direction[2] * (i + 1) - j * wave.direction[1]
|
||||
local next_position = {next_offset_x, next_offset_y}
|
||||
local next_position = { next_offset_x, next_offset_y }
|
||||
-- surface.create_trivial_smoke({name = 'poison-capsule-smoke', position = position})
|
||||
surface.create_entity({name = 'water-splash', position = position})
|
||||
surface.create_entity({ name = 'water-splash', position = position })
|
||||
local sound = 'utility/build_small'
|
||||
wave_player.play_sound {path = sound, volume_modifier = 1}
|
||||
wave_player.play_sound { path = sound, volume_modifier = 1 }
|
||||
|
||||
for _, entity in pairs(surface.find_entities({{position[1] - 1, position[2] - 1}, {position[1] + 1, position[2] + 1}})) do
|
||||
for _, entity in pairs(surface.find_entities({ { position[1] - 1, position[2] - 1 }, { position[1] + 1, position[2] + 1 } })) do
|
||||
if entity.valid and entity.name ~= 'character' and entity.destructible and entity.type == 'unit' and entity.force.index ~= 3 then
|
||||
local new_pos = surface.find_non_colliding_position('character', next_position, 3, 0.5)
|
||||
if new_pos then
|
||||
@ -914,21 +916,37 @@ function Public.update_player_stats(player)
|
||||
end
|
||||
|
||||
function Public.level_up_effects(player)
|
||||
local position = {x = player.position.x - 0.75, y = player.position.y - 1}
|
||||
player.surface.create_entity({name = 'flying-text', position = position, text = '+LVL ', color = level_up_floating_text_color})
|
||||
local position = { x = player.position.x - 0.75, y = player.position.y - 1 }
|
||||
player.create_local_flying_text(
|
||||
{
|
||||
position = position,
|
||||
text = '+LVL',
|
||||
color = level_up_floating_text_color,
|
||||
time_to_live = 300,
|
||||
speed = 100
|
||||
}
|
||||
)
|
||||
local b = 0.75
|
||||
for _ = 1, 5, 1 do
|
||||
local p = {
|
||||
(position.x + 0.4) + (b * -1 + random(0, b * 20) * 0.1),
|
||||
position.y + (b * -1 + random(0, b * 20) * 0.1)
|
||||
}
|
||||
player.surface.create_entity({name = 'flying-text', position = p, text = '✚', color = {255, random(0, 100), 0}})
|
||||
player.create_local_flying_text(
|
||||
{
|
||||
position = p,
|
||||
text = '✚',
|
||||
color = { 255, random(0, 100), 0 },
|
||||
time_to_live = 300,
|
||||
speed = 100
|
||||
}
|
||||
)
|
||||
end
|
||||
player.play_sound {path = 'utility/achievement_unlocked', volume_modifier = 0.50}
|
||||
player.play_sound { path = 'utility/achievement_unlocked', volume_modifier = 0.50 }
|
||||
end
|
||||
|
||||
function Public.cast_spell(player, failed)
|
||||
local position = {x = player.position.x - 0.75, y = player.position.y - 1}
|
||||
local position = { x = player.position.x - 0.75, y = player.position.y - 1 }
|
||||
local b = 0.75
|
||||
if not failed then
|
||||
for _ = 1, 3, 1 do
|
||||
@ -936,44 +954,84 @@ function Public.cast_spell(player, failed)
|
||||
(position.x + 0.4) + (b * -1 + random(0, b * 20) * 0.1),
|
||||
position.y + (b * -1 + random(0, b * 20) * 0.1)
|
||||
}
|
||||
player.surface.create_entity({name = 'flying-text', position = p, text = '✔️', color = {255, random(0, 100), 0}})
|
||||
player.create_local_flying_text(
|
||||
{
|
||||
position = p,
|
||||
text = '✔️',
|
||||
color = { 255, random(0, 100), 0 },
|
||||
time_to_live = 300,
|
||||
speed = 100
|
||||
}
|
||||
)
|
||||
end
|
||||
player.play_sound {path = 'utility/scenario_message', volume_modifier = 1}
|
||||
player.play_sound { path = 'utility/scenario_message', volume_modifier = 1 }
|
||||
else
|
||||
for _ = 1, 3, 1 do
|
||||
local p = {
|
||||
(position.x + 0.4) + (b * -1 + random(0, b * 20) * 0.1),
|
||||
position.y + (b * -1 + random(0, b * 20) * 0.1)
|
||||
}
|
||||
player.surface.create_entity({name = 'flying-text', position = p, text = '✖', color = {255, random(0, 100), 0}})
|
||||
player.create_local_flying_text(
|
||||
{
|
||||
position = p,
|
||||
text = '✖',
|
||||
color = { 255, random(0, 100), 0 },
|
||||
time_to_live = 300,
|
||||
speed = 100
|
||||
}
|
||||
)
|
||||
end
|
||||
player.play_sound {path = 'utility/cannot_build', volume_modifier = 1}
|
||||
player.play_sound { path = 'utility/cannot_build', volume_modifier = 1 }
|
||||
end
|
||||
end
|
||||
|
||||
function Public.xp_effects(player)
|
||||
local position = {x = player.position.x - 0.75, y = player.position.y - 1}
|
||||
player.surface.create_entity({name = 'flying-text', position = position, text = '+XP', color = level_up_floating_text_color})
|
||||
local position = { x = player.position.x - 0.75, y = player.position.y - 1 }
|
||||
player.create_local_flying_text(
|
||||
{
|
||||
position = position,
|
||||
text = '+XP',
|
||||
color = level_up_floating_text_color,
|
||||
time_to_live = 300,
|
||||
speed = 100
|
||||
}
|
||||
)
|
||||
local b = 0.75
|
||||
for _ = 1, 5, 1 do
|
||||
local p = {
|
||||
(position.x + 0.4) + (b * -1 + random(0, b * 20) * 0.1),
|
||||
position.y + (b * -1 + random(0, b * 20) * 0.1)
|
||||
}
|
||||
player.surface.create_entity({name = 'flying-text', position = p, text = '✚', color = {255, random(0, 100), 0}})
|
||||
player.create_local_flying_text(
|
||||
{
|
||||
position = p,
|
||||
text = '✚',
|
||||
color = { 255, random(0, 100), 0 },
|
||||
time_to_live = 300,
|
||||
speed = 100
|
||||
}
|
||||
)
|
||||
end
|
||||
player.play_sound {path = 'utility/achievement_unlocked', volume_modifier = 0.50}
|
||||
player.play_sound { path = 'utility/achievement_unlocked', volume_modifier = 0.50 }
|
||||
end
|
||||
|
||||
function Public.boost_effects(player)
|
||||
local position = {x = player.position.x - 0.75, y = player.position.y - 1}
|
||||
local position = { x = player.position.x - 0.75, y = player.position.y - 1 }
|
||||
local b = 0.75
|
||||
for _ = 1, 10, 1 do
|
||||
local p = {
|
||||
(position.x + 0.4) + (b * -1 + random(0, b * 20) * 0.1),
|
||||
position.y + (b * -1 + random(0, b * 20) * 0.1)
|
||||
}
|
||||
player.surface.create_entity({name = 'flying-text', position = p, text = '♻️', color = {random(0, 100), random(0, 100), 0}})
|
||||
player.create_local_flying_text(
|
||||
{
|
||||
position = p,
|
||||
text = '♻️',
|
||||
color = { random(0, 100), random(0, 100), 0 },
|
||||
time_to_live = 300,
|
||||
speed = 100
|
||||
}
|
||||
)
|
||||
end
|
||||
end
|
||||
|
||||
@ -994,7 +1052,7 @@ function Public.set_crafting_boost(player, get_dex_modifier)
|
||||
rpg_t.old_character_crafting_speed_modifier = player.character_crafting_speed_modifier
|
||||
Modifiers.update_single_modifier(player, 'character_crafting_speed_modifier', 'crafting_boost', rpg_t.crafting_boost)
|
||||
Modifiers.update_player_modifiers(player)
|
||||
Task.set_timeout_in_ticks(bonus_length, restore_crafting_boost_token, {player_index = player.index})
|
||||
Task.set_timeout_in_ticks(bonus_length, restore_crafting_boost_token, { player_index = player.index })
|
||||
end
|
||||
|
||||
function Public.increment_duped_crafted_items(player)
|
||||
@ -1131,18 +1189,19 @@ function Public.get_heal_modifier_from_using_fish(player)
|
||||
local health = player.character_health_bonus + 250
|
||||
local color
|
||||
if char.health > (health * 0.50) then
|
||||
color = {b = 0.2, r = 0.1, g = 1, a = 0.8}
|
||||
color = { b = 0.2, r = 0.1, g = 1, a = 0.8 }
|
||||
elseif char.health > (health * 0.25) then
|
||||
color = {r = 1, g = 1, b = 0}
|
||||
color = { r = 1, g = 1, b = 0 }
|
||||
else
|
||||
color = {b = 0.1, r = 1, g = 0, a = 0.8}
|
||||
color = { b = 0.1, r = 1, g = 0, a = 0.8 }
|
||||
end
|
||||
player.surface.create_entity(
|
||||
player.create_local_flying_text(
|
||||
{
|
||||
name = 'flying-text',
|
||||
position = {position.x, position.y + 0.6},
|
||||
position = { position.x, position.y + 0.6 },
|
||||
text = '+' .. rng,
|
||||
color = color
|
||||
color = color,
|
||||
time_to_live = 300,
|
||||
speed = 100
|
||||
}
|
||||
)
|
||||
char.health = char.health + rng
|
||||
@ -1249,88 +1308,88 @@ end
|
||||
local show_cooldown_progressbar
|
||||
show_cooldown_progressbar =
|
||||
Token.register(
|
||||
function(event)
|
||||
local player_index = event.player_index
|
||||
local player = game.get_player(player_index)
|
||||
if not player or not player.valid then
|
||||
return
|
||||
end
|
||||
|
||||
local tick = event.tick
|
||||
local now = game.tick
|
||||
|
||||
local element = Public.get_cooldown_progressbar_for_player(player)
|
||||
if not element or not element.valid then
|
||||
if now >= tick then
|
||||
function (event)
|
||||
local player_index = event.player_index
|
||||
local player = game.get_player(player_index)
|
||||
if not player or not player.valid then
|
||||
return
|
||||
else
|
||||
Task.set_timeout_in_ticks(update_rate_progressbar, show_cooldown_progressbar, event)
|
||||
end
|
||||
return
|
||||
end
|
||||
|
||||
if now >= tick then
|
||||
element.value = 0
|
||||
return
|
||||
end
|
||||
local tick = event.tick
|
||||
local now = game.tick
|
||||
|
||||
local rpg_t = Public.get_value_from_player(player.index)
|
||||
local element = Public.get_cooldown_progressbar_for_player(player)
|
||||
if not element or not element.valid then
|
||||
if now >= tick then
|
||||
return
|
||||
else
|
||||
Task.set_timeout_in_ticks(update_rate_progressbar, show_cooldown_progressbar, event)
|
||||
end
|
||||
return
|
||||
end
|
||||
|
||||
if now >= tick then
|
||||
element.value = 0
|
||||
return
|
||||
end
|
||||
|
||||
local rpg_t = Public.get_value_from_player(player.index)
|
||||
|
||||
local active_spell = Public.get_spell_by_name(rpg_t, rpg_t.dropdown_select_name)
|
||||
if event.name ~= active_spell.entityName then
|
||||
Task.set_timeout_in_ticks(update_rate_progressbar, show_cooldown_progressbar, event)
|
||||
return
|
||||
end
|
||||
|
||||
local fade = ((tick - now) / event.delay)
|
||||
element.value = fade
|
||||
|
||||
local active_spell = Public.get_spell_by_name(rpg_t, rpg_t.dropdown_select_name)
|
||||
if event.name ~= active_spell.entityName then
|
||||
Task.set_timeout_in_ticks(update_rate_progressbar, show_cooldown_progressbar, event)
|
||||
return
|
||||
end
|
||||
|
||||
local fade = ((tick - now) / event.delay)
|
||||
element.value = fade
|
||||
|
||||
Task.set_timeout_in_ticks(update_rate_progressbar, show_cooldown_progressbar, event)
|
||||
end
|
||||
)
|
||||
)
|
||||
Public.show_cooldown_progressbar = show_cooldown_progressbar
|
||||
|
||||
local show_cooldown
|
||||
show_cooldown =
|
||||
Token.register(
|
||||
function(event)
|
||||
local player_index = event.player_index
|
||||
local player = game.get_player(player_index)
|
||||
if not player or not player.valid then
|
||||
return
|
||||
function (event)
|
||||
local player_index = event.player_index
|
||||
local player = game.get_player(player_index)
|
||||
if not player or not player.valid then
|
||||
return
|
||||
end
|
||||
|
||||
local tick = event.tick
|
||||
local now = game.tick
|
||||
if now >= tick then
|
||||
local rpg_t = Public.get_value_from_player(player.index)
|
||||
rpg_t.cooldown_enabled = nil
|
||||
return
|
||||
end
|
||||
|
||||
local fade = ((now - tick) / event.delay) + 1
|
||||
|
||||
if not player.character then
|
||||
return
|
||||
end
|
||||
|
||||
draw_arc(
|
||||
{
|
||||
color = { 1 - fade, fade, 0 },
|
||||
max_radius = 0.5,
|
||||
min_radius = 0.4,
|
||||
start_angle = start_angle,
|
||||
angle = fade * angle_multipler,
|
||||
target = player.character,
|
||||
target_offset = { x = 0, y = -2 },
|
||||
surface = player.surface,
|
||||
time_to_live = time_to_live
|
||||
}
|
||||
)
|
||||
|
||||
Task.set_timeout_in_ticks(update_rate, show_cooldown, event)
|
||||
end
|
||||
|
||||
local tick = event.tick
|
||||
local now = game.tick
|
||||
if now >= tick then
|
||||
local rpg_t = Public.get_value_from_player(player.index)
|
||||
rpg_t.cooldown_enabled = nil
|
||||
return
|
||||
end
|
||||
|
||||
local fade = ((now - tick) / event.delay) + 1
|
||||
|
||||
if not player.character then
|
||||
return
|
||||
end
|
||||
|
||||
draw_arc(
|
||||
{
|
||||
color = {1 - fade, fade, 0},
|
||||
max_radius = 0.5,
|
||||
min_radius = 0.4,
|
||||
start_angle = start_angle,
|
||||
angle = fade * angle_multipler,
|
||||
target = player.character,
|
||||
target_offset = {x = 0, y = -2},
|
||||
surface = player.surface,
|
||||
time_to_live = time_to_live
|
||||
}
|
||||
)
|
||||
|
||||
Task.set_timeout_in_ticks(update_rate, show_cooldown, event)
|
||||
end
|
||||
)
|
||||
)
|
||||
Public.show_cooldown = show_cooldown
|
||||
|
||||
function Public.register_cooldown_for_player(player, spell)
|
||||
@ -1342,11 +1401,11 @@ function Public.register_cooldown_for_player(player, spell)
|
||||
if not rpg_t.cooldown_enabled then
|
||||
rpg_t.cooldown_enabled = true
|
||||
end
|
||||
Task.set_timeout_in_ticks(update_rate, show_cooldown, {player_index = player.index, tick = game.tick + spell.cooldown, delay = spell.cooldown})
|
||||
Task.set_timeout_in_ticks(update_rate, show_cooldown, { player_index = player.index, tick = game.tick + spell.cooldown, delay = spell.cooldown })
|
||||
end
|
||||
|
||||
function Public.register_cooldown_for_player_progressbar(player, spell)
|
||||
Task.set_timeout_in_ticks(update_rate, show_cooldown_progressbar, {player_index = player.index, tick = game.tick + spell.cooldown, delay = spell.cooldown, name = spell.entityName})
|
||||
Task.set_timeout_in_ticks(update_rate, show_cooldown_progressbar, { player_index = player.index, tick = game.tick + spell.cooldown, delay = spell.cooldown, name = spell.entityName })
|
||||
end
|
||||
|
||||
--- Gives connected player some bonus xp if the map was preemptively shut down.
|
||||
@ -1393,7 +1452,7 @@ end
|
||||
|
||||
function Public.rpg_reset_player(player, one_time_reset)
|
||||
if not player.character then
|
||||
player.set_controller({type = defines.controllers.god})
|
||||
player.set_controller({ type = defines.controllers.god })
|
||||
player.create_character()
|
||||
end
|
||||
local rpg_t = Public.get_value_from_player(player.index)
|
||||
@ -1412,99 +1471,99 @@ function Public.rpg_reset_player(player, one_time_reset)
|
||||
local old_xp = rpg_t.xp
|
||||
rpg_t =
|
||||
Public.set_new_player_tbl(
|
||||
player.index,
|
||||
{
|
||||
level = 1,
|
||||
xp = 0,
|
||||
strength = 10,
|
||||
magicka = 10,
|
||||
dexterity = 10,
|
||||
vitality = 10,
|
||||
mana = 0,
|
||||
mana_max = 0,
|
||||
cooldowns = {},
|
||||
dropdown_select_index = 1,
|
||||
dropdown_select_name = Public.all_spells[1].name[1],
|
||||
dropdown_select_index_1 = 1,
|
||||
dropdown_select_name_1 = Public.all_spells[1].name[1],
|
||||
dropdown_select_index_2 = 2,
|
||||
dropdown_select_name_2 = Public.all_spells[2].name[1],
|
||||
dropdown_select_index_3 = 3,
|
||||
dropdown_select_name_3 = Public.all_spells[3].name[1],
|
||||
allocate_index = 1,
|
||||
amount = 0,
|
||||
explosive_bullets = false,
|
||||
enable_entity_spawn = false,
|
||||
health_bar = rpg_t.health_bar,
|
||||
mana_bar = rpg_t.mana_bar,
|
||||
points_left = 0,
|
||||
last_floaty_text = visuals_delay,
|
||||
xp_since_last_floaty_text = 0,
|
||||
reset = true,
|
||||
capped = false,
|
||||
bonus = rpg_extra.breached_walls or 1,
|
||||
rotated_entity_delay = 0,
|
||||
repaired_entity_delay = 0,
|
||||
last_mined_entity_position = {x = 0, y = 0},
|
||||
last_spell_cast = {x = 0, y = 0},
|
||||
show_bars = false,
|
||||
stone_path = false,
|
||||
aoe_punch = false,
|
||||
auto_toggle_features = {
|
||||
player.index,
|
||||
{
|
||||
level = 1,
|
||||
xp = 0,
|
||||
strength = 10,
|
||||
magicka = 10,
|
||||
dexterity = 10,
|
||||
vitality = 10,
|
||||
mana = 0,
|
||||
mana_max = 0,
|
||||
cooldowns = {},
|
||||
dropdown_select_index = 1,
|
||||
dropdown_select_name = Public.all_spells[1].name[1],
|
||||
dropdown_select_index_1 = 1,
|
||||
dropdown_select_name_1 = Public.all_spells[1].name[1],
|
||||
dropdown_select_index_2 = 2,
|
||||
dropdown_select_name_2 = Public.all_spells[2].name[1],
|
||||
dropdown_select_index_3 = 3,
|
||||
dropdown_select_name_3 = Public.all_spells[3].name[1],
|
||||
allocate_index = 1,
|
||||
amount = 0,
|
||||
explosive_bullets = false,
|
||||
enable_entity_spawn = false,
|
||||
health_bar = rpg_t.health_bar,
|
||||
mana_bar = rpg_t.mana_bar,
|
||||
points_left = 0,
|
||||
last_floaty_text = visuals_delay,
|
||||
xp_since_last_floaty_text = 0,
|
||||
reset = true,
|
||||
capped = false,
|
||||
bonus = rpg_extra.breached_walls or 1,
|
||||
rotated_entity_delay = 0,
|
||||
repaired_entity_delay = 0,
|
||||
last_mined_entity_position = { x = 0, y = 0 },
|
||||
last_spell_cast = { x = 0, y = 0 },
|
||||
show_bars = false,
|
||||
stone_path = false,
|
||||
aoe_punch = false
|
||||
aoe_punch = false,
|
||||
auto_toggle_features = {
|
||||
stone_path = false,
|
||||
aoe_punch = false
|
||||
}
|
||||
}
|
||||
}
|
||||
)
|
||||
)
|
||||
rpg_t.points_left = old_points_left + total
|
||||
rpg_t.xp = round(old_xp)
|
||||
rpg_t.level = old_level
|
||||
else
|
||||
rpg_t =
|
||||
Public.set_new_player_tbl(
|
||||
player.index,
|
||||
{
|
||||
level = 1,
|
||||
xp = 0,
|
||||
strength = 10,
|
||||
magicka = 10,
|
||||
dexterity = 10,
|
||||
vitality = 10,
|
||||
mana = 0,
|
||||
mana_max = 0,
|
||||
cooldowns = {},
|
||||
dropdown_select_index = 1,
|
||||
dropdown_select_name = Public.all_spells[1].name[1],
|
||||
dropdown_select_index_1 = 1,
|
||||
dropdown_select_name_1 = Public.all_spells[1].name[1],
|
||||
dropdown_select_index_2 = 2,
|
||||
dropdown_select_name_2 = Public.all_spells[2].name[1],
|
||||
dropdown_select_index_3 = 3,
|
||||
dropdown_select_name_3 = Public.all_spells[3].name[1],
|
||||
allocate_index = 1,
|
||||
amount = 0,
|
||||
explosive_bullets = false,
|
||||
enable_entity_spawn = false,
|
||||
points_left = 0,
|
||||
last_floaty_text = visuals_delay,
|
||||
xp_since_last_floaty_text = 0,
|
||||
reset = false,
|
||||
capped = false,
|
||||
total = 0,
|
||||
bonus = 1,
|
||||
rotated_entity_delay = 0,
|
||||
repaired_entity_delay = 0,
|
||||
last_mined_entity_position = {x = 0, y = 0},
|
||||
last_spell_cast = {x = 0, y = 0},
|
||||
show_bars = false,
|
||||
stone_path = false,
|
||||
aoe_punch = false,
|
||||
auto_toggle_features = {
|
||||
player.index,
|
||||
{
|
||||
level = 1,
|
||||
xp = 0,
|
||||
strength = 10,
|
||||
magicka = 10,
|
||||
dexterity = 10,
|
||||
vitality = 10,
|
||||
mana = 0,
|
||||
mana_max = 0,
|
||||
cooldowns = {},
|
||||
dropdown_select_index = 1,
|
||||
dropdown_select_name = Public.all_spells[1].name[1],
|
||||
dropdown_select_index_1 = 1,
|
||||
dropdown_select_name_1 = Public.all_spells[1].name[1],
|
||||
dropdown_select_index_2 = 2,
|
||||
dropdown_select_name_2 = Public.all_spells[2].name[1],
|
||||
dropdown_select_index_3 = 3,
|
||||
dropdown_select_name_3 = Public.all_spells[3].name[1],
|
||||
allocate_index = 1,
|
||||
amount = 0,
|
||||
explosive_bullets = false,
|
||||
enable_entity_spawn = false,
|
||||
points_left = 0,
|
||||
last_floaty_text = visuals_delay,
|
||||
xp_since_last_floaty_text = 0,
|
||||
reset = false,
|
||||
capped = false,
|
||||
total = 0,
|
||||
bonus = 1,
|
||||
rotated_entity_delay = 0,
|
||||
repaired_entity_delay = 0,
|
||||
last_mined_entity_position = { x = 0, y = 0 },
|
||||
last_spell_cast = { x = 0, y = 0 },
|
||||
show_bars = false,
|
||||
stone_path = false,
|
||||
aoe_punch = false
|
||||
aoe_punch = false,
|
||||
auto_toggle_features = {
|
||||
stone_path = false,
|
||||
aoe_punch = false
|
||||
}
|
||||
}
|
||||
}
|
||||
)
|
||||
)
|
||||
|
||||
if rpg_t and rpg_extra.grant_xp_level and not rpg_t.granted_xp_level then
|
||||
rpg_t.granted_xp_level = true
|
||||
@ -1547,7 +1606,7 @@ function Public.gain_xp(player, amount, added_to_pool, text)
|
||||
add_to_global_pool(amount, false)
|
||||
if not rpg_t.capped then
|
||||
rpg_t.capped = true
|
||||
local message = ({'rpg_functions.max_level'})
|
||||
local message = ({ 'rpg_functions.max_level' })
|
||||
Alert.alert_player_warning(player, 10, message)
|
||||
end
|
||||
return
|
||||
@ -1650,7 +1709,7 @@ function Public.global_pool(players, count)
|
||||
Public.debug_log('RPG - player capped: ' .. p.name .. '. Amount to pool:' .. share)
|
||||
end
|
||||
else
|
||||
local message = ({'rpg_functions.pool_reward', p.name})
|
||||
local message = ({ 'rpg_functions.pool_reward', p.name })
|
||||
Alert.alert_player_warning(p, 10, message)
|
||||
share = share / 10
|
||||
rpg_extra.leftover_pool = rpg_extra.leftover_pool + share
|
||||
@ -1663,15 +1722,15 @@ end
|
||||
|
||||
local damage_player_over_time_token =
|
||||
Token.register(
|
||||
function(data)
|
||||
local player = data.player
|
||||
if not player.character or not player.character.valid then
|
||||
return
|
||||
function (data)
|
||||
local player = data.player
|
||||
if not player.character or not player.character.valid then
|
||||
return
|
||||
end
|
||||
player.character.health = player.character.health - (player.character.health * 0.05)
|
||||
player.character.surface.create_entity({ name = 'water-splash', position = player.position })
|
||||
end
|
||||
player.character.health = player.character.health - (player.character.health * 0.05)
|
||||
player.character.surface.create_entity({name = 'water-splash', position = player.position})
|
||||
end
|
||||
)
|
||||
)
|
||||
|
||||
--- Damages a player over time.
|
||||
function Public.damage_player_over_time(player, amount)
|
||||
@ -1682,7 +1741,7 @@ function Public.damage_player_over_time(player, amount)
|
||||
amount = amount or 10
|
||||
local tick = 20
|
||||
for _ = 1, amount, 1 do
|
||||
Task.set_timeout_in_ticks(tick, damage_player_over_time_token, {player = player})
|
||||
Task.set_timeout_in_ticks(tick, damage_player_over_time_token, { player = player })
|
||||
tick = tick + 15
|
||||
end
|
||||
end
|
||||
|
@ -150,22 +150,22 @@ local function train_type_cause(cause)
|
||||
end
|
||||
|
||||
local get_cause_player = {
|
||||
['character'] = function(cause)
|
||||
['character'] = function (cause)
|
||||
if not cause.player then
|
||||
return
|
||||
end
|
||||
return {cause.player}
|
||||
return { cause.player }
|
||||
end,
|
||||
['combat-robot'] = function(cause)
|
||||
['combat-robot'] = function (cause)
|
||||
if not cause.last_user then
|
||||
return
|
||||
end
|
||||
if not game.players[cause.last_user.index] then
|
||||
return
|
||||
end
|
||||
return {game.players[cause.last_user.index]}
|
||||
return { game.players[cause.last_user.index] }
|
||||
end,
|
||||
['car'] = function(cause)
|
||||
['car'] = function (cause)
|
||||
local players = {}
|
||||
local driver = cause.get_driver()
|
||||
if driver then
|
||||
@ -181,7 +181,7 @@ local get_cause_player = {
|
||||
end
|
||||
return players
|
||||
end,
|
||||
['spider-vehicle'] = function(cause)
|
||||
['spider-vehicle'] = function (cause)
|
||||
local players = {}
|
||||
local driver = cause.get_driver()
|
||||
if driver then
|
||||
@ -472,8 +472,8 @@ local function on_entity_damaged(event)
|
||||
local position = p.position
|
||||
|
||||
local area = {
|
||||
left_top = {x = position.x - 5, y = position.y - 5},
|
||||
right_bottom = {x = position.x + 5, y = position.y + 5}
|
||||
left_top = { x = position.x - 5, y = position.y - 5 },
|
||||
right_bottom = { x = position.x + 5, y = position.y + 5 }
|
||||
}
|
||||
|
||||
if not is_position_near(area, entity.position) then
|
||||
@ -503,20 +503,21 @@ local function on_entity_damaged(event)
|
||||
damage = damage * random(250, 350) * 0.01
|
||||
cause.surface.create_entity(
|
||||
{
|
||||
name = 'flying-text',
|
||||
name = 'compi-speech-bubble',
|
||||
position = entity.position,
|
||||
text = '‼' .. floor(damage),
|
||||
color = {255, 0, 0}
|
||||
source = entity,
|
||||
lifetime = 30
|
||||
}
|
||||
)
|
||||
cause.surface.create_entity({name = 'blood-explosion-huge', position = entity.position})
|
||||
cause.surface.create_entity({ name = 'blood-explosion-huge', position = entity.position })
|
||||
else
|
||||
damage = damage * random(100, 125) * 0.01
|
||||
cause.player.create_local_flying_text(
|
||||
{
|
||||
text = floor(damage),
|
||||
position = entity.position,
|
||||
color = {150, 150, 150},
|
||||
color = { 150, 150, 150 },
|
||||
time_to_live = 90,
|
||||
speed = 2
|
||||
}
|
||||
@ -535,7 +536,7 @@ local function on_entity_damaged(event)
|
||||
local chance_to_hit = random(0, 999)
|
||||
local success = chance_to_hit < chance
|
||||
Public.log_aoe_punch(
|
||||
function()
|
||||
function ()
|
||||
if success then
|
||||
print('[OnePunch]: Chance: ' .. chance .. ' Chance to hit: ' .. chance_to_hit .. ' Success: true' .. ' Damage: ' .. damage)
|
||||
else
|
||||
@ -810,9 +811,9 @@ local function on_player_joined_game(event)
|
||||
end
|
||||
|
||||
local function get_near_coord_modifier(range)
|
||||
local coord = {x = (range * -1) + random(0, range * 2), y = (range * -1) + random(0, range * 2)}
|
||||
local coord = { x = (range * -1) + random(0, range * 2), y = (range * -1) + random(0, range * 2) }
|
||||
for _ = 1, 5, 1 do
|
||||
local new_coord = {x = (range * -1) + random(0, range * 2), y = (range * -1) + random(0, range * 2)}
|
||||
local new_coord = { x = (range * -1) + random(0, range * 2), y = (range * -1) + random(0, range * 2) }
|
||||
if new_coord.x ^ 2 + new_coord.y ^ 2 < coord.x ^ 2 + coord.y ^ 2 then
|
||||
coord = new_coord
|
||||
end
|
||||
@ -837,7 +838,7 @@ local function damage_entity(e)
|
||||
return
|
||||
end
|
||||
|
||||
e.surface.create_entity({name = 'ground-explosion', position = e.position})
|
||||
e.surface.create_entity({ name = 'ground-explosion', position = e.position })
|
||||
|
||||
if e.type == 'entity-ghost' then
|
||||
e.destroy()
|
||||
@ -851,14 +852,14 @@ local function damage_entity(e)
|
||||
end
|
||||
|
||||
local function floaty_hearts(entity, c)
|
||||
local position = {x = entity.position.x - 0.75, y = entity.position.y - 1}
|
||||
local position = { x = entity.position.x - 0.75, y = entity.position.y - 1 }
|
||||
local b = 1.35
|
||||
for _ = 1, c, 1 do
|
||||
local p = {
|
||||
(position.x + 0.4) + (b * -1 + random(0, b * 20) * 0.1),
|
||||
position.y + (b * -1 + random(0, b * 20) * 0.1)
|
||||
}
|
||||
entity.surface.create_entity({name = 'flying-text', position = p, text = '♥', color = {random(150, 255), 0, 255}})
|
||||
entity.surface.create_entity({ name = 'compi-speech-bubble', position = p, text = '♥', source = entity, lifetime = 30 })
|
||||
end
|
||||
end
|
||||
|
||||
@ -869,7 +870,7 @@ local function tame_unit_effects(player, entity)
|
||||
text = '~' .. player.name .. "'s pet~",
|
||||
surface = player.surface,
|
||||
target = entity,
|
||||
target_offset = {0, -2.6},
|
||||
target_offset = { 0, -2.6 },
|
||||
color = {
|
||||
r = player.color.r * 0.6 + 0.25,
|
||||
g = player.color.g * 0.6 + 0.25,
|
||||
@ -946,8 +947,8 @@ local function on_player_used_capsule(event)
|
||||
|
||||
local radius = 15
|
||||
local area = {
|
||||
left_top = {x = position.x - radius, y = position.y - radius},
|
||||
right_bottom = {x = position.x + radius, y = position.y + radius}
|
||||
left_top = { x = position.x - radius, y = position.y - radius },
|
||||
right_bottom = { x = position.x + radius, y = position.y + radius }
|
||||
}
|
||||
|
||||
if not spell.enabled then
|
||||
@ -969,10 +970,10 @@ local function on_player_used_capsule(event)
|
||||
|
||||
local target_pos
|
||||
if spell.target then
|
||||
target_pos = {position.x, position.y}
|
||||
target_pos = { position.x, position.y }
|
||||
elseif projectile_types[spell.entityName] then
|
||||
local coord_modifier = get_near_coord_modifier(projectile_types[spell.entityName].max_range)
|
||||
target_pos = {position.x + coord_modifier.x, position.y + coord_modifier.y}
|
||||
target_pos = { position.x + coord_modifier.x, position.y + coord_modifier.y }
|
||||
end
|
||||
|
||||
local range
|
||||
@ -1020,7 +1021,7 @@ local function on_player_used_capsule(event)
|
||||
rpg_t.amount = 1
|
||||
end
|
||||
|
||||
Event.raise(Public.events.on_spell_cast_success, {player_index = player.index, spell_name = spell.entityName, amount = rpg_t.amount})
|
||||
Event.raise(Public.events.on_spell_cast_success, { player_index = player.index, spell_name = spell.entityName, amount = rpg_t.amount })
|
||||
|
||||
StatData.get_data(player):increase('spells')
|
||||
|
||||
@ -1100,7 +1101,7 @@ Event.on_nth_tick(2, Public.update_tidal_wave)
|
||||
|
||||
Event.add(
|
||||
defines.events.on_gui_closed,
|
||||
function(event)
|
||||
function (event)
|
||||
local player = game.get_player(event.player_index)
|
||||
if not player or not player.valid then
|
||||
return
|
||||
@ -1114,7 +1115,7 @@ if _DEBUG then
|
||||
Public.disable_cooldowns_on_spells()
|
||||
|
||||
Event.on_init(
|
||||
function()
|
||||
function ()
|
||||
Public.rpg_reset_all_players()
|
||||
Public.enable_health_and_mana_bars(true)
|
||||
Public.enable_wave_defense(true)
|
||||
|
@ -99,7 +99,6 @@ market.logistic = {
|
||||
['inserter'] = { value = 8, rarity = 1 },
|
||||
['long-handed-inserter'] = { value = 12, rarity = 2 },
|
||||
['fast-inserter'] = { value = 16, rarity = 4 },
|
||||
['filter-inserter'] = { value = 24, rarity = 5 },
|
||||
['stack-inserter'] = { value = 96, rarity = 6 },
|
||||
['bulk-inserter'] = { value = 128, rarity = 7 },
|
||||
['small-electric-pole'] = { value = 2, rarity = 1 },
|
||||
|
@ -31,7 +31,6 @@ local item_worths = {
|
||||
['inserter'] = 4,
|
||||
['long-handed-inserter'] = 8,
|
||||
['fast-inserter'] = 16,
|
||||
['filter-inserter'] = 32,
|
||||
['stack-inserter'] = 128,
|
||||
['bulk-inserter'] = 160,
|
||||
['small-electric-pole'] = 2,
|
||||
@ -238,7 +237,6 @@ local tech_tier_list = {
|
||||
'assembling-machine-1',
|
||||
'long-handed-inserter',
|
||||
'fast-inserter',
|
||||
'filter-inserter',
|
||||
'underground-belt',
|
||||
'splitter',
|
||||
'loader',
|
||||
|
@ -74,9 +74,6 @@ Public.ranks = {
|
||||
'item/radar',
|
||||
'item/radar',
|
||||
'item/radar',
|
||||
'item/filter-inserter',
|
||||
'item/filter-inserter',
|
||||
'item/filter-inserter',
|
||||
'item/defender-capsule',
|
||||
'item/defender-capsule',
|
||||
'item/defender-capsule',
|
||||
|
@ -1,7 +1,7 @@
|
||||
local Module = {}
|
||||
-- luacheck: ignore math
|
||||
|
||||
Module.distance = function(pos1, pos2)
|
||||
Module.distance = function (pos1, pos2)
|
||||
local dx = pos2.x - pos1.x
|
||||
local dy = pos2.y - pos1.y
|
||||
return math.sqrt(dx * dx + dy * dy)
|
||||
@ -23,7 +23,7 @@ function math.clamp(num, min, max)
|
||||
end
|
||||
end
|
||||
|
||||
Module.print_except = function(msg, player)
|
||||
Module.print_except = function (msg, player)
|
||||
for _, p in pairs(game.players) do
|
||||
if p.connected and p ~= player then
|
||||
p.print(msg)
|
||||
@ -31,7 +31,7 @@ Module.print_except = function(msg, player)
|
||||
end
|
||||
end
|
||||
|
||||
Module.print_admins = function(msg)
|
||||
Module.print_admins = function (msg)
|
||||
for _, p in pairs(game.players) do
|
||||
if p.connected and p.admin then
|
||||
p.print(msg)
|
||||
@ -39,14 +39,14 @@ Module.print_admins = function(msg)
|
||||
end
|
||||
end
|
||||
|
||||
Module.get_actor = function()
|
||||
Module.get_actor = function ()
|
||||
if game.player then
|
||||
return game.player.name
|
||||
end
|
||||
return '<server>'
|
||||
end
|
||||
|
||||
Module.cast_bool = function(var)
|
||||
Module.cast_bool = function (var)
|
||||
if var then
|
||||
return true
|
||||
else
|
||||
@ -54,7 +54,7 @@ Module.cast_bool = function(var)
|
||||
end
|
||||
end
|
||||
|
||||
Module.get_formatted_playtime = function(x)
|
||||
Module.get_formatted_playtime = function (x)
|
||||
if x < 5184000 then
|
||||
local y = x / 216000
|
||||
y = tostring(y)
|
||||
@ -114,7 +114,7 @@ Module.get_formatted_playtime = function(x)
|
||||
end
|
||||
end
|
||||
|
||||
Module.find_entities_by_last_user = function(player, surface, filters)
|
||||
Module.find_entities_by_last_user = function (player, surface, filters)
|
||||
if type(player) == 'string' or not player then
|
||||
error("bad argument #1 to '" .. debug.getinfo(1, 'n').name .. "' (number or LuaPlayer expected, got " .. type(player) .. ')', 1)
|
||||
return
|
||||
@ -140,7 +140,7 @@ Module.find_entities_by_last_user = function(player, surface, filters)
|
||||
return entities
|
||||
end
|
||||
|
||||
Module.ternary = function(c, t, f)
|
||||
Module.ternary = function (c, t, f)
|
||||
if c then
|
||||
return t
|
||||
else
|
||||
@ -152,7 +152,7 @@ local minutes_to_ticks = 60 * 60
|
||||
local hours_to_ticks = 60 * 60 * 60
|
||||
local ticks_to_minutes = 1 / minutes_to_ticks
|
||||
local ticks_to_hours = 1 / hours_to_ticks
|
||||
Module.format_time = function(ticks)
|
||||
Module.format_time = function (ticks)
|
||||
local result = {}
|
||||
|
||||
local hours = math.floor(ticks * ticks_to_hours)
|
||||
@ -178,7 +178,7 @@ Module.format_time = function(ticks)
|
||||
end
|
||||
|
||||
-- Convert date from 1999/01/01
|
||||
Module.convert_date = function(year, month, day)
|
||||
Module.convert_date = function (year, month, day)
|
||||
year = tonumber(year)
|
||||
month = tonumber(month)
|
||||
day = tonumber(day)
|
||||
|
Loading…
Reference in New Issue
Block a user