mirror of
https://github.com/ComfyFactory/ComfyFactorio.git
synced 2025-02-09 13:37:02 +02:00
Merge pull request #166 from ComfyFactory/changes
Changes to modules and mtn v3
This commit is contained in:
commit
3681a4cd6d
18
chatbot.lua
18
chatbot.lua
@ -206,6 +206,7 @@ local function on_console_command(event)
|
||||
|
||||
local commands = {
|
||||
['editor'] = true,
|
||||
['command'] = true,
|
||||
['silent-command'] = true,
|
||||
['sc'] = true,
|
||||
['debug'] = true
|
||||
@ -216,28 +217,19 @@ local function on_console_command(event)
|
||||
end
|
||||
|
||||
if player then
|
||||
for _, p in pairs(game.connected_players) do
|
||||
if p.admin == true and p.name ~= player.name then
|
||||
if param then
|
||||
p.print(player.name .. ' ran: ' .. cmd .. ' "' .. param .. '" ' .. server_time, {r = 0.22, g = 0.99, b = 0.99})
|
||||
else
|
||||
p.print(player.name .. ' ran: ' .. cmd .. server_time, {r = 0.22, g = 0.99, b = 0.99})
|
||||
end
|
||||
end
|
||||
end
|
||||
if param then
|
||||
print(player.name .. ' ran: ' .. cmd .. ' "' .. param .. '" ' .. server_time)
|
||||
print('[COMMAND HANDLER] ' .. player.name .. ' ran: ' .. cmd .. ' "' .. param .. '" ' .. server_time)
|
||||
return
|
||||
else
|
||||
print(player.name .. ' ran: ' .. cmd .. server_time)
|
||||
print('[COMMAND HANDLER] ' .. player.name .. ' ran: ' .. cmd .. server_time)
|
||||
return
|
||||
end
|
||||
else
|
||||
if param then
|
||||
print('ran: ' .. cmd .. ' "' .. param .. '" ' .. server_time)
|
||||
print('[COMMAND HANDLER] ran: ' .. cmd .. ' "' .. param .. '" ' .. server_time)
|
||||
return
|
||||
else
|
||||
print('ran: ' .. cmd .. server_time)
|
||||
print('[COMMAND HANDLER] ran: ' .. cmd .. server_time)
|
||||
return
|
||||
end
|
||||
end
|
||||
|
@ -689,7 +689,7 @@ local mining_events = {
|
||||
'Enemy Compilatron'
|
||||
},
|
||||
{
|
||||
function(entity, index)
|
||||
function(entity)
|
||||
local chest = 'crash-site-chest-' .. random(1, 2)
|
||||
if entity.surface.can_place_entity({name = chest, position = entity.position, force = 'neutral'}) then
|
||||
local container = entity.surface.create_entity({name = chest, position = entity.position, force = 'neutral'})
|
||||
@ -698,13 +698,6 @@ local mining_events = {
|
||||
container.health = random(1, container.health)
|
||||
end
|
||||
end
|
||||
local position = entity.position
|
||||
local surface = entity.surface
|
||||
surface.create_entity({name = 'car', position = position, force = 'player'})
|
||||
Public.unstuck_player(index)
|
||||
local player = game.players[index]
|
||||
local msg = ({'entity.found_car', player.name})
|
||||
Alert.alert_player(player, 15, msg)
|
||||
end,
|
||||
64,
|
||||
'VSMG'
|
||||
|
@ -344,9 +344,9 @@ local function do_place_entities(data)
|
||||
if surface.can_place_entity(e) then
|
||||
entity = surface.create_entity(e)
|
||||
if entity then
|
||||
if e.note and e.note == 'wall' then
|
||||
local wall_defenders_health_modifier = WD.get('biter_health_boost')
|
||||
BiterHealthBooster.add_unit(entity, wall_defenders_health_modifier)
|
||||
if e.note then
|
||||
local modified_unit_health = WD.get('modified_unit_health')
|
||||
BiterHealthBooster.add_unit(entity, modified_unit_health.current_value)
|
||||
end
|
||||
wintery(entity)
|
||||
if e.direction then
|
||||
@ -377,9 +377,9 @@ local function do_place_entities(data)
|
||||
else
|
||||
entity = surface.create_entity(e)
|
||||
if entity then
|
||||
if e.note and e.note == 'wall' then
|
||||
local wall_defenders_health_modifier = WD.get('biter_health_boost')
|
||||
BiterHealthBooster.add_unit(entity, wall_defenders_health_modifier)
|
||||
if e.note then
|
||||
local modified_unit_health = WD.get('modified_unit_health')
|
||||
BiterHealthBooster.add_unit(entity, modified_unit_health.current_value)
|
||||
end
|
||||
wintery(entity)
|
||||
if e.direction then
|
||||
|
135
maps/mountain_fortress_v3/get_perlin.lua
Normal file
135
maps/mountain_fortress_v3/get_perlin.lua
Normal file
@ -0,0 +1,135 @@
|
||||
local simplex_noise = require 'utils.simplex_noise'.d2
|
||||
|
||||
--add or use noise templates from here
|
||||
local noises = {
|
||||
['bb_biterland'] = {
|
||||
{modifier = 0.001, weight = 1},
|
||||
{modifier = 0.01, weight = 0.35},
|
||||
{modifier = 0.1, weight = 0.015}
|
||||
},
|
||||
['bb_ore'] = {{modifier = 0.0042, weight = 1}, {modifier = 0.031, weight = 0.08}, {modifier = 0.1, weight = 0.025}},
|
||||
['cave_ponds'] = {{modifier = 0.01, weight = 0.75}, {modifier = 0.15, weight = 0.08}},
|
||||
['smol_areas'] = {{modifier = 0.005, weight = 0.85}, {modifier = 0.15, weight = 0.025}, {modifier = 0.15, weight = 0.035}},
|
||||
['cave_worms'] = {{modifier = 0.001, weight = 1}, {modifier = 0.1, weight = 0.06}},
|
||||
['cave_rivers'] = {
|
||||
{modifier = 0.007, weight = 0.75},
|
||||
{modifier = 0.0090, weight = 0.30},
|
||||
{modifier = 0.075, weight = 0.03}
|
||||
},
|
||||
['cave_rivers_2'] = {
|
||||
{modifier = 0.003, weight = 1},
|
||||
{modifier = 0.01, weight = 0.21},
|
||||
{modifier = 0.05, weight = 0.01}
|
||||
},
|
||||
['cave_rivers_3'] = {
|
||||
{modifier = 0.002, weight = 1},
|
||||
{modifier = 0.01, weight = 0.15},
|
||||
{modifier = 0.05, weight = 0.01}
|
||||
},
|
||||
['cave_rivers_4'] = {
|
||||
{modifier = 0.001, weight = 1},
|
||||
{modifier = 0.01, weight = 0.11},
|
||||
{modifier = 0.05, weight = 0.01}
|
||||
},
|
||||
['decoratives'] = {{modifier = 0.03, weight = 1}, {modifier = 0.05, weight = 0.25}, {modifier = 0.1, weight = 0.05}},
|
||||
['dungeons'] = {{modifier = 0.003, weight = 1}, {modifier = 0.006, weight = 0.25}},
|
||||
['dungeon_sewer'] = {
|
||||
{modifier = 0.0005, weight = 1},
|
||||
{modifier = 0.005, weight = 0.015},
|
||||
{modifier = 0.025, weight = 0.0015}
|
||||
},
|
||||
['large_caves'] = {
|
||||
{modifier = 0.0033, weight = 1},
|
||||
{modifier = 0.01, weight = 0.22},
|
||||
{modifier = 0.05, weight = 0.05},
|
||||
{modifier = 0.1, weight = 0.04}
|
||||
},
|
||||
['n1'] = {{modifier = 0.0001, weight = 1}},
|
||||
['n2'] = {{modifier = 0.001, weight = 1}},
|
||||
['n3'] = {{modifier = 0.01, weight = 1}},
|
||||
['n4'] = {{modifier = 0.1, weight = 1}},
|
||||
['n5'] = {{modifier = 0.07, weight = 1}},
|
||||
['watery_world'] = {
|
||||
{modifier = 0.0007, weight = 1},
|
||||
{modifier = 0.01, weight = 0.02},
|
||||
{modifier = 0.1, weight = 0.005}
|
||||
},
|
||||
['no_rocks'] = {
|
||||
{modifier = 0.0045, weight = 0.95},
|
||||
{modifier = 0.017, weight = 0.25},
|
||||
{modifier = 0.045, weight = 0.045},
|
||||
{modifier = 0.088, weight = 0.035}
|
||||
},
|
||||
['no_rocks_2'] = {{modifier = 0.016, weight = 1.15}, {modifier = 0.13, weight = 0.095}},
|
||||
['oasis'] = {
|
||||
{modifier = 0.0015, weight = 1},
|
||||
{modifier = 0.0025, weight = 0.5},
|
||||
{modifier = 0.01, weight = 0.15},
|
||||
{modifier = 0.1, weight = 0.017}
|
||||
},
|
||||
['scrapyard'] = {
|
||||
{modifier = 0.005, weight = 1},
|
||||
{modifier = 0.01, weight = 0.35},
|
||||
{modifier = 0.05, weight = 0.23},
|
||||
{modifier = 0.1, weight = 0.11}
|
||||
},
|
||||
['big_cave'] = {
|
||||
{modifier = 0.003, weight = 1},
|
||||
{modifier = 0.02, weight = 0.05},
|
||||
{modifier = 0.15, weight = 0.02}
|
||||
},
|
||||
['small_caves'] = {
|
||||
{modifier = 0.006, weight = 1},
|
||||
{modifier = 0.04, weight = 0.15},
|
||||
{modifier = 0.22, weight = 0.05}
|
||||
},
|
||||
['small_caves_2'] = {
|
||||
{modifier = 0.009, weight = 1},
|
||||
{modifier = 0.05, weight = 0.25},
|
||||
{modifier = 0.25, weight = 0.05}
|
||||
},
|
||||
['forest_location'] = {
|
||||
{modifier = 0.006, weight = 1},
|
||||
{modifier = 0.01, weight = 0.25},
|
||||
{modifier = 0.05, weight = 0.15},
|
||||
{modifier = 0.1, weight = 0.05}
|
||||
},
|
||||
['forest_density'] = {
|
||||
{modifier = 0.01, weight = 1},
|
||||
{modifier = 0.05, weight = 0.5},
|
||||
{modifier = 0.1, weight = 0.025}
|
||||
},
|
||||
['cave_miner_01'] = {
|
||||
{modifier = 0.002, weight = 1},
|
||||
{modifier = 0.003, weight = 0.5},
|
||||
{modifier = 0.01, weight = 0.01},
|
||||
{modifier = 0.1, weight = 0.015}
|
||||
},
|
||||
['cave_miner_02'] = {
|
||||
{modifier = 0.006, weight = 1},
|
||||
{modifier = 0.02, weight = 0.15},
|
||||
{modifier = 0.25, weight = 0.025}
|
||||
},
|
||||
['cm_ponds'] = {{modifier = 0.025, weight = 1}, {modifier = 0.05, weight = 0.25}, {modifier = 0.1, weight = 0.05}},
|
||||
['cm_ocean'] = {
|
||||
{modifier = 0.002, weight = 1},
|
||||
{modifier = 0.004, weight = 1},
|
||||
{modifier = 0.02, weight = 0.05}
|
||||
}
|
||||
}
|
||||
|
||||
--returns a float number between -1 and 1
|
||||
local function get_noise(name, pos, seed)
|
||||
local noise = 0
|
||||
local d = 0
|
||||
for i = 1, #noises[name] do
|
||||
local mod = noises[name]
|
||||
noise = noise + simplex_noise(pos.x * mod[i].modifier, pos.y * mod[i].modifier, seed, 0xF) * mod[i].weight
|
||||
d = d + mod[i].weight
|
||||
seed = seed + seed / seed
|
||||
end
|
||||
noise = noise / d
|
||||
return noise
|
||||
end
|
||||
|
||||
return get_noise
|
@ -3,7 +3,7 @@ local Biters = require 'modules.wave_defense.biter_rolls'
|
||||
local Functions = require 'maps.mountain_fortress_v3.functions'
|
||||
local Generate_resources = require 'maps.mountain_fortress_v3.resource_generator'
|
||||
local WPT = require 'maps.mountain_fortress_v3.table'
|
||||
local get_perlin = require 'utils.get_perlin'
|
||||
local get_perlin = require 'maps.mountain_fortress_v3.get_perlin'
|
||||
|
||||
local Public = {}
|
||||
local random = math.random
|
||||
@ -228,7 +228,7 @@ local function spawn_turret(entities, p, probability)
|
||||
callback = turret_list[probability].callback,
|
||||
direction = 4,
|
||||
collision = true,
|
||||
note = 'wall'
|
||||
note = true
|
||||
}
|
||||
end
|
||||
|
||||
@ -371,7 +371,7 @@ local function wall(p, data)
|
||||
name = Biters.wave_defense_roll_worm_name(),
|
||||
position = p,
|
||||
force = 'enemy',
|
||||
note = 'wall'
|
||||
note = true
|
||||
}
|
||||
end
|
||||
end
|
||||
@ -451,7 +451,12 @@ local function process_level_14_position(x, y, data)
|
||||
end
|
||||
if random(1, 128) == 1 then
|
||||
Biters.wave_defense_set_worm_raffle(abs(p.y) * worm_level_modifier)
|
||||
entities[#entities + 1] = {name = Biters.wave_defense_roll_worm_name(), position = p, force = 'enemy'}
|
||||
entities[#entities + 1] = {
|
||||
name = Biters.wave_defense_roll_worm_name(),
|
||||
position = p,
|
||||
force = 'enemy',
|
||||
note = true
|
||||
}
|
||||
end
|
||||
if random(1, 256) == 1 then
|
||||
spawn_turret(entities, p, 4)
|
||||
@ -526,7 +531,12 @@ local function process_level_13_position(x, y, data)
|
||||
end
|
||||
if random(1, 128) == 1 then
|
||||
Biters.wave_defense_set_worm_raffle(abs(p.y) * worm_level_modifier)
|
||||
entities[#entities + 1] = {name = Biters.wave_defense_roll_worm_name(), position = p, force = 'enemy'}
|
||||
entities[#entities + 1] = {
|
||||
name = Biters.wave_defense_roll_worm_name(),
|
||||
position = p,
|
||||
force = 'enemy',
|
||||
note = true
|
||||
}
|
||||
end
|
||||
if random(1, 256) == 1 then
|
||||
spawn_turret(entities, p, 4)
|
||||
@ -779,7 +789,12 @@ local function process_level_10_position(x, y, data)
|
||||
if abs(scrapyard) > 0.40 and abs(scrapyard) < 0.65 then
|
||||
if random(1, 64) == 1 then
|
||||
Biters.wave_defense_set_worm_raffle(abs(p.y) * worm_level_modifier)
|
||||
entities[#entities + 1] = {name = Biters.wave_defense_roll_worm_name(), position = p, force = 'enemy'}
|
||||
entities[#entities + 1] = {
|
||||
name = Biters.wave_defense_roll_worm_name(),
|
||||
position = p,
|
||||
force = 'enemy',
|
||||
note = true
|
||||
}
|
||||
end
|
||||
tiles[#tiles + 1] = {name = 'water-mud', position = p}
|
||||
return
|
||||
@ -791,7 +806,12 @@ local function process_level_10_position(x, y, data)
|
||||
end
|
||||
if random(1, 128) == 1 then
|
||||
Biters.wave_defense_set_worm_raffle(abs(p.y) * worm_level_modifier)
|
||||
entities[#entities + 1] = {name = Biters.wave_defense_roll_worm_name(), position = p, force = 'enemy'}
|
||||
entities[#entities + 1] = {
|
||||
name = Biters.wave_defense_roll_worm_name(),
|
||||
position = p,
|
||||
force = 'enemy',
|
||||
note = true
|
||||
}
|
||||
end
|
||||
if random(1, 256) == 1 then
|
||||
spawn_turret(entities, p, 4)
|
||||
@ -807,7 +827,8 @@ local function process_level_10_position(x, y, data)
|
||||
entities[#entities + 1] = {
|
||||
name = Biters.wave_defense_roll_worm_name(),
|
||||
position = p,
|
||||
force = 'enemy'
|
||||
force = 'enemy',
|
||||
note = true
|
||||
}
|
||||
end
|
||||
if noise_forest_location > 0.6 then
|
||||
@ -828,7 +849,8 @@ local function process_level_10_position(x, y, data)
|
||||
entities[#entities + 1] = {
|
||||
name = Biters.wave_defense_roll_worm_name(),
|
||||
position = p,
|
||||
force = 'enemy'
|
||||
force = 'enemy',
|
||||
note = true
|
||||
}
|
||||
end
|
||||
if noise_forest_location < -0.6 then
|
||||
@ -872,7 +894,12 @@ local function process_level_9_position(x, y, data)
|
||||
end
|
||||
if random(1, 256) == 1 then
|
||||
Biters.wave_defense_set_worm_raffle(abs(p.y) * worm_level_modifier)
|
||||
entities[#entities + 1] = {name = Biters.wave_defense_roll_worm_name(), position = p, force = 'enemy'}
|
||||
entities[#entities + 1] = {
|
||||
name = Biters.wave_defense_roll_worm_name(),
|
||||
position = p,
|
||||
force = 'enemy',
|
||||
note = true
|
||||
}
|
||||
end
|
||||
return
|
||||
end
|
||||
@ -967,7 +994,12 @@ local function process_scrap_zone_1(x, y, data, void_or_lab)
|
||||
end
|
||||
if random(1, 128) == 1 then
|
||||
Biters.wave_defense_set_worm_raffle(abs(p.y) * worm_level_modifier)
|
||||
entities[#entities + 1] = {name = Biters.wave_defense_roll_worm_name(), position = p, force = 'enemy'}
|
||||
entities[#entities + 1] = {
|
||||
name = Biters.wave_defense_roll_worm_name(),
|
||||
position = p,
|
||||
force = 'enemy',
|
||||
note = true
|
||||
}
|
||||
end
|
||||
if random(1, 96) == 1 then
|
||||
entities[#entities + 1] = {
|
||||
@ -1202,7 +1234,8 @@ local function process_forest_zone_2(x, y, data, void_or_lab)
|
||||
entities[#entities + 1] = {
|
||||
name = Biters.wave_defense_roll_worm_name(),
|
||||
position = p,
|
||||
force = 'enemy'
|
||||
force = 'enemy',
|
||||
note = true
|
||||
}
|
||||
end
|
||||
|
||||
@ -1219,7 +1252,12 @@ local function process_forest_zone_2(x, y, data, void_or_lab)
|
||||
end
|
||||
if random(1, 128) == 1 then
|
||||
Biters.wave_defense_set_worm_raffle(abs(p.y) * worm_level_modifier)
|
||||
entities[#entities + 1] = {name = Biters.wave_defense_roll_worm_name(), position = p, force = 'enemy'}
|
||||
entities[#entities + 1] = {
|
||||
name = Biters.wave_defense_roll_worm_name(),
|
||||
position = p,
|
||||
force = 'enemy',
|
||||
note = true
|
||||
}
|
||||
end
|
||||
if random(1, 256) == 1 then
|
||||
spawn_turret(entities, p, 4)
|
||||
@ -1233,7 +1271,8 @@ local function process_forest_zone_2(x, y, data, void_or_lab)
|
||||
entities[#entities + 1] = {
|
||||
name = Biters.wave_defense_roll_worm_name(),
|
||||
position = p,
|
||||
force = 'enemy'
|
||||
force = 'enemy',
|
||||
note = true
|
||||
}
|
||||
end
|
||||
if noise_forest_location > 0.6 then
|
||||
@ -1254,7 +1293,8 @@ local function process_forest_zone_2(x, y, data, void_or_lab)
|
||||
entities[#entities + 1] = {
|
||||
name = Biters.wave_defense_roll_worm_name(),
|
||||
position = p,
|
||||
force = 'enemy'
|
||||
force = 'enemy',
|
||||
note = true
|
||||
}
|
||||
end
|
||||
if noise_forest_location < -0.6 then
|
||||
@ -1312,7 +1352,12 @@ local function process_level_5_position(x, y, data, void_or_lab)
|
||||
end
|
||||
if random(1, 128) == 1 then
|
||||
Biters.wave_defense_set_worm_raffle(abs(p.y) * worm_level_modifier)
|
||||
entities[#entities + 1] = {name = Biters.wave_defense_roll_worm_name(), position = p, force = 'enemy'}
|
||||
entities[#entities + 1] = {
|
||||
name = Biters.wave_defense_roll_worm_name(),
|
||||
position = p,
|
||||
force = 'enemy',
|
||||
note = true
|
||||
}
|
||||
end
|
||||
if random(1, 256) == 1 then
|
||||
spawn_turret(entities, p, 4)
|
||||
@ -1331,7 +1376,8 @@ local function process_level_5_position(x, y, data, void_or_lab)
|
||||
entities[#entities + 1] = {
|
||||
name = Biters.wave_defense_roll_worm_name(),
|
||||
position = p,
|
||||
force = 'enemy'
|
||||
force = 'enemy',
|
||||
note = true
|
||||
}
|
||||
end
|
||||
|
||||
@ -1404,7 +1450,12 @@ local function process_level_4_position(x, y, data, void_or_lab)
|
||||
end
|
||||
if random(1, 384) == 1 then
|
||||
Biters.wave_defense_set_worm_raffle(abs(p.y) * worm_level_modifier)
|
||||
entities[#entities + 1] = {name = Biters.wave_defense_roll_worm_name(), position = p, force = 'enemy'}
|
||||
entities[#entities + 1] = {
|
||||
name = Biters.wave_defense_roll_worm_name(),
|
||||
position = p,
|
||||
force = 'enemy',
|
||||
note = true
|
||||
}
|
||||
end
|
||||
local success = place_wagon(data)
|
||||
if success then
|
||||
@ -1461,7 +1512,8 @@ local function process_level_4_position(x, y, data, void_or_lab)
|
||||
entities[#entities + 1] = {
|
||||
name = Biters.wave_defense_roll_worm_name(),
|
||||
position = p,
|
||||
force = 'enemy'
|
||||
force = 'enemy',
|
||||
note = true
|
||||
}
|
||||
end
|
||||
|
||||
@ -1506,6 +1558,7 @@ local function process_level_3_position(x, y, data, void_or_lab)
|
||||
local small_caves_2 = get_perlin('small_caves_2', p, seed + 70000)
|
||||
local noise_large_caves = get_perlin('large_caves', p, seed + 60000)
|
||||
local noise_cave_ponds = get_perlin('cave_ponds', p, seed)
|
||||
local cave_miner = get_perlin('cave_miner_01', p, seed)
|
||||
local smol_areas = get_perlin('smol_areas', p, seed + 60000)
|
||||
|
||||
--Resource Spots
|
||||
@ -1519,7 +1572,8 @@ local function process_level_3_position(x, y, data, void_or_lab)
|
||||
entities[#entities + 1] = {
|
||||
name = Biters.wave_defense_roll_worm_name(),
|
||||
position = p,
|
||||
force = 'enemy'
|
||||
force = 'enemy',
|
||||
note = true
|
||||
}
|
||||
end
|
||||
return
|
||||
@ -1607,7 +1661,8 @@ local function process_level_3_position(x, y, data, void_or_lab)
|
||||
entities[#entities + 1] = {
|
||||
name = Biters.wave_defense_roll_worm_name(),
|
||||
position = p,
|
||||
force = 'enemy'
|
||||
force = 'enemy',
|
||||
note = true
|
||||
}
|
||||
end
|
||||
|
||||
@ -1649,7 +1704,11 @@ local function process_level_3_position(x, y, data, void_or_lab)
|
||||
return
|
||||
end
|
||||
|
||||
if cave_miner < 0.32 and cave_miner > -0.32 then
|
||||
tiles[#tiles + 1] = {name = void_or_lab, position = p}
|
||||
else
|
||||
tiles[#tiles + 1] = {name = 'deepwater-green', position = p}
|
||||
end
|
||||
end
|
||||
|
||||
local function process_level_2_position(x, y, data, void_or_lab)
|
||||
@ -1676,7 +1735,8 @@ local function process_level_2_position(x, y, data, void_or_lab)
|
||||
entities[#entities + 1] = {
|
||||
name = Biters.wave_defense_roll_worm_name(),
|
||||
position = p,
|
||||
force = 'enemy'
|
||||
force = 'enemy',
|
||||
note = true
|
||||
}
|
||||
end
|
||||
return
|
||||
@ -1749,7 +1809,8 @@ local function process_level_2_position(x, y, data, void_or_lab)
|
||||
entities[#entities + 1] = {
|
||||
name = Biters.wave_defense_roll_worm_name(),
|
||||
position = p,
|
||||
force = 'enemy'
|
||||
force = 'enemy',
|
||||
note = true
|
||||
}
|
||||
end
|
||||
|
||||
@ -1818,7 +1879,8 @@ local function process_forest_zone_1(x, y, data, void_or_lab)
|
||||
entities[#entities + 1] = {
|
||||
name = Biters.wave_defense_roll_worm_name(),
|
||||
position = p,
|
||||
force = 'enemy'
|
||||
force = 'enemy',
|
||||
note = true
|
||||
}
|
||||
end
|
||||
return
|
||||
@ -1839,7 +1901,7 @@ local function process_forest_zone_1(x, y, data, void_or_lab)
|
||||
--Water Ponds
|
||||
if noise_cave_ponds > 0.670 then
|
||||
if noise_cave_ponds > 0.750 then
|
||||
tiles[#tiles + 1] = {name = 'grass-' .. floor(noise_cave_ponds * 32) % 3 + 1, position = p}
|
||||
tiles[#tiles + 1] = {name = 'landfill', position = p}
|
||||
if random(1, 4) == 1 then
|
||||
markets[#markets + 1] = p
|
||||
end
|
||||
@ -1868,8 +1930,7 @@ local function process_forest_zone_1(x, y, data, void_or_lab)
|
||||
end
|
||||
|
||||
if noise_cave_ponds > 0.74 then
|
||||
tiles[#tiles + 1] = {name = 'grass-' .. random(1, 4), position = p}
|
||||
tiles[#tiles + 1] = {name = 'grass-1', position = p}
|
||||
tiles[#tiles + 1] = {name = 'landfill', position = p}
|
||||
if cave_rivers < -0.502 then
|
||||
tiles[#tiles + 1] = {name = 'refined-hazard-concrete-right', position = p}
|
||||
end
|
||||
@ -1884,7 +1945,7 @@ local function process_forest_zone_1(x, y, data, void_or_lab)
|
||||
if p.y < -64 + noise_cave_ponds * 10 then
|
||||
if no_rocks < 0.11 and no_rocks > -0.11 then
|
||||
if small_caves > 0.31 then
|
||||
tiles[#tiles + 1] = {name = 'grass-' .. floor(noise_cave_ponds * 32) % 3 + 1, position = p}
|
||||
tiles[#tiles + 1] = {name = 'brown-refined-concrete', position = p}
|
||||
if random(1, 450) == 1 then
|
||||
entities[#entities + 1] = {name = 'crude-oil', position = p, amount = get_oil_amount(p)}
|
||||
end
|
||||
@ -1893,7 +1954,8 @@ local function process_forest_zone_1(x, y, data, void_or_lab)
|
||||
entities[#entities + 1] = {
|
||||
name = Biters.wave_defense_roll_worm_name(),
|
||||
position = p,
|
||||
force = 'enemy'
|
||||
force = 'enemy',
|
||||
note = true
|
||||
}
|
||||
end
|
||||
|
||||
@ -1915,7 +1977,7 @@ local function process_forest_zone_1(x, y, data, void_or_lab)
|
||||
if success then
|
||||
return
|
||||
end
|
||||
tiles[#tiles + 1] = {name = 'dirt-' .. floor(no_rocks_2 * 8) % 2 + 5, position = p}
|
||||
tiles[#tiles + 1] = {name = 'nuclear-ground', position = p}
|
||||
if random(1, 32) == 1 then
|
||||
entities[#entities + 1] = {name = 'tree-0' .. random(1, 9), position = p}
|
||||
end
|
||||
@ -1929,7 +1991,7 @@ local function process_forest_zone_1(x, y, data, void_or_lab)
|
||||
if random(1, 2048) == 1 then
|
||||
treasure[#treasure + 1] = {position = p, chest = 'iron-chest'}
|
||||
end
|
||||
tiles[#tiles + 1] = {name = 'grass-' .. floor(noise_cave_ponds * 32) % 3 + 1, position = p}
|
||||
tiles[#tiles + 1] = {name = 'landfill', position = p}
|
||||
local noise_forest_location = get_perlin('forest_location', p, seed)
|
||||
if noise_forest_location > 0.095 then
|
||||
if random(1, 256) == 1 then
|
||||
@ -1937,7 +1999,8 @@ local function process_forest_zone_1(x, y, data, void_or_lab)
|
||||
entities[#entities + 1] = {
|
||||
name = Biters.wave_defense_roll_worm_name(),
|
||||
position = p,
|
||||
force = 'enemy'
|
||||
force = 'enemy',
|
||||
note = true
|
||||
}
|
||||
end
|
||||
if noise_forest_location > 0.6 then
|
||||
@ -1958,7 +2021,8 @@ local function process_forest_zone_1(x, y, data, void_or_lab)
|
||||
entities[#entities + 1] = {
|
||||
name = Biters.wave_defense_roll_worm_name(),
|
||||
position = p,
|
||||
force = 'enemy'
|
||||
force = 'enemy',
|
||||
note = true
|
||||
}
|
||||
end
|
||||
if noise_forest_location < -0.6 then
|
||||
@ -1997,7 +2061,8 @@ local function process_level_1_position(x, y, data, void_or_lab)
|
||||
entities[#entities + 1] = {
|
||||
name = Biters.wave_defense_roll_worm_name(),
|
||||
position = p,
|
||||
force = 'enemy'
|
||||
force = 'enemy',
|
||||
note = true
|
||||
}
|
||||
end
|
||||
return
|
||||
@ -2047,8 +2112,7 @@ local function process_level_1_position(x, y, data, void_or_lab)
|
||||
end
|
||||
|
||||
if noise_cave_ponds > 0.74 then
|
||||
tiles[#tiles + 1] = {name = 'dirt-' .. random(4, 6), position = p}
|
||||
tiles[#tiles + 1] = {name = 'grass-1', position = p}
|
||||
tiles[#tiles + 1] = {name = 'acid-refined-concrete', position = p}
|
||||
if cave_rivers < -0.502 then
|
||||
tiles[#tiles + 1] = {name = 'refined-hazard-concrete-right', position = p}
|
||||
end
|
||||
@ -2063,7 +2127,7 @@ local function process_level_1_position(x, y, data, void_or_lab)
|
||||
if p.y < -64 + noise_cave_ponds * 10 then
|
||||
if no_rocks < 0.12 and no_rocks > -0.12 then
|
||||
if small_caves > 0.30 then
|
||||
tiles[#tiles + 1] = {name = 'dirt-' .. floor(noise_cave_ponds * 32) % 7 + 1, position = p}
|
||||
tiles[#tiles + 1] = {name = 'brown-refined-concrete', position = p}
|
||||
if random(1, 450) == 1 then
|
||||
entities[#entities + 1] = {name = 'crude-oil', position = p, amount = get_oil_amount(p)}
|
||||
end
|
||||
@ -2072,7 +2136,8 @@ local function process_level_1_position(x, y, data, void_or_lab)
|
||||
entities[#entities + 1] = {
|
||||
name = Biters.wave_defense_roll_worm_name(),
|
||||
position = p,
|
||||
force = 'enemy'
|
||||
force = 'enemy',
|
||||
note = true
|
||||
}
|
||||
end
|
||||
|
||||
@ -2094,7 +2159,7 @@ local function process_level_1_position(x, y, data, void_or_lab)
|
||||
if success then
|
||||
return
|
||||
end
|
||||
tiles[#tiles + 1] = {name = 'dirt-' .. floor(no_rocks_2 * 8) % 2 + 5, position = p}
|
||||
tiles[#tiles + 1] = {name = 'nuclear-ground', position = p}
|
||||
if random(1, 32) == 1 then
|
||||
entities[#entities + 1] = {name = 'tree-0' .. random(1, 9), position = p}
|
||||
end
|
||||
@ -2112,7 +2177,7 @@ local function process_level_1_position(x, y, data, void_or_lab)
|
||||
if random_tiles > 0.095 then
|
||||
if random_tiles > 0.6 then
|
||||
if random(1, 100) > 42 then
|
||||
tiles[#tiles + 1] = {name = 'sand-1', position = p}
|
||||
tiles[#tiles + 1] = {name = 'nuclear-ground', position = p}
|
||||
end
|
||||
else
|
||||
if random(1, 100) > 42 then
|
||||
@ -2124,7 +2189,7 @@ local function process_level_1_position(x, y, data, void_or_lab)
|
||||
if random_tiles < -0.095 then
|
||||
if random_tiles < -0.6 then
|
||||
if random(1, 100) > 42 then
|
||||
tiles[#tiles + 1] = {name = 'sand-1', position = p}
|
||||
tiles[#tiles + 1] = {name = 'nuclear-ground', position = p}
|
||||
end
|
||||
else
|
||||
if random(1, 100) > 42 then
|
||||
@ -2184,7 +2249,7 @@ local function process_level_0_position(x, y, data, void_or_lab)
|
||||
--Water Ponds
|
||||
if noise_cave_ponds > 0.64 then
|
||||
if noise_cave_ponds > 0.74 then
|
||||
tiles[#tiles + 1] = {name = 'grass-' .. floor(noise_cave_ponds * 32) % 3 + 1, position = p}
|
||||
tiles[#tiles + 1] = {name = 'acid-refined-concrete', position = p}
|
||||
if random(1, 4) == 1 then
|
||||
markets[#markets + 1] = p
|
||||
end
|
||||
@ -2226,7 +2291,7 @@ local function process_level_0_position(x, y, data, void_or_lab)
|
||||
--Worm oil Zones
|
||||
if no_rocks < 0.035 and no_rocks > -0.145 then
|
||||
if small_caves > 0.081 then
|
||||
tiles[#tiles + 1] = {name = 'grass-' .. floor(noise_cave_ponds * 32) % 3 + 1, position = p}
|
||||
tiles[#tiles + 1] = {name = 'brown-refined-concrete', position = p}
|
||||
if random(1, 250) == 1 then
|
||||
entities[#entities + 1] = {name = 'crude-oil', position = p, amount = get_oil_amount(p)}
|
||||
end
|
||||
@ -2255,7 +2320,7 @@ local function process_level_0_position(x, y, data, void_or_lab)
|
||||
if success then
|
||||
return
|
||||
end
|
||||
tiles[#tiles + 1] = {name = 'dirt-' .. floor(no_rocks_2 * 8) % 2 + 5, position = p}
|
||||
tiles[#tiles + 1] = {name = 'nuclear-ground', position = p}
|
||||
if random(1, 18) == 1 then
|
||||
entities[#entities + 1] = {name = 'tree-0' .. random(1, 9), position = p}
|
||||
end
|
||||
@ -2269,7 +2334,7 @@ local function process_level_0_position(x, y, data, void_or_lab)
|
||||
if random(1, 2048) == 1 then
|
||||
treasure[#treasure + 1] = {position = p, chest = 'iron-chest'}
|
||||
end
|
||||
tiles[#tiles + 1] = {name = 'dirt-7', position = p}
|
||||
tiles[#tiles + 1] = {name = 'nuclear-ground', position = p}
|
||||
if random(1, 100) > 25 then
|
||||
entities[#entities + 1] = {name = rock_raffle[random(1, size_of_rock_raffle)], position = p}
|
||||
end
|
||||
|
@ -21,7 +21,9 @@ local nth_tick = Public.nth_tick
|
||||
local main_frame_name = Public.main_frame_name
|
||||
|
||||
local sub = string.sub
|
||||
local round = math.round
|
||||
local random = math.random
|
||||
local abs = math.abs
|
||||
|
||||
local function on_gui_click(event)
|
||||
if not event then
|
||||
@ -329,7 +331,7 @@ local function regen_health_player(players)
|
||||
if heal_per_tick <= 0 then
|
||||
goto continue
|
||||
end
|
||||
heal_per_tick = math.round(heal_per_tick)
|
||||
heal_per_tick = round(heal_per_tick)
|
||||
if player and player.valid and not player.in_combat then
|
||||
if player.character and player.character.valid then
|
||||
player.character.health = player.character.health + heal_per_tick
|
||||
@ -368,7 +370,7 @@ local function regen_mana_player(players)
|
||||
if rpg_t.mana >= rpg_t.mana_max then
|
||||
rpg_t.mana = rpg_t.mana_max
|
||||
end
|
||||
rpg_t.mana = (math.round(rpg_t.mana * 10) / 10)
|
||||
rpg_t.mana = (round(rpg_t.mana * 10) / 10)
|
||||
end
|
||||
end
|
||||
|
||||
@ -450,20 +452,20 @@ local function one_punch(character, target, damage)
|
||||
}
|
||||
)
|
||||
|
||||
if math.abs(vector[1]) > math.abs(vector[2]) then
|
||||
local d = math.abs(vector[1])
|
||||
if math.abs(vector[1]) > 0 then
|
||||
if abs(vector[1]) > abs(vector[2]) then
|
||||
local d = abs(vector[1])
|
||||
if abs(vector[1]) > 0 then
|
||||
vector[1] = vector[1] / d
|
||||
end
|
||||
if math.abs(vector[2]) > 0 then
|
||||
if abs(vector[2]) > 0 then
|
||||
vector[2] = vector[2] / d
|
||||
end
|
||||
else
|
||||
local d = math.abs(vector[2])
|
||||
if math.abs(vector[2]) > 0 then
|
||||
local d = abs(vector[2])
|
||||
if abs(vector[2]) > 0 then
|
||||
vector[2] = vector[2] / d
|
||||
end
|
||||
if math.abs(vector[1]) > 0 and d > 0 then
|
||||
if abs(vector[1]) > 0 and d > 0 then
|
||||
vector[1] = vector[1] / d
|
||||
end
|
||||
end
|
||||
@ -473,12 +475,15 @@ local function one_punch(character, target, damage)
|
||||
|
||||
local a = 0.25
|
||||
|
||||
local cs = character.surface
|
||||
local cp = character.position
|
||||
|
||||
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 = {character.position.x + x + vector[1] * i, character.position.y + y + vector[2] * i}
|
||||
character.surface.create_trivial_smoke({name = 'train-smoke', position = p})
|
||||
for _, e in pairs(character.surface.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
|
||||
@ -596,7 +601,7 @@ local function on_entity_damaged(event)
|
||||
damage = damage - damage * entity.prototype.resistances.physical.percent
|
||||
end
|
||||
end
|
||||
damage = math.round(damage, 3)
|
||||
damage = round(damage, 3)
|
||||
if damage < 1 then
|
||||
damage = 1
|
||||
end
|
||||
@ -607,19 +612,16 @@ local function on_entity_damaged(event)
|
||||
--Cause a one punch.
|
||||
if enable_one_punch then
|
||||
if rpg_t.one_punch then
|
||||
if math.random(0, 999) < Public.get_one_punch_chance(cause.player) * 10 then
|
||||
one_punch(cause, entity, damage)
|
||||
if entity.valid then
|
||||
entity.die(entity.force.name, cause)
|
||||
end
|
||||
if random(0, 999) < Public.get_one_punch_chance(cause.player) * 10 then
|
||||
one_punch(cause, entity, damage) -- only kill the biters if their health is below or equal to zero
|
||||
return
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
--Floating messages and particle effects.
|
||||
if math.random(1, 7) == 1 then
|
||||
damage = damage * math.random(250, 350) * 0.01
|
||||
if random(1, 7) == 1 then
|
||||
damage = damage * random(250, 350) * 0.01
|
||||
cause.surface.create_entity(
|
||||
{
|
||||
name = 'flying-text',
|
||||
@ -630,7 +632,7 @@ local function on_entity_damaged(event)
|
||||
)
|
||||
cause.surface.create_entity({name = 'blood-explosion-huge', position = entity.position})
|
||||
else
|
||||
damage = damage * math.random(100, 125) * 0.01
|
||||
damage = damage * random(100, 125) * 0.01
|
||||
cause.player.create_local_flying_text(
|
||||
{
|
||||
text = math.floor(damage),
|
||||
@ -681,7 +683,7 @@ local function on_entity_damaged(event)
|
||||
end
|
||||
|
||||
local function on_player_repaired_entity(event)
|
||||
if math.random(1, 4) ~= 1 then
|
||||
if random(1, 4) ~= 1 then
|
||||
return
|
||||
end
|
||||
|
||||
@ -745,7 +747,7 @@ local function on_player_changed_position(event)
|
||||
give_player_flameboots(player)
|
||||
end
|
||||
|
||||
if math.random(1, 64) ~= 1 then
|
||||
if random(1, 64) ~= 1 then
|
||||
return
|
||||
end
|
||||
if not player.character then
|
||||
@ -852,7 +854,7 @@ local function on_player_crafted_item(event)
|
||||
|
||||
local item = event.item_stack
|
||||
|
||||
local amount = 0.30 * math.random(1, 2)
|
||||
local amount = 0.30 * random(1, 2)
|
||||
|
||||
if tweaked_crafting_items_enabled then
|
||||
if item and item.valid then
|
||||
@ -927,9 +929,9 @@ local function create_projectile(surface, name, position, force, target, max_ran
|
||||
end
|
||||
|
||||
local function get_near_coord_modifier(range)
|
||||
local coord = {x = (range * -1) + math.random(0, range * 2), y = (range * -1) + math.random(0, range * 2)}
|
||||
local coord = {x = (range * -1) + random(0, range * 2), y = (range * -1) + random(0, range * 2)}
|
||||
for i = 1, 5, 1 do
|
||||
local new_coord = {x = (range * -1) + math.random(0, range * 2), y = (range * -1) + math.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
|
||||
@ -957,7 +959,7 @@ local function damage_entity(e)
|
||||
return
|
||||
end
|
||||
|
||||
e.health = e.health - math.random(30, 90)
|
||||
e.health = e.health - random(30, 90)
|
||||
if e.health <= 0 then
|
||||
e.die('enemy')
|
||||
end
|
||||
@ -968,10 +970,10 @@ local function floaty_hearts(entity, c)
|
||||
local b = 1.35
|
||||
for _ = 1, c, 1 do
|
||||
local p = {
|
||||
(position.x + 0.4) + (b * -1 + math.random(0, b * 20) * 0.1),
|
||||
position.y + (b * -1 + math.random(0, b * 20) * 0.1)
|
||||
(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 = {math.random(150, 255), 0, 255}})
|
||||
entity.surface.create_entity({name = 'flying-text', position = p, text = '♥', color = {random(150, 255), 0, 255}})
|
||||
end
|
||||
end
|
||||
|
||||
@ -1140,7 +1142,7 @@ local function on_player_used_capsule(event)
|
||||
player.teleport(pos, surface)
|
||||
end
|
||||
rpg_t.mana = 0
|
||||
Public.damage_player_over_time(player, math.random(8, 16))
|
||||
Public.damage_player_over_time(player, random(8, 16))
|
||||
player.play_sound {path = 'utility/armor_insert', volume_modifier = 1}
|
||||
p(({'rpg_main.warped_ok'}), Color.info)
|
||||
rpg_t.mana = rpg_t.mana - object.mana_cost
|
||||
@ -1227,8 +1229,8 @@ end
|
||||
|
||||
local function tick()
|
||||
local ticker = game.tick
|
||||
local count = #game.connected_players
|
||||
local players = game.connected_players
|
||||
local count = #players
|
||||
local enable_flameboots = Public.get('rpg_extra').enable_flameboots
|
||||
local enable_mana = Public.get('rpg_extra').enable_mana
|
||||
|
||||
|
@ -69,12 +69,15 @@ end
|
||||
local function find_initial_spot(surface, position)
|
||||
local spot = WD.get('spot')
|
||||
if not spot then
|
||||
local pos = surface.find_non_colliding_position('stone-furnace', position, 128, 1)
|
||||
local pos = surface.find_non_colliding_position('rocket-silo', position, 128, 1)
|
||||
if not pos then
|
||||
pos = surface.find_non_colliding_position('stone-furnace', position, 148, 1)
|
||||
pos = surface.find_non_colliding_position('rocket-silo', position, 148, 1)
|
||||
end
|
||||
if not pos then
|
||||
pos = surface.find_non_colliding_position('stone-furnace', position, 164, 1)
|
||||
pos = surface.find_non_colliding_position('rocket-silo', position, 164, 1)
|
||||
end
|
||||
if not pos then
|
||||
pos = surface.find_non_colliding_position('rocket-silo', position, 200, 1)
|
||||
end
|
||||
if not pos then
|
||||
pos = position
|
||||
@ -200,7 +203,7 @@ local function get_spawn_pos()
|
||||
local initial_position = WD.get('spawn_position')
|
||||
|
||||
local located_position = find_initial_spot(surface, initial_position)
|
||||
local valid_position = surface.find_non_colliding_position('steel-chest', located_position, 32, 1)
|
||||
local valid_position = surface.find_non_colliding_position('stone-furnace', located_position, 32, 1)
|
||||
local debug = WD.get('debug')
|
||||
if debug then
|
||||
if valid_position then
|
||||
@ -413,6 +416,8 @@ local function set_enemy_evolution()
|
||||
end
|
||||
|
||||
BiterHealthBooster.set('biter_health_boost', biter_h_boost)
|
||||
WD.set('biter_health_boost', biter_h_boost)
|
||||
|
||||
if enemy.evolution_factor == 1 and evolution_factor == 1 then
|
||||
return
|
||||
end
|
||||
@ -499,7 +504,7 @@ local function spawn_biter(surface, position, forceSpawn, is_boss_biter)
|
||||
|
||||
local old_position = position
|
||||
|
||||
position = surface.find_non_colliding_position('steel-chest', position, 10, 1)
|
||||
position = surface.find_non_colliding_position('steel-chest', position, 2, 1)
|
||||
if not position then
|
||||
position = old_position
|
||||
end
|
||||
|
@ -141,7 +141,12 @@ function Public.dump_text(text, player)
|
||||
return false
|
||||
end
|
||||
|
||||
return true, dump(var)
|
||||
local dvar = dump(var)
|
||||
if dvar:find('function_handlers') then
|
||||
dvar = '{}' -- desync handler
|
||||
end
|
||||
|
||||
return true, dvar
|
||||
end
|
||||
|
||||
return Public
|
||||
|
@ -94,6 +94,9 @@ Gui.on_click(
|
||||
|
||||
local id = Token.get_global(token_id)
|
||||
local content = dump(id) or 'Could not load data.'
|
||||
if content:find('function_handlers') then
|
||||
content = '{}' -- desync handler
|
||||
end
|
||||
right_panel.text = content
|
||||
end
|
||||
)
|
||||
|
Loading…
x
Reference in New Issue
Block a user