mirror of
https://github.com/ComfyFactory/ComfyFactorio.git
synced 2024-12-26 22:56:43 +02:00
Mtn v3: fix api changes
This commit is contained in:
parent
a9531bda0f
commit
07eb4847d0
@ -93,7 +93,6 @@ local this = {
|
||||
['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 },
|
||||
@ -105,8 +104,8 @@ local this = {
|
||||
['pump'] = { value = 16, rarity = 4 },
|
||||
['logistic-robot'] = { value = 28, rarity = 5 },
|
||||
['construction-robot'] = { value = 28, rarity = 3 },
|
||||
['active-chest-provider'] = { value = 128, rarity = 7 },
|
||||
['passive-chest-provider'] = { value = 128, rarity = 6 },
|
||||
['active-provider-chest'] = { value = 128, rarity = 7 },
|
||||
['passive-provider-chest'] = { value = 128, rarity = 6 },
|
||||
['storage-chest'] = { value = 128, rarity = 6 },
|
||||
['buffer-chest'] = { value = 128, rarity = 7 },
|
||||
['requester-chest'] = { value = 128, rarity = 7 },
|
||||
|
@ -279,28 +279,29 @@ local compare_player_and_train = function (player, entity)
|
||||
local locomotive_distance_too_far = c_y - t_y > spidertron_warning_position
|
||||
local spidertron_warning_position_pre_warning = spidertron_warning_position - 100
|
||||
local locomotive_distance_too_far_pre_warning = c_y - t_y > spidertron_warning_position_pre_warning
|
||||
local surface = player.surface
|
||||
|
||||
local color = Color.yellow
|
||||
if locomotive_distance_too_far_pre_warning and not locomotive_distance_too_far then
|
||||
local msg = 'Warning! You are getting too far away from the train!'
|
||||
surface.create_entity(
|
||||
player.create_local_flying_text(
|
||||
{
|
||||
name = 'flying-text',
|
||||
position = position,
|
||||
text = msg,
|
||||
color = color
|
||||
color = color,
|
||||
time_to_live = 300,
|
||||
speed = 100
|
||||
}
|
||||
)
|
||||
player.print(msg, color)
|
||||
elseif locomotive_distance_too_far then
|
||||
local msg = 'Warning! You are too far away from the train! TURN BACK!'
|
||||
surface.create_entity(
|
||||
player.create_local_flying_text(
|
||||
{
|
||||
name = 'flying-text',
|
||||
position = position,
|
||||
text = msg,
|
||||
color = color
|
||||
color = color,
|
||||
time_to_live = 300,
|
||||
speed = 100
|
||||
}
|
||||
)
|
||||
player.print(msg, color)
|
||||
|
@ -830,10 +830,11 @@ local function kaboom(entity, target, damage)
|
||||
|
||||
entity.surface.create_entity(
|
||||
{
|
||||
name = 'flying-text',
|
||||
name = 'compi-speech-bubble',
|
||||
position = { entity.position.x + base_vector[1] * 0.5, entity.position.y + base_vector[2] * 0.5 },
|
||||
text = msg[random(1, #msg)],
|
||||
color = { 255, 0, 0 }
|
||||
source = entity,
|
||||
lifetime = 30
|
||||
}
|
||||
)
|
||||
|
||||
@ -1491,12 +1492,13 @@ local function on_built_entity(event)
|
||||
|
||||
if entity.name == 'radar' then
|
||||
if entity.surface.count_entities_filtered({ type = 'radar', position = position, radius = 64 }) > 1 then
|
||||
player.surface.create_entity(
|
||||
player.create_local_flying_text(
|
||||
{
|
||||
name = 'flying-text',
|
||||
position = entity.position,
|
||||
text = ({ 'entity.radar_limit' }),
|
||||
color = { 255, 0, 0 }
|
||||
color = { 255, 0, 0 },
|
||||
time_to_live = 300,
|
||||
speed = 100
|
||||
}
|
||||
)
|
||||
|
||||
@ -1544,22 +1546,24 @@ local function on_built_entity(event)
|
||||
upgrades.unit_number[name][entity] = entity
|
||||
upgrades.showed_text = false
|
||||
|
||||
surface.create_entity(
|
||||
player.create_local_flying_text(
|
||||
{
|
||||
name = 'flying-text',
|
||||
position = entity.position,
|
||||
text = upgrades[name].built .. ' / ' .. limit[entity.name] .. ' ' .. entity.name,
|
||||
color = { r = 0.82, g = 0.11, b = 0.11 }
|
||||
color = { r = 0.82, g = 0.11, b = 0.11 },
|
||||
time_to_live = 300,
|
||||
speed = 100
|
||||
}
|
||||
)
|
||||
else
|
||||
if not upgrades.showed_text then
|
||||
surface.create_entity(
|
||||
player.create_local_flying_text(
|
||||
{
|
||||
name = 'flying-text',
|
||||
position = entity.position,
|
||||
text = ({ 'entity.entity_limit_reached', entity.name }),
|
||||
color = { r = 0.82, g = 0.11, b = 0.11 }
|
||||
color = { r = 0.82, g = 0.11, b = 0.11 },
|
||||
time_to_live = 300,
|
||||
speed = 100
|
||||
}
|
||||
)
|
||||
|
||||
@ -1589,10 +1593,11 @@ local function on_robot_built_entity(event)
|
||||
if entity.surface.count_entities_filtered({ type = 'radar', position = position, radius = 64 }) > 1 then
|
||||
entity.surface.create_entity(
|
||||
{
|
||||
name = 'flying-text',
|
||||
name = 'compi-speech-bubble',
|
||||
position = entity.position,
|
||||
text = ({ 'entity.radar_limit' }),
|
||||
color = { 255, 0, 0 }
|
||||
source = entity,
|
||||
lifetime = 30
|
||||
}
|
||||
)
|
||||
|
||||
@ -1642,20 +1647,22 @@ local function on_robot_built_entity(event)
|
||||
|
||||
surface.create_entity(
|
||||
{
|
||||
name = 'flying-text',
|
||||
name = 'compi-speech-bubble',
|
||||
position = entity.position,
|
||||
text = upgrades[name].built .. ' / ' .. limit[entity.name] .. ' ' .. entity.name,
|
||||
color = { r = 0.82, g = 0.11, b = 0.11 }
|
||||
source = entity,
|
||||
lifetime = 30
|
||||
}
|
||||
)
|
||||
else
|
||||
if not upgrades.showed_text then
|
||||
surface.create_entity(
|
||||
{
|
||||
name = 'flying-text',
|
||||
name = 'compi-speech-bubble',
|
||||
position = entity.position,
|
||||
text = ({ 'entity.entity_limit_reached', entity.name }),
|
||||
color = { r = 0.82, g = 0.11, b = 0.11 }
|
||||
source = entity,
|
||||
lifetime = 30
|
||||
}
|
||||
)
|
||||
|
||||
|
@ -129,12 +129,14 @@ local function debug_str(msg)
|
||||
print('Mtn: ' .. msg)
|
||||
end
|
||||
|
||||
local function show_text(msg, pos, color, surface)
|
||||
if color == nil then
|
||||
surface.create_entity({ name = 'flying-text', position = pos, text = msg })
|
||||
else
|
||||
surface.create_entity({ name = 'flying-text', position = pos, text = msg, color = color })
|
||||
end
|
||||
local function show_text(msg, pos, surface, player)
|
||||
surface.create_entity({
|
||||
name = 'compi-speech-bubble',
|
||||
position = pos,
|
||||
text = msg,
|
||||
source = player.character,
|
||||
lifetime = 30
|
||||
})
|
||||
end
|
||||
|
||||
local function fast_remove(tbl, index)
|
||||
@ -1643,7 +1645,7 @@ function Public.on_player_changed_position(event)
|
||||
if get_tile.valid and get_tile.name == 'lab-dark-2' then
|
||||
if random(1, 2) == 1 then
|
||||
if random(1, 2) == 1 then
|
||||
show_text('This path is not for players!', p, { r = 0.98, g = 0.66, b = 0.22 }, surface)
|
||||
show_text('This path is not for players!', p, surface, player)
|
||||
end
|
||||
player.surface.create_entity({ name = 'fire-flame', position = player.position })
|
||||
player.character.health = player.character.health - tile_damage
|
||||
|
@ -670,7 +670,7 @@ end
|
||||
|
||||
local transfer_functions = {
|
||||
['requester-chest'] = input_cargo,
|
||||
['passive-chest-provider'] = output_cargo
|
||||
['passive-provider-chest'] = output_cargo
|
||||
}
|
||||
|
||||
local function construct_doors(car)
|
||||
@ -1224,7 +1224,7 @@ function Public.create_car_room(car)
|
||||
local e2 =
|
||||
surface.create_entity(
|
||||
{
|
||||
name = 'passive-chest-provider',
|
||||
name = 'passive-provider-chest',
|
||||
position = position2,
|
||||
force = 'neutral',
|
||||
create_build_effect_smoke = false
|
||||
|
@ -107,7 +107,15 @@ local function death_effects(player)
|
||||
(position.x + 0.4) + (b * -1 + math.random(0, b * 20) * 0.1),
|
||||
position.y + (b * -1 + math.random(0, b * 20) * 0.1)
|
||||
}
|
||||
player.surface.create_entity({ name = 'flying-text', position = p, text = '☠️', color = { 255, math.random(0, 100), 0 } })
|
||||
|
||||
player.create_local_flying_text(
|
||||
{
|
||||
position = p,
|
||||
text = '☠️',
|
||||
time_to_live = 300,
|
||||
speed = 100
|
||||
}
|
||||
)
|
||||
end
|
||||
player.play_sound { path = 'utility/axe_fighting', volume_modifier = 0.9 }
|
||||
end
|
||||
|
@ -303,12 +303,12 @@ local function randomness(data)
|
||||
|
||||
local position = { x = entity.position.x, y = entity.position.y }
|
||||
|
||||
player.surface.create_entity(
|
||||
player.create_local_flying_text(
|
||||
{
|
||||
name = 'flying-text',
|
||||
position = position,
|
||||
text = '+' .. harvest_amount .. ' [img=item/' .. harvest .. ']',
|
||||
color = { r = 200, g = 160, b = 30 }
|
||||
time_to_live = 300,
|
||||
speed = 100
|
||||
}
|
||||
)
|
||||
|
||||
@ -361,12 +361,12 @@ local function randomness_scrap(data)
|
||||
|
||||
local position = { x = entity.position.x, y = entity.position.y }
|
||||
|
||||
player.surface.create_entity(
|
||||
player.create_local_flying_text(
|
||||
{
|
||||
name = 'flying-text',
|
||||
position = position,
|
||||
text = '+' .. harvest_amount .. ' [img=item/' .. harvest .. ']',
|
||||
color = { r = 200, g = 160, b = 30 }
|
||||
time_to_live = 300,
|
||||
speed = 100
|
||||
}
|
||||
)
|
||||
|
||||
|
@ -3,18 +3,18 @@ local Public = require 'maps.mountain_fortress_v3.table'
|
||||
|
||||
local random = math.random
|
||||
|
||||
local tick_tacks = {'*tick*', '*tick*', '*tack*', '*tak*', '*tik*', '*tok*', '*run*'}
|
||||
local tick_tacks = { '*tick*', '*tick*', '*tack*', '*tak*', '*tik*', '*tok*', '*run*' }
|
||||
|
||||
local kaboom_weights = {
|
||||
{name = 'grenade', chance = 7},
|
||||
{name = 'cluster-grenade', chance = 1},
|
||||
{name = 'destroyer-capsule', chance = 1},
|
||||
{name = 'defender-capsule', chance = 4},
|
||||
{name = 'distractor-capsule', chance = 2},
|
||||
{name = 'poison-capsule', chance = 2},
|
||||
{name = 'coin', chance = 2},
|
||||
{name = 'explosive-uranium-cannon-projectile', chance = 3},
|
||||
{name = 'explosive-cannon-projectile', chance = 5}
|
||||
{ name = 'grenade', chance = 7 },
|
||||
{ name = 'cluster-grenade', chance = 1 },
|
||||
{ name = 'destroyer-capsule', chance = 1 },
|
||||
{ name = 'defender-capsule', chance = 4 },
|
||||
{ name = 'distractor-capsule', chance = 2 },
|
||||
{ name = 'poison-capsule', chance = 2 },
|
||||
{ name = 'coin', chance = 2 },
|
||||
{ name = 'explosive-uranium-cannon-projectile', chance = 3 },
|
||||
{ name = 'explosive-cannon-projectile', chance = 5 }
|
||||
}
|
||||
|
||||
local kabooms = {}
|
||||
@ -30,14 +30,15 @@ local function create_flying_text(surface, position, text)
|
||||
end
|
||||
surface.create_entity(
|
||||
{
|
||||
name = 'flying-text',
|
||||
name = 'compi-speech-bubble',
|
||||
position = position,
|
||||
text = text,
|
||||
color = {r = 0.75, g = 0.75, b = 0.75}
|
||||
source = position,
|
||||
lifetime = 30
|
||||
}
|
||||
)
|
||||
|
||||
surface.play_sound({path = 'utility/armor_insert', position = position, volume_modifier = 0.75})
|
||||
surface.play_sound({ path = 'utility/armor_insert', position = position, volume_modifier = 0.75 })
|
||||
end
|
||||
|
||||
local function create_kaboom(surface, position, name)
|
||||
@ -51,9 +52,9 @@ local function create_kaboom(surface, position, name)
|
||||
local rng = random(1, 512)
|
||||
local chest = 'crash-site-chest-' .. random(1, 2)
|
||||
|
||||
local container = surface.create_entity({name = chest, position = position, force = 'neutral'})
|
||||
local container = surface.create_entity({ name = chest, position = position, force = 'neutral' })
|
||||
if container and container.health then
|
||||
container.insert({name = 'coin', count = rng})
|
||||
container.insert({ name = 'coin', count = rng })
|
||||
container.health = random(1, container.health)
|
||||
end
|
||||
return
|
||||
@ -62,13 +63,14 @@ local function create_kaboom(surface, position, name)
|
||||
if name == 'defender-capsule' or name == 'destroyer-capsule' or name == 'distractor-capsule' then
|
||||
surface.create_entity(
|
||||
{
|
||||
name = 'flying-text',
|
||||
name = 'compi-speech-bubble',
|
||||
position = position,
|
||||
text = '(((Sentries Engaging Target)))',
|
||||
color = {r = 0.8, g = 0.0, b = 0.0}
|
||||
source = position,
|
||||
lifetime = 30
|
||||
}
|
||||
)
|
||||
local nearest_player_unit = surface.find_nearest_enemy({position = position, max_distance = 128, force = 'enemy'})
|
||||
local nearest_player_unit = surface.find_nearest_enemy({ position = position, max_distance = 128, force = 'enemy' })
|
||||
if nearest_player_unit then
|
||||
target = nearest_player_unit.position
|
||||
end
|
||||
@ -111,18 +113,18 @@ function Public.tick_tack_trap(surface, position)
|
||||
if t < tick_tack_count * 60 then
|
||||
traps[game.tick + t][#traps[game.tick + t] + 1] = {
|
||||
callback = 'create_flying_text',
|
||||
params = {surface, {x = position.x, y = position.y}, tick_tacks[random(1, #tick_tacks)]}
|
||||
params = { surface, { x = position.x, y = position.y }, tick_tacks[random(1, #tick_tacks)] }
|
||||
}
|
||||
else
|
||||
if random(1, 10) == 1 then
|
||||
traps[game.tick + t][#traps[game.tick + t] + 1] = {
|
||||
callback = 'create_flying_text',
|
||||
params = {surface, {x = position.x, y = position.y}, '( ͡° ͜ʖ ͡°)'}
|
||||
params = { surface, { x = position.x, y = position.y }, '( ͡° ͜ʖ ͡°)' }
|
||||
}
|
||||
else
|
||||
traps[game.tick + t][#traps[game.tick + t] + 1] = {
|
||||
callback = 'create_kaboom',
|
||||
params = {surface, {x = position.x, y = position.y}, kabooms[random(1, #kabooms)]}
|
||||
params = { surface, { x = position.x, y = position.y }, kabooms[random(1, #kabooms)] }
|
||||
}
|
||||
end
|
||||
end
|
||||
|
Loading…
Reference in New Issue
Block a user