mirror of
https://github.com/ComfyFactory/ComfyFactorio.git
synced 2025-02-09 13:37:02 +02:00
tweaks
This commit is contained in:
parent
0e52cadfb9
commit
07336111bf
@ -819,16 +819,16 @@ function Public.create_car(ic, event)
|
|||||||
|
|
||||||
local name, mined = get_player_entity(ic, player, ce)
|
local name, mined = get_player_entity(ic, player, ce)
|
||||||
|
|
||||||
if
|
if
|
||||||
name == 'car' and ce.name == 'car' and not mined or name == 'car' and ce.name == 'tank' and not mined or
|
name == 'car' and ce.name == 'car' and not mined or name == 'car' and ce.name == 'tank' and not mined or
|
||||||
name == 'tank' and ce.name == 'car' and not mined or
|
name == 'tank' and ce.name == 'car' and not mined or
|
||||||
name == 'tank' and ce.name == 'tank' and not mined or
|
name == 'tank' and ce.name == 'tank' and not mined or
|
||||||
name == 'spidertron' and ce.name == 'car' and not mined or
|
name == 'spidertron' and ce.name == 'car' and not mined or
|
||||||
name == 'spidertron' and ce.name == 'tank' and not mined or
|
name == 'spidertron' and ce.name == 'tank' and not mined or
|
||||||
name == 'spidertron' and ce.name == 'spidertron' and not mined
|
name == 'spidertron' and ce.name == 'spidertron' and not mined
|
||||||
then
|
then
|
||||||
return player.print('Multiple vehicles are not supported at the moment.', Color.warning)
|
return player.print('Multiple vehicles are not supported at the moment.', Color.warning)
|
||||||
end
|
end
|
||||||
|
|
||||||
if string.sub(ce.surface.name, 0, #map_name) ~= map_name then
|
if string.sub(ce.surface.name, 0, #map_name) ~= map_name then
|
||||||
return player.print('Multi-surface is not supported at the moment.', Color.warning)
|
return player.print('Multi-surface is not supported at the moment.', Color.warning)
|
||||||
|
@ -55,6 +55,24 @@ local tile_damage = 50
|
|||||||
|
|
||||||
local starting_items = {['pistol'] = 1, ['firearm-magazine'] = 16, ['rail'] = 16, ['wood'] = 16, ['explosives'] = 32}
|
local starting_items = {['pistol'] = 1, ['firearm-magazine'] = 16, ['rail'] = 16, ['wood'] = 16, ['explosives'] = 32}
|
||||||
|
|
||||||
|
local collapse_kill = {
|
||||||
|
entities = {
|
||||||
|
['laser-turret'] = true,
|
||||||
|
['flamethrower-turret'] = true,
|
||||||
|
['gun-turret'] = true,
|
||||||
|
['artillery-turret'] = true,
|
||||||
|
['landmine'] = true,
|
||||||
|
['locomotive'] = true,
|
||||||
|
['cargo-wagon'] = true,
|
||||||
|
['car'] = true,
|
||||||
|
['tank'] = true,
|
||||||
|
['assembling-machine'] = true,
|
||||||
|
['furnace'] = true,
|
||||||
|
['steel-chest'] = true
|
||||||
|
},
|
||||||
|
enabled = true
|
||||||
|
}
|
||||||
|
|
||||||
local death_messages = {
|
local death_messages = {
|
||||||
'should have watched where they walked!',
|
'should have watched where they walked!',
|
||||||
'was not careful enough!',
|
'was not careful enough!',
|
||||||
@ -325,7 +343,8 @@ function Public.reset_map()
|
|||||||
game.map_settings.path_finder.max_work_done_per_tick = 4000
|
game.map_settings.path_finder.max_work_done_per_tick = 4000
|
||||||
Diff.gui_width = 20
|
Diff.gui_width = 20
|
||||||
|
|
||||||
Collapse.set_kill_entities(true)
|
Collapse.set_kill_entities(false)
|
||||||
|
Collapse.set_kill_specific_entities(collapse_kill)
|
||||||
Collapse.set_speed(8)
|
Collapse.set_speed(8)
|
||||||
Collapse.set_amount(1)
|
Collapse.set_amount(1)
|
||||||
Collapse.set_max_line_size(Terrain.level_width)
|
Collapse.set_max_line_size(Terrain.level_width)
|
||||||
|
@ -2,7 +2,8 @@ local Global = require 'utils.global'
|
|||||||
local Event = require 'utils.event'
|
local Event = require 'utils.event'
|
||||||
|
|
||||||
local this = {
|
local this = {
|
||||||
fullness_enabled = true
|
fullness_enabled = true,
|
||||||
|
warned = {}
|
||||||
}
|
}
|
||||||
|
|
||||||
Global.register(
|
Global.register(
|
||||||
@ -14,25 +15,46 @@ Global.register(
|
|||||||
|
|
||||||
local Public = {}
|
local Public = {}
|
||||||
local random = math.random
|
local random = math.random
|
||||||
|
local ceil = math.ceil
|
||||||
|
|
||||||
|
local function is_player_warned(player, reset)
|
||||||
|
if reset and this.warned[player.index] then
|
||||||
|
this.warned[player.index] = nil
|
||||||
|
return
|
||||||
|
end
|
||||||
|
if not this.warned[player.index] then
|
||||||
|
this.warned[player.index] = {
|
||||||
|
count = 2
|
||||||
|
}
|
||||||
|
end
|
||||||
|
this.warned[player.index].count = this.warned[player.index].count + 1
|
||||||
|
return this.warned[player.index]
|
||||||
|
end
|
||||||
|
|
||||||
local function compute_fullness(player)
|
local function compute_fullness(player)
|
||||||
|
local warn_player = is_player_warned(player)
|
||||||
local free_slots = player.get_main_inventory().count_empty_stacks()
|
local free_slots = player.get_main_inventory().count_empty_stacks()
|
||||||
if free_slots == 0 then
|
if free_slots == 0 then
|
||||||
if player.character then
|
if player.character then
|
||||||
player.character.health = player.character.health - random(50, 100)
|
local damage = ceil((warn_player.count / 2) * warn_player.count)
|
||||||
player.character.surface.create_entity({name = 'water-splash', position = player.position})
|
if player.character.health >= damage then
|
||||||
local messages = {
|
player.character.damage(damage, 'player', 'explosion')
|
||||||
'Ouch.. That hurt! Better be careful now.',
|
player.character.surface.create_entity({name = 'water-splash', position = player.position})
|
||||||
'Just a fleshwound.',
|
local messages = {
|
||||||
'Better keep those hands to yourself or you might loose them.'
|
'Ouch.. That hurt! Better be careful now.',
|
||||||
}
|
'Just a fleshwound.',
|
||||||
player.print(messages[random(1, #messages)], {r = 0.75, g = 0.0, b = 0.0})
|
'Better keep those hands to yourself or you might loose them.'
|
||||||
if player.character.health <= 0 then
|
}
|
||||||
|
player.print(messages[random(1, #messages)], {r = 0.75, g = 0.0, b = 0.0})
|
||||||
|
else
|
||||||
player.character.die('enemy')
|
player.character.die('enemy')
|
||||||
|
is_player_warned(player, true)
|
||||||
game.print(player.name .. ' should have emptied their pockets.', {r = 0.75, g = 0.0, b = 0.0})
|
game.print(player.name .. ' should have emptied their pockets.', {r = 0.75, g = 0.0, b = 0.0})
|
||||||
return free_slots
|
return free_slots
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
else
|
||||||
|
is_player_warned(player, true)
|
||||||
end
|
end
|
||||||
return free_slots
|
return free_slots
|
||||||
end
|
end
|
||||||
|
@ -106,6 +106,21 @@ local function progress()
|
|||||||
if not tile.valid then
|
if not tile.valid then
|
||||||
return
|
return
|
||||||
end
|
end
|
||||||
|
if collapse.specific_entities.enabled then
|
||||||
|
local position = {tile.position.x + 0.5, tile.position.y + 0.5}
|
||||||
|
local entities = collapse.specific_entities.entities
|
||||||
|
for _, e in pairs(
|
||||||
|
surface.find_entities_filtered(
|
||||||
|
{area = {{position[1] - 2, position[2] - 2}, {position[1] + 2, position[2] + 2}}}
|
||||||
|
)
|
||||||
|
) do
|
||||||
|
if entities[e.name] and e.valid and e.health then
|
||||||
|
e.die()
|
||||||
|
elseif e.valid then
|
||||||
|
e.destroy()
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
if collapse.kill then
|
if collapse.kill then
|
||||||
local position = {tile.position.x + 0.5, tile.position.y + 0.5}
|
local position = {tile.position.x + 0.5, tile.position.y + 0.5}
|
||||||
for _, e in pairs(
|
for _, e in pairs(
|
||||||
@ -115,8 +130,6 @@ local function progress()
|
|||||||
) do
|
) do
|
||||||
if e.valid and e.health then
|
if e.valid and e.health then
|
||||||
e.die()
|
e.die()
|
||||||
elseif e.valid then
|
|
||||||
e.destroy()
|
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
@ -232,12 +245,23 @@ function Public.set_kill_entities(a)
|
|||||||
collapse.kill = a
|
collapse.kill = a
|
||||||
end
|
end
|
||||||
|
|
||||||
|
function Public.set_kill_specific_entities(tbl)
|
||||||
|
if tbl then
|
||||||
|
collapse.specific_entities = tbl
|
||||||
|
else
|
||||||
|
collapse.specific_entities = {
|
||||||
|
enabled = false
|
||||||
|
}
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
local function on_init()
|
local function on_init()
|
||||||
Public.set_surface(game.surfaces.nauvis)
|
Public.set_surface(game.surfaces.nauvis)
|
||||||
Public.set_position({0, 32})
|
Public.set_position({0, 32})
|
||||||
Public.set_max_line_size(256)
|
Public.set_max_line_size(256)
|
||||||
Public.set_direction('north')
|
Public.set_direction('north')
|
||||||
Public.set_kill_entities(true)
|
Public.set_kill_entities(true)
|
||||||
|
Public.set_kill_specific_entities()
|
||||||
collapse.tiles = nil
|
collapse.tiles = nil
|
||||||
collapse.speed = 1
|
collapse.speed = 1
|
||||||
collapse.amount = 8
|
collapse.amount = 8
|
||||||
|
Loading…
x
Reference in New Issue
Block a user