mirror of
https://github.com/ComfyFactory/ComfyFactorio.git
synced 2025-03-17 20:58:13 +02:00
scrapyard changes
This commit is contained in:
parent
2b273bb4d1
commit
037cbb7398
@ -400,10 +400,15 @@ function Public.use_cargo_wagon_door(icw, player, door)
|
||||
local position = {wagon.entity.position.x + x_vector, wagon.entity.position.y}
|
||||
local position = surface.find_non_colliding_position("character", position, 128, 0.5)
|
||||
if not position then return end
|
||||
player.teleport(position, surface)
|
||||
player_data.state = 2
|
||||
player.driving = true
|
||||
Public.kill_minimap(player)
|
||||
if wagon.entity.type == "locomotive" then
|
||||
player.teleport(position, surface)
|
||||
player_data.state = 2
|
||||
player.driving = true
|
||||
Public.kill_minimap(player)
|
||||
else
|
||||
player.teleport(position, surface)
|
||||
Public.kill_minimap(player)
|
||||
end
|
||||
else
|
||||
local surface = wagon.surface
|
||||
local area = wagon.area
|
||||
|
@ -102,7 +102,7 @@ local function rebuild_energy_overworld(data)
|
||||
}
|
||||
|
||||
rendering.draw_text{
|
||||
text = "Power",
|
||||
text = "Power to locomotive",
|
||||
surface = surface,
|
||||
target = this.ow_energy,
|
||||
target_offset = {0, -1.5},
|
||||
@ -145,7 +145,7 @@ local function rebuild_energy_loco(data, destroy)
|
||||
}
|
||||
|
||||
rendering.draw_text{
|
||||
text = "Power",
|
||||
text = "Power to overworld",
|
||||
surface = loco_surface,
|
||||
target = this.lo_energy,
|
||||
target_offset = {0, -1.5},
|
||||
|
@ -40,7 +40,7 @@ local math_floor = math.floor
|
||||
|
||||
local starting_items = {['pistol'] = 1, ['firearm-magazine'] = 16, ['wood'] = 4, ['rail'] = 16, ['raw-fish'] = 2}
|
||||
local disabled_entities = {"gun-turret", "laser-turret", "flamethrower-turret", "land-mine"}
|
||||
local colors = {"black-refined-concrete", "orange-refined-concrete", "red-refined-concrete", "yellow-refined-concrete", "acid-refined-concrete", "brown-refined-concrete", "blue-refined-concrete"}
|
||||
local colors = {"green-refined-concrete", "black-refined-concrete", "orange-refined-concrete", "red-refined-concrete", "yellow-refined-concrete", "brown-refined-concrete", "blue-refined-concrete"}
|
||||
local treasure_chest_messages = {
|
||||
"You notice an old crate within the rubble. It's filled with treasure!",
|
||||
"You find a chest underneath the broken rocks. It's filled with goodies!",
|
||||
@ -338,6 +338,9 @@ local function on_player_changed_position(event)
|
||||
local shallow, deepwater = surface.get_tile(_pos).name == "water-shallow", surface.get_tile(_pos).name == "deepwater-green"
|
||||
if shallow or deepwater then goto continue end
|
||||
change_tile(surface, _pos, steps)
|
||||
if this.players[player.index].steps > 5000 then
|
||||
this.players[player.index].steps = 0
|
||||
end
|
||||
this.players[player.index].steps = this.players[player.index].steps + 1
|
||||
end
|
||||
end
|
||||
@ -346,7 +349,7 @@ local function on_player_changed_position(event)
|
||||
if position.y < 5 then Terrain.reveal(player) end
|
||||
if position.y >= 190 then
|
||||
player.teleport({position.x, position.y - 1}, surface)
|
||||
player.print("[color=blue]Grandmaster:[/color] forcefield does not approve.",{r=0.98, g=0.66, b=0.22})
|
||||
player.print("[color=blue]Grandmaster:[/color] Forcefield does not approve.",{r=0.98, g=0.66, b=0.22})
|
||||
if player.character then
|
||||
player.character.health = player.character.health - 5
|
||||
player.character.surface.create_entity({name = "water-splash", position = position})
|
||||
@ -700,17 +703,17 @@ local function darkness(this)
|
||||
local surface = game.surfaces[this.active_surface_index]
|
||||
if rnd(1, 64) == 1 then
|
||||
if surface.freeze_daytime then return end
|
||||
game.print("[color=blue]Grandmaster:[/color] darkness has surrounded us!", {r = 1, g = 0.5, b = 0.1})
|
||||
game.print("[color=blue]Grandmaster:[/color] builds some lamps!", {r = 1, g = 0.5, b = 0.1})
|
||||
game.print("[color=blue]Grandmaster:[/color] Darkness has surrounded us!", {r = 1, g = 0.5, b = 0.1})
|
||||
game.print("[color=blue]Grandmaster:[/color] Builds some lamps!", {r = 1, g = 0.5, b = 0.1})
|
||||
surface.min_brightness = 0.10
|
||||
surface.brightness_visual_weights = {0.90, 0.90, 0.90}
|
||||
surface.daytime = 0.42
|
||||
surface.freeze_daytime = true
|
||||
surface.solar_power_multiplier = 999
|
||||
surface.solar_power_multiplier = 1
|
||||
return
|
||||
elseif rnd(1, 32) == 1 then
|
||||
if not surface.freeze_daytime then return end
|
||||
game.print("[color=blue]Grandmaster:[/color] sunlight, finally!", {r = 1, g = 0.5, b = 0.1})
|
||||
game.print("[color=blue]Grandmaster:[/color] Sunlight, finally!", {r = 1, g = 0.5, b = 0.1})
|
||||
surface.min_brightness = 1
|
||||
surface.brightness_visual_weights = {1, 0, 0, 0}
|
||||
surface.daytime = 0.7
|
||||
@ -723,17 +726,17 @@ end
|
||||
|
||||
local function scrap_randomness(this)
|
||||
local rnd = math.random
|
||||
if rnd(1, 32) == 1 then
|
||||
if rnd(1, 64) == 1 then
|
||||
if not this.scrap_enabled then return end
|
||||
this.scrap_enabled = false
|
||||
game.print("[color=blue]Grandmaster:[/color] it seems that the scrap is temporarily gone.", {r = 1, g = 0.5, b = 0.1})
|
||||
game.print("[color=blue]Grandmaster:[/color] output from scrap is now only ores.", {r = 1, g = 0.5, b = 0.1})
|
||||
game.print("[color=blue]Grandmaster:[/color] It seems that the scrap is temporarily gone.", {r = 1, g = 0.5, b = 0.1})
|
||||
game.print("[color=blue]Grandmaster:[/color] Output from scrap is now only ores.", {r = 1, g = 0.5, b = 0.1})
|
||||
return
|
||||
elseif rnd(1, 32) == 1 then
|
||||
if this.scrap_enabled then return end
|
||||
this.scrap_enabled = true
|
||||
game.print("[color=blue]Grandmaster:[/color] scrap is back!", {r = 1, g = 0.5, b = 0.1})
|
||||
game.print("[color=blue]Grandmaster:[/color] output from scrap is now randomized.", {r = 1, g = 0.5, b = 0.1})
|
||||
game.print("[color=blue]Grandmaster:[/color] Scrap is back!", {r = 1, g = 0.5, b = 0.1})
|
||||
game.print("[color=blue]Grandmaster:[/color] Output from scrap is now randomized.", {r = 1, g = 0.5, b = 0.1})
|
||||
return
|
||||
end
|
||||
end
|
||||
|
@ -93,21 +93,33 @@ local function mining_chances_ores()
|
||||
return data
|
||||
end
|
||||
|
||||
local function scrap_yield_amounts()
|
||||
local function ore_yield_amounts()
|
||||
local data = {
|
||||
["iron-ore"] = 28,
|
||||
["copper-ore"] = 28,
|
||||
["stone"] = 20,
|
||||
["coal"] = 28,
|
||||
["iron-plate"] = 4,
|
||||
["iron-gear-wheel"] = 6,
|
||||
["iron-stick"] = 6,
|
||||
["copper-plate"] = 4,
|
||||
["copper-cable"] = 6,
|
||||
["electronic-circuit"] = 2,
|
||||
["steel-plate"] = 2,
|
||||
["uranium-ore"] = 1,
|
||||
["mineable-wreckage"] = 1,
|
||||
}
|
||||
return data
|
||||
end
|
||||
|
||||
local function scrap_yield_amounts()
|
||||
local data = {
|
||||
["iron-ore"] = 10,
|
||||
["copper-ore"] = 10,
|
||||
["stone"] = 8,
|
||||
["coal"] = 9,
|
||||
["iron-plate"] = 12,
|
||||
["iron-gear-wheel"] = 12,
|
||||
["iron-stick"] = 12,
|
||||
["copper-plate"] = 12,
|
||||
["copper-cable"] = 12,
|
||||
["electronic-circuit"] = 4,
|
||||
["steel-plate"] = 4,
|
||||
["pipe"] = 5,
|
||||
["solid-fuel"] = 4,
|
||||
["solid-fuel"] = 6,
|
||||
["empty-barrel"] = 3,
|
||||
["crude-oil-barrel"] = 3,
|
||||
["lubricant-barrel"] = 3,
|
||||
@ -175,6 +187,7 @@ local size_of_ore_raffle = #scrap_raffle_ores
|
||||
local function get_amount(data)
|
||||
local entity = data.entity
|
||||
local this = data.this
|
||||
local scrap = data.scrap
|
||||
local distance_to_center = math_floor(math_sqrt(entity.position.x ^ 2 + entity.position.y ^ 2))
|
||||
|
||||
local distance_modifier = 0.25
|
||||
@ -188,8 +201,15 @@ local function get_amount(data)
|
||||
if amount > maximum_amount then amount = maximum_amount end
|
||||
|
||||
local m = (70 + math_random(0, 60)) * 0.01
|
||||
|
||||
amount = math_floor(amount * scrap_yield_amounts()[entity.name] * m)
|
||||
if this.scrap_enabled then
|
||||
local amount_bonus = (game.forces.enemy.evolution_factor * 2) + (game.forces.player.mining_drill_productivity_bonus * 2)
|
||||
local r1 = math.ceil(scrap_yield_amounts()[scrap] * (0.3 + (amount_bonus * 0.3)))
|
||||
local r2 = math.ceil(scrap_yield_amounts()[scrap] * (1.7 + (amount_bonus * 1.7)))
|
||||
if not r1 or not r2 then return end
|
||||
amount = math.random(r1, r2)
|
||||
else
|
||||
amount = math_floor(amount * ore_yield_amounts()[entity.name] * m)
|
||||
end
|
||||
if amount < 1 then amount = 1 end
|
||||
|
||||
return amount
|
||||
@ -199,7 +219,6 @@ local function scrap_randomness(data)
|
||||
local entity = data.entity
|
||||
local this = data.this
|
||||
local player = data.player
|
||||
local scrap
|
||||
|
||||
--if this.scrap_enabled[player.index] then
|
||||
-- scrap = scrap_raffle_scrap[math.random(1, size_of_scrap_raffle)]
|
||||
@ -213,13 +232,15 @@ local function scrap_randomness(data)
|
||||
scrap = scrap_raffle_ores[math.random(1, size_of_ore_raffle)]
|
||||
end
|
||||
|
||||
local amount = get_amount(data)
|
||||
data.scrap = scrap
|
||||
|
||||
local scrap_amount = get_amount(data)
|
||||
|
||||
local position = {x = entity.position.x, y = entity.position.y}
|
||||
|
||||
entity.destroy()
|
||||
|
||||
local scrap_amount = math_floor(amount * 0.85) + 1
|
||||
--local scrap_amount = math_floor(amount * 0.85) + 1
|
||||
|
||||
if scrap_amount > max_spill then
|
||||
player.surface.spill_item_stack(position,{name = scrap, count = max_spill}, true)
|
||||
|
@ -14,9 +14,9 @@ local this = {
|
||||
cargo_max_health = 10000,
|
||||
revealed_spawn = 0,
|
||||
scrap_enabled = true,
|
||||
rocks_yield_ore_maximum_amount = 999,
|
||||
rocks_yield_ore_maximum_amount = 500,
|
||||
rocks_yield_ore_base_amount = 50,
|
||||
rocks_yield_ore_distance_modifier = 0.025
|
||||
rocks_yield_ore_distance_modifier = 0.020
|
||||
}
|
||||
local Public = {}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user