mirror of
https://github.com/ComfyFactory/ComfyFactorio.git
synced 2025-01-06 00:23:49 +02:00
new map
This commit is contained in:
parent
c4c088059c
commit
48642e00bc
@ -20,7 +20,7 @@ require "poll"
|
||||
require "score"
|
||||
require "modules.autostash"
|
||||
require "modules.corpse_markers"
|
||||
--require "modules.floaty_chat"
|
||||
require "modules.floaty_chat"
|
||||
--require "modules.autohotbar"
|
||||
--require "on_tick_schedule"
|
||||
|
||||
@ -43,6 +43,7 @@ require "modules.corpse_markers"
|
||||
--require "modules.fish_respawner"
|
||||
--require "modules.fluids_are_explosive"
|
||||
--require "modules.hunger"
|
||||
--require "modules.rpg"
|
||||
--require "modules.hunger_games"
|
||||
--require "modules.players_trample_paths"
|
||||
--require "modules.railgun_enhancer"
|
||||
@ -60,7 +61,7 @@ require "modules.corpse_markers"
|
||||
---- enable maps here ----
|
||||
--require "maps.fish_defender.main"
|
||||
--require "maps.fish_defender_v1.fish_defender"
|
||||
--require "maps.biter_battles_v2.biter_battles_v2"
|
||||
--require "maps.biter_battles_v2.main"
|
||||
--require "maps.island_troopers.main"
|
||||
--require "maps.tank_conquest.tank_conquest"
|
||||
--require "maps.territorial_control"
|
||||
@ -76,6 +77,7 @@ require "modules.corpse_markers"
|
||||
--require "maps.rocky_waste"
|
||||
--require "maps.labyrinth"
|
||||
--require "maps.junkyard"
|
||||
--require "maps.rocky_junkyard"
|
||||
--require "maps.spooky_forest"
|
||||
--require "maps.mixed_railworld"
|
||||
--require "maps.nightfall"
|
||||
@ -88,7 +90,8 @@ require "modules.corpse_markers"
|
||||
--require "maps.choppy"
|
||||
--require "maps.tank_battles"
|
||||
--require "maps.spiral_troopers"
|
||||
require "maps.mountain_fortress"
|
||||
--require "maps.mountain_fortress"
|
||||
require "maps.refactor-io"
|
||||
--require "maps.stoneblock"
|
||||
--require "maps.deep_jungle"
|
||||
--require "maps.crossing"
|
||||
|
105
maps/refactor-io.lua
Normal file
105
maps/refactor-io.lua
Normal file
@ -0,0 +1,105 @@
|
||||
-- Refactor-io -- made by mewmew and p.p
|
||||
|
||||
require "modules.satellite_score"
|
||||
require "modules.spawners_contain_biters"
|
||||
require "modules.no_blueprint_library"
|
||||
|
||||
require "modules.map_info"
|
||||
global.map_info = {}
|
||||
global.map_info.main_caption = "Refactor-io"
|
||||
global.map_info.sub_caption = ""
|
||||
global.map_info.text = [[
|
||||
Hello visitor.
|
||||
|
||||
You can not mine things.
|
||||
You can not deconstruct things.
|
||||
You can not destroy things,
|
||||
...except the biters.
|
||||
|
||||
The only way to "deconstruct" is your railgun.
|
||||
Additional darts may be found within biter spawners.
|
||||
|
||||
Have fun <3
|
||||
]]
|
||||
|
||||
local math_random = math.random
|
||||
|
||||
local function on_player_joined_game(event)
|
||||
local player = game.players[event.player_index]
|
||||
local surface = game.surfaces["refactor-io"]
|
||||
if player.online_time == 0 then
|
||||
local non_colliding_position = surface.find_non_colliding_position("character", {0,0}, 96, 1)
|
||||
player.teleport(non_colliding_position, surface)
|
||||
player.insert{name = 'iron-plate', count = 32}
|
||||
player.insert{name = 'iron-gear-wheel', count = 16}
|
||||
player.insert{name = 'wood', count = 100}
|
||||
player.insert{name = 'stone', count = 50}
|
||||
player.insert{name = 'pistol', count = 1}
|
||||
player.insert{name = 'firearm-magazine', count = 16}
|
||||
player.insert{name = 'railgun', count = 1}
|
||||
player.insert{name = 'railgun-dart', count = 1}
|
||||
end
|
||||
end
|
||||
|
||||
local function on_marked_for_deconstruction(event)
|
||||
event.entity.cancel_deconstruction(game.players[event.player_index].force.name)
|
||||
end
|
||||
|
||||
local function on_entity_damaged(event)
|
||||
if not event.entity.valid then return end
|
||||
if event.entity.force.index == 2 then return end
|
||||
if event.entity.name == "character" then return end
|
||||
if event.cause then
|
||||
if event.cause.force.index == 2 then return end
|
||||
if event.cause.name == "character" then
|
||||
if event.damage_type.name == "physical" then
|
||||
if event.original_damage_amount == 100 then
|
||||
event.entity.die("player")
|
||||
return
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
event.entity.health = event.entity.health + event.final_damage_amount
|
||||
end
|
||||
|
||||
local function on_entity_died(event)
|
||||
if not event.entity.valid then return end
|
||||
if event.entity.type == "unit-spawner" then
|
||||
event.entity.surface.spill_item_stack({event.entity.position.x, event.entity.position.y + 2},{name = "railgun-dart", count = 1}, false)
|
||||
end
|
||||
end
|
||||
|
||||
local function on_init()
|
||||
game.forces.player.technologies["steel-axe"].researched=true
|
||||
game.forces.player.manual_mining_speed_modifier = -1000000
|
||||
|
||||
local map_gen_settings = {}
|
||||
map_gen_settings.seed = math.random(1, 999999999)
|
||||
map_gen_settings.water = 1.5
|
||||
map_gen_settings.starting_area = 1.5
|
||||
map_gen_settings.terrain_segmentation = 3
|
||||
map_gen_settings.cliff_settings = {cliff_elevation_interval = 6, cliff_elevation_0 = 6}
|
||||
map_gen_settings.autoplace_controls = {
|
||||
["coal"] = {frequency = 3, size = 0.75, richness = 0.75},
|
||||
["stone"] = {frequency = 3, size = 0.75, richness = 0.75},
|
||||
["copper-ore"] = {frequency = 3, size = 0.75, richness = 0.75},
|
||||
["iron-ore"] = {frequency = 3, size = 0.75, richness = 0.75},
|
||||
["uranium-ore"] = {frequency = 3, size = 0.75, richness = 0.75},
|
||||
["crude-oil"] = {frequency = 3, size = 1, richness = 1},
|
||||
["trees"] = {frequency = 4, size = 1.15, richness = 1},
|
||||
["enemy-base"] = {frequency = 5, size = 2.0, richness = 1}
|
||||
}
|
||||
local surface = game.create_surface("refactor-io", map_gen_settings)
|
||||
surface.request_to_generate_chunks({0,0}, 5)
|
||||
surface.force_generate_chunk_requests()
|
||||
|
||||
game.forces.player.set_spawn_position(surface.find_non_colliding_position("character", {0,0}, 96, 1), surface)
|
||||
end
|
||||
|
||||
local event = require 'utils.event'
|
||||
event.on_init(on_init)
|
||||
event.add(defines.events.on_entity_damaged, on_entity_damaged)
|
||||
event.add(defines.events.on_entity_died, on_entity_died)
|
||||
event.add(defines.events.on_marked_for_deconstruction, on_marked_for_deconstruction)
|
||||
event.add(defines.events.on_player_joined_game, on_player_joined_game)
|
79
modules/map_info.lua
Normal file
79
modules/map_info.lua
Normal file
@ -0,0 +1,79 @@
|
||||
global.map_info = {}
|
||||
global.map_info.main_caption = "Insert Main Caption"
|
||||
global.map_info.sub_caption = "Insert Sub Caption"
|
||||
global.map_info.text = [[
|
||||
Add info text to global.map_info.
|
||||
]]
|
||||
|
||||
local function create_map_intro_button(player)
|
||||
if player.gui.top["map_intro_button"] then return end
|
||||
local b = player.gui.top.add({type = "sprite-button", caption = "?", name = "map_intro_button", tooltip = "Map Info"})
|
||||
b.style.font_color = {r = 0.1, g = 0.8, b = 0.1}
|
||||
b.style.font = "heading-1"
|
||||
b.style.minimal_height = 38
|
||||
b.style.minimal_width = 38
|
||||
b.style.top_padding = 2
|
||||
b.style.left_padding = 4
|
||||
b.style.right_padding = 4
|
||||
b.style.bottom_padding = 2
|
||||
end
|
||||
|
||||
local function create_map_intro(player)
|
||||
local frame = player.gui.left.add {type = "frame", name = "map_intro_frame", direction = "vertical"}
|
||||
local t = frame.add {type = "table", column_count = 1}
|
||||
|
||||
local tt = t.add {type = "table", column_count = 3}
|
||||
local l = tt.add {type = "label", caption = global.map_info.main_caption}
|
||||
l.style.font = "default-listbox"
|
||||
l.style.font_color = {r=0.6, g=0.3, b=0.99}
|
||||
l.style.top_padding = 6
|
||||
l.style.bottom_padding = 6
|
||||
|
||||
local l = tt.add {type = "label", caption = global.map_info.sub_caption}
|
||||
l.style.font = "default"
|
||||
l.style.font_color = {r=0.2, g=0.9, b=0.2}
|
||||
l.style.minimal_width = 280
|
||||
|
||||
local b = tt.add {type = "button", caption = "X", name = "close_map_intro_frame", align = "right"}
|
||||
b.style.font = "default"
|
||||
b.style.minimal_height = 30
|
||||
b.style.minimal_width = 30
|
||||
b.style.top_padding = 2
|
||||
b.style.left_padding = 4
|
||||
b.style.right_padding = 4
|
||||
b.style.bottom_padding = 2
|
||||
|
||||
local tt = t.add {type = "table", column_count = 1}
|
||||
local frame = t.add {type = "frame"}
|
||||
local l = frame.add {type = "label", caption = global.map_info.text}
|
||||
l.style.single_line = false
|
||||
l.style.font_color = {r=0.95, g=0.95, b=0.95}
|
||||
end
|
||||
|
||||
local function on_player_joined_game(event)
|
||||
local player = game.players[event.player_index]
|
||||
create_map_intro_button(player)
|
||||
if player.online_time == 0 then
|
||||
create_map_intro(player)
|
||||
end
|
||||
end
|
||||
|
||||
local function on_gui_click(event)
|
||||
if not event then return end
|
||||
if not event.element then return end
|
||||
if not event.element.valid then return end
|
||||
local player = game.players[event.element.player_index]
|
||||
if event.element.name == "close_map_intro_frame" then player.gui.left["map_intro_frame"].destroy() return end
|
||||
if event.element.name == "map_intro_button" then
|
||||
if player.gui.left["map_intro_frame"] then
|
||||
player.gui.left["map_intro_frame"].destroy()
|
||||
else
|
||||
create_map_intro(player)
|
||||
end
|
||||
return
|
||||
end
|
||||
end
|
||||
|
||||
local event = require 'utils.event'
|
||||
event.add(defines.events.on_player_joined_game, on_player_joined_game)
|
||||
event.add(defines.events.on_gui_click, on_gui_click)
|
Loading…
Reference in New Issue
Block a user