mirror of
https://github.com/ComfyFactory/ComfyFactorio.git
synced 2025-03-17 20:58:13 +02:00
rpg +5 points rmb
This commit is contained in:
parent
f0a813da59
commit
faac8c1905
@ -26,12 +26,21 @@ local function remove_acceleration()
|
||||
if global.locomotive_driver then global.locomotive_driver.destroy() end
|
||||
end
|
||||
|
||||
local function set_player_spawn()
|
||||
if not global.locomotive_cargo then return end
|
||||
if not global.locomotive_cargo.valid then return end
|
||||
local position = global.locomotive_cargo.surface.find_non_colliding_position("stone-furnace", global.locomotive_cargo.position, 16, 2)
|
||||
if not position then return end
|
||||
game.forces.player.set_spawn_position(position, global.locomotive_cargo.surface)
|
||||
end
|
||||
|
||||
local function tick()
|
||||
if not global.locomotive then return end
|
||||
if not global.locomotive.valid then return end
|
||||
|
||||
if game.tick % 30 == 0 then
|
||||
accelerate()
|
||||
if game.tick % 1800 == 0 then set_player_spawn() end
|
||||
else
|
||||
remove_acceleration()
|
||||
end
|
||||
|
@ -38,7 +38,7 @@ local starting_items = {['pistol'] = 1, ['firearm-magazine'] = 16, ['rail'] = 16
|
||||
local function get_gen_settings()
|
||||
local map = {
|
||||
["seed"] = math.random(1, 1000000),
|
||||
["water"] = 0,
|
||||
["water"] = 0.001,
|
||||
["starting_area"] = 1,
|
||||
["cliff_settings"] = {cliff_elevation_interval = 8, cliff_elevation_0 = 8},
|
||||
["default_enable_all_autoplace_controls"] = true,
|
||||
@ -56,7 +56,8 @@ function reset_map()
|
||||
|
||||
if not global.active_surface then
|
||||
global.active_surface = game.create_surface("mountain_fortress", get_gen_settings())
|
||||
else
|
||||
else
|
||||
game.forces.player.set_spawn_position({-2, 16}, global.active_surface)
|
||||
global.active_surface = soft_reset_map(global.active_surface, get_gen_settings(), starting_items)
|
||||
end
|
||||
|
||||
@ -88,12 +89,12 @@ end
|
||||
|
||||
local function on_entity_died(event)
|
||||
if not event.entity.valid then return end
|
||||
if event.entity == global.locomotive_cargo then
|
||||
if event.entity == global.locomotive_cargo then
|
||||
game.print("The cargo was destroyed!")
|
||||
reset_map()
|
||||
for _, player in pairs(game.connected_players) do
|
||||
player.play_sound{path="utility/game_lost", volume_modifier=0.75}
|
||||
end
|
||||
game.print("The cargo was destroyed!")
|
||||
reset_map()
|
||||
--global.wave_defense.game_lost = true
|
||||
return
|
||||
end
|
||||
|
@ -137,7 +137,9 @@ local function add_gui_increase_stat(element, name, player, width)
|
||||
e.style.horizontal_align = "center"
|
||||
e.style.vertical_align = "center"
|
||||
e.style.padding = 0
|
||||
e.style.margin = 0
|
||||
e.style.margin = 0
|
||||
e.tooltip = "Rightclick to allocate 5 points."
|
||||
|
||||
return e
|
||||
end
|
||||
|
||||
@ -446,6 +448,18 @@ local function on_gui_click(event)
|
||||
local index = element.name
|
||||
local player = game.players[event.player_index]
|
||||
if not global.rpg[player.index][index] then return end
|
||||
|
||||
if event.button == defines.mouse_button_type.right then
|
||||
for a = 1, 5, 1 do
|
||||
if global.rpg[player.index].points_to_distribute <= 0 then draw_gui(player) return end
|
||||
global.rpg[player.index].points_to_distribute = global.rpg[player.index].points_to_distribute - 1
|
||||
global.rpg[player.index][index] = global.rpg[player.index][index] + 1
|
||||
update_player_stats(player)
|
||||
end
|
||||
draw_gui(player)
|
||||
return
|
||||
end
|
||||
|
||||
if global.rpg[player.index].points_to_distribute <= 0 then draw_gui(player) return end
|
||||
global.rpg[player.index].points_to_distribute = global.rpg[player.index].points_to_distribute - 1
|
||||
global.rpg[player.index][index] = global.rpg[player.index][index] + 1
|
||||
|
@ -243,7 +243,7 @@ function reset_wave_defense()
|
||||
active_biter_count = 0,
|
||||
spawn_position = {x = 0, y = 48},
|
||||
last_wave = game.tick,
|
||||
next_wave = game.tick + 36 * 10,
|
||||
next_wave = game.tick + 3600 * 5,
|
||||
wave_interval = 1800,
|
||||
wave_number = 0,
|
||||
game_lost = false,
|
||||
|
Loading…
x
Reference in New Issue
Block a user