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

Various Diggy enhancements and updates

This commit is contained in:
Bluerock 2020-08-07 20:24:07 -04:00
parent dbdd241c86
commit 0afdbcb472
8 changed files with 43 additions and 34 deletions

View File

@ -83,6 +83,7 @@ local Config = {
collapse_threshold_total_strength = 16,
support_beam_entities = {
['market'] = 9,
['nuclear-reactor'] = 4,
['stone-wall'] = 3,
['sand-rock-big'] = 2,
['rock-big'] = 2,

View File

@ -76,7 +76,7 @@ local do_alien_mining = Token.register(function(params)
for rock_index = rock_count, 1, -1 do
local rock = rocks[rock_index]
raise_event(defines.events.script_raised_destroy, {entity = rock, cause = "alien_emerges"})
raise_event(defines.events.script_raised_destroy, {entity = rock, cause = "alien_emerges"})
destroy_rock(create_particle, particle_count, rock.position)
rock.destroy()
end

View File

@ -117,7 +117,14 @@ local function create_collapse_template(positions, surface)
if strength then
do_insert = false
else
entity.die()
if entity.name ~= 'tank' then
entity.die()
else
entity.health = entity.health - 100
if entity.health == 0 then
entity.die()
end
end
end
end
)
@ -288,7 +295,7 @@ local function script_raised_destroy(event)
local name = entity.name
local strength = support_beam_entities[name]
if strength then
stress_map_add(entity.surface, entity.position, strength, false, player_index)
stress_map_add(entity.surface, entity.position, strength, false)
end
end

View File

@ -166,7 +166,7 @@ Command.add('diggy-clear-void', {
end
end
Template.insert(game.surfaces[arguments.surface_index], tiles, {})
Template.insert(game.surfaces[tonumber(arguments.surface_index)], tiles, {})
end)
--[[--
@ -209,17 +209,19 @@ function DiggyHole.register(cfg)
local entity = event.entity
local name = entity.name
if entity.health ~= 0 then
return
end
if not is_diggy_rock(name) then
return
end
raise_event(defines.events.script_raised_destroy, {entity = entity, cause = "die_faster"})
destroy_rock(entity.surface.create_particle, 10, entity.position)
entity.destroy()
local cause = event.cause
local health = entity.health
-- Diggy rock is destroyed if health is zero or less than 1500 when damaged by a tank (tank buff)
if health == 0 or (cause and cause.name == "tank" and health < 1500 and event.damage_type.valid and event.damage_type.name ~= 'fire') then
raise_event(defines.events.script_raised_destroy, {entity = entity, cause = "die_faster"})
destroy_rock(entity.surface.create_particle, 10, entity.position)
entity.destroy()
end
end)
Event.add(defines.events.on_robot_mined_entity, function (event)

View File

@ -13,7 +13,6 @@ local pairs = pairs
local perlin_noise = require 'map_gen.shared.perlin_noise'.noise
local template_insert = Template.insert
local set_timeout_in_ticks = Task.set_timeout_in_ticks
local on_entity_died = defines.events.on_entity_died
-- this
local SimpleRoomGenerator = {}

View File

@ -40,9 +40,9 @@ return {
}
},
weights = {
['iron-ore'] = 860,
['coal'] = 85,
['stone'] = 55,
['iron-ore'] = 900,
['coal'] = 61,
['stone'] = 39,
},
distances = {
['coal'] = 16,
@ -51,9 +51,10 @@ return {
},
},
{ -- tendril medium large impure copper
yield=0.92,
-- 07/09/2000 start with a little less yeild near origin but grow in richness faster with distance
yield=0.85,
min_distance=25,
distance_richness=9,
distance_richness=6,
color={r=255/255, g=55/255, b=0/255},
noise_settings = {
type = "connected_tendril",
@ -66,9 +67,9 @@ return {
}
},
weights = {
['copper-ore'] = 860,
['coal'] = 85,
['stone'] = 55,
['copper-ore'] = 900,
['coal'] = 61,
['stone'] = 39,
},
distances = {
['coal'] = 16,
@ -77,9 +78,9 @@ return {
},
},
{ -- tendril medium impure coal
yield=0.5,
yield=0.55,
min_distance=25,
distance_richness=9,
distance_richness=11,
color={r=0/255, g=0/255, b=0/255},
noise_settings = {
type = "connected_tendril",
@ -103,9 +104,9 @@ return {
},
},
{ -- tendril medium impure stone
yield=0.35,
yield=0.38,
min_distance=25,
distance_richness=9,
distance_richness=11,
color={r=100/255, g=100/255, b=100/255},
noise_settings = {
type = "connected_tendril",
@ -130,8 +131,8 @@ return {
},
{ -- tendril small uranium
yield=0.2,
min_distance=86,
distance_richness=9,
min_distance=128,
distance_richness=12,
color={r=0/255, g=0/255, b=0/255},
noise_settings = {
type = "connected_tendril",
@ -151,9 +152,9 @@ return {
},
},
{ -- scattered tendril fragments
yield=0.2,
yield=0.22,
min_distance=10,
distance_richness=7,
distance_richness=12,
color={r=0/255, g=0/255, b=0/255},
noise_settings = {
type = "fragmented_tendril",
@ -186,7 +187,7 @@ return {
},
},
{ -- crude oil
yield=1.7,
yield=1.2,
min_distance=57,
distance_richness=9,
color={r=0/255, g=255/255, b=255/255},

View File

@ -73,9 +73,6 @@ function Scenario.register()
end
)
local landfill_tiles = {'dirt-1','dirt-2','dirt-3','dirt-4','dirt-5','dirt-6','dirt-7'}
require ('map_gen.shared.change_landfill_tile')(landfill_tiles)
ScenarioInfo.set_map_name('Diggy')
ScenarioInfo.set_map_description('Dig your way through!')

View File

@ -143,8 +143,10 @@ local on_died =
local spawned = create_entity({name = hydra_spawn, force = force, position = position})
if spawned and spawned.type == 'unit' then
spawned.set_command(command)
elseif spawned and cause and cause.valid and cause.force then
spawned.shooting_target = cause
elseif spawned and cause and cause.valid and cause.force and cause.force.valid then
if cause.name ~= 'tank' then
spawned.shooting_target = cause
end
end
end
end