mirror of
https://github.com/ComfyFactory/ComfyFactorio.git
synced 2025-03-17 20:58:13 +02:00
Fix max_health, item rename
This commit is contained in:
parent
e34e9536b3
commit
7565520ead
41
.github/workflows/AutoRelease.yml
vendored
Normal file
41
.github/workflows/AutoRelease.yml
vendored
Normal file
@ -0,0 +1,41 @@
|
||||
name: 'Auto-release'
|
||||
|
||||
# Controls when the action will run. Triggers the workflow on push or pull request
|
||||
# events but only for the develop branch
|
||||
on:
|
||||
push:
|
||||
branches: [develop]
|
||||
|
||||
jobs:
|
||||
auto-release:
|
||||
name: 'Auto Release'
|
||||
runs-on: 'ubuntu-latest'
|
||||
steps:
|
||||
- name: Checkout code
|
||||
uses: actions/checkout@v2
|
||||
- name: Changelog
|
||||
uses: scottbrenner/generate-changelog-action@master
|
||||
id: Changelog
|
||||
env:
|
||||
REPO: ${{ github.repository }}
|
||||
- id: next_version
|
||||
uses: zwaldowski/semver-release-action@v2
|
||||
with:
|
||||
prefix: v
|
||||
dry_run: true
|
||||
bump: patch
|
||||
github_token: ${{ secrets.GITHUB_TOKEN }}
|
||||
- name: Create Release
|
||||
id: create_release
|
||||
uses: actions/create-release@latest
|
||||
env:
|
||||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||
with:
|
||||
tag_name: ${{ steps.next_version.outputs.version}}
|
||||
release_name: Main Scenario
|
||||
body: |
|
||||
This is the main release of the stable version of Factorio.
|
||||
Check out the [wiki](https://github.com/ComfyFactory/ComfyFactorio/wiki) for getting started.
|
||||
${{ steps.Changelog.outputs.changelog }}
|
||||
draft: false
|
||||
prerelease: false
|
29
.github/workflows/CI.yml
vendored
Normal file
29
.github/workflows/CI.yml
vendored
Normal file
@ -0,0 +1,29 @@
|
||||
name: CI
|
||||
|
||||
# Controls when the action will run. Triggers the workflow on push or pull request
|
||||
# events but only for the develop branch
|
||||
on:
|
||||
push:
|
||||
branches: [develop]
|
||||
pull_request:
|
||||
branches: [develop]
|
||||
|
||||
# A workflow run is made up of one or more jobs that can run sequentially or in parallel
|
||||
jobs:
|
||||
# This workflow contains a single job called "build"
|
||||
build:
|
||||
# The type of runner that the job will run on
|
||||
runs-on: ubuntu-latest
|
||||
|
||||
# Steps represent a sequence of tasks that will be executed as part of the job
|
||||
steps:
|
||||
# Checks-out your repository under $GITHUB_WORKSPACE, so your job can access it
|
||||
- uses: actions/checkout@v2
|
||||
|
||||
# Use "Factorio Mod luacheck" from the marketplace
|
||||
- name: Factorio Mod luacheck
|
||||
uses: Roang-zero1/factorio-mod-luacheck@v1.1.0
|
||||
with:
|
||||
# URL to the luacheckrc configuration file to be used during checking.
|
||||
# Per https://github.com/Roang-zero1/factorio-mod-luacheck/issues/2 - an empty string will use the project's .luacheckrc
|
||||
luacheckrc_url: 'https://raw.githubusercontent.com/ComfyFactory/ComfyFactorio/develop/.luacheckrc' # optional, default is https://raw.githubusercontent.com/Nexela/Factorio-luacheckrc/0.17/.luacheckrc
|
27
.github/workflows/CheckMaps.yml
vendored
Normal file
27
.github/workflows/CheckMaps.yml
vendored
Normal file
@ -0,0 +1,27 @@
|
||||
name: CheckMaps
|
||||
|
||||
# Controls when the action will run. Triggers the workflow on push or pull request
|
||||
# events but only for the develop branch
|
||||
on:
|
||||
push:
|
||||
branches: [develop]
|
||||
pull_request:
|
||||
branches: [develop]
|
||||
|
||||
jobs:
|
||||
check:
|
||||
name: Check if requestor has made a boo boo
|
||||
runs-on: ubuntu-latest
|
||||
|
||||
steps:
|
||||
- uses: actions/checkout@v2
|
||||
|
||||
- name: Factorio Control comment
|
||||
uses: Gerkiz/FactorioControlChecker@v1.0.6
|
||||
id: factorio_control_runner
|
||||
|
||||
- name: Check control.lua
|
||||
if: steps.factorio_control_runner.outputs.should_run == 1
|
||||
run: |
|
||||
echo "Maps are required in control.lua - please fix these."
|
||||
exit 1
|
@ -61,6 +61,7 @@ globals = {
|
||||
'is_loaded',
|
||||
'is_loaded_bool',
|
||||
'is_game_modded',
|
||||
'has_space_age',
|
||||
'require'
|
||||
}
|
||||
max_line_length = LINE_LENGTH
|
||||
|
@ -1,6 +1,6 @@
|
||||
require 'utils.data_stages'
|
||||
_LIFECYCLE = _STAGE.control -- Control stage
|
||||
_DEBUG = false
|
||||
_DEBUG = true
|
||||
_DUMP_ENV = false
|
||||
_PROFILE = false
|
||||
|
||||
@ -84,7 +84,7 @@ require 'utils.remote_chunks'
|
||||
--require 'maps.biter_battles.biter_battles'
|
||||
|
||||
--![[Guide a Train through rough terrain, while defending it from the biters]]--
|
||||
--require 'maps.mountain_fortress_v3.main'
|
||||
require 'maps.mountain_fortress_v3.main'
|
||||
--require 'maps.mountain_fortress_v2.main'
|
||||
--require 'maps.mountain_fortress'
|
||||
|
||||
|
@ -1393,7 +1393,7 @@ local function heal_rocks()
|
||||
if rock.last_damage + 300 < game.tick then
|
||||
if rock.entity.valid then
|
||||
rock.entity.health = rock.entity.health + healing_amount[rock.entity.name]
|
||||
if rock.entity.prototype.max_health == rock.entity.health then
|
||||
if rock.entity.max_health == rock.entity.health then
|
||||
storage.damaged_rocks[key] = nil
|
||||
end
|
||||
else
|
||||
|
@ -491,7 +491,7 @@ Public.mining_events = {
|
||||
local position = entity.position
|
||||
local surface = entity.surface
|
||||
local entity = surface.create_entity({ name = cave_miner.buildings_raffle[math_random(1, #cave_miner.buildings_raffle)], position = position, force = 'player' })
|
||||
entity.health = math_random(1, entity.prototype.max_health)
|
||||
entity.health = math_random(1, entity.max_health)
|
||||
local player = game.players[player_index]
|
||||
game.print(Public.get_colored_name(player_index) .. ' discovered an abandoned building', Constants.chat_color)
|
||||
end,
|
||||
|
@ -31,7 +31,7 @@ end
|
||||
---- CHRONO/POLLUTION BALANCE ----
|
||||
|
||||
function Public.factory_level(difficulty)
|
||||
return math.floor(1000 * difficulty_sloped(difficulty, 1 / 3))
|
||||
return math.floor(1000 * difficulty_sloped(difficulty, 1 / 3))
|
||||
end
|
||||
|
||||
function Public.pollution_filter_upgrade_factor(upgrades2)
|
||||
@ -119,14 +119,14 @@ Public.Chronotrain_max_HP = 10000
|
||||
Public.Chronotrain_HP_repaired_per_pack = 150
|
||||
Public.Tech_price_multiplier = 0.6
|
||||
|
||||
Public.starting_items = {['pistol'] = 1, ['firearm-magazine'] = 32, ['grenade'] = 4, ['raw-fish'] = 4, ['wood'] = 16}
|
||||
Public.starting_items = { ['pistol'] = 1, ['firearm-magazine'] = 32, ['grenade'] = 4, ['raw-fish'] = 4, ['wood'] = 16 }
|
||||
Public.wagon_starting_items = {
|
||||
{name = 'firearm-magazine', count = 16},
|
||||
{name = 'iron-plate', count = 16},
|
||||
{name = 'wood', count = 16},
|
||||
{name = 'burner-mining-drill', count = 8},
|
||||
{name = 'grenade', count = 10},
|
||||
{name = 'gun-turret', count = 2}
|
||||
{ name = 'firearm-magazine', count = 16 },
|
||||
{ name = 'iron-plate', count = 16 },
|
||||
{ name = 'wood', count = 16 },
|
||||
{ name = 'burner-mining-drill', count = 8 },
|
||||
{ name = 'grenade', count = 10 },
|
||||
{ name = 'gun-turret', count = 2 }
|
||||
}
|
||||
|
||||
function Public.jumps_until_overstay_is_on(difficulty) --both overstay penalties, and evoramp
|
||||
@ -201,19 +201,19 @@ Public.biome_weights = {
|
||||
function Public.ore_richness_weights(difficulty)
|
||||
local ores_weights
|
||||
if difficulty <= 0.25 then
|
||||
ores_weights = {9, 10, 9, 4, 2, 0}
|
||||
ores_weights = { 9, 10, 9, 4, 2, 0 }
|
||||
elseif difficulty <= 0.5 then
|
||||
ores_weights = {5, 11, 12, 6, 2, 0}
|
||||
ores_weights = { 5, 11, 12, 6, 2, 0 }
|
||||
elseif difficulty <= 0.75 then
|
||||
ores_weights = {5, 9, 12, 7, 3, 0}
|
||||
ores_weights = { 5, 9, 12, 7, 3, 0 }
|
||||
elseif difficulty <= 1 then
|
||||
ores_weights = {4, 8, 12, 8, 4, 0}
|
||||
ores_weights = { 4, 8, 12, 8, 4, 0 }
|
||||
elseif difficulty <= 1.5 then
|
||||
ores_weights = {2, 5, 15, 9, 5, 0}
|
||||
ores_weights = { 2, 5, 15, 9, 5, 0 }
|
||||
elseif difficulty <= 3 then
|
||||
ores_weights = {1, 4, 12, 13, 6, 0}
|
||||
ores_weights = { 1, 4, 12, 13, 6, 0 }
|
||||
elseif difficulty >= 5 then
|
||||
ores_weights = {1, 2, 10, 17, 6, 0}
|
||||
ores_weights = { 1, 2, 10, 17, 6, 0 }
|
||||
end
|
||||
return {
|
||||
vrich = ores_weights[1],
|
||||
@ -224,6 +224,7 @@ function Public.ore_richness_weights(difficulty)
|
||||
none = ores_weights[6]
|
||||
}
|
||||
end
|
||||
|
||||
Public.dayspeed_weights = {
|
||||
static = 2,
|
||||
normal = 4,
|
||||
@ -234,62 +235,63 @@ Public.dayspeed_weights = {
|
||||
}
|
||||
function Public.market_offers()
|
||||
return {
|
||||
{price = {{name = 'coin', count = 40}}, offer = {type = 'give-item', item = 'raw-fish'}},
|
||||
{price = {{name = 'coin', count = 40}}, offer = {type = 'give-item', item = 'wood', count = 50}},
|
||||
{price = {{name = 'coin', count = 100}}, offer = {type = 'give-item', item = 'iron-ore', count = 50}},
|
||||
{price = {{name = 'coin', count = 100}}, offer = {type = 'give-item', item = 'copper-ore', count = 50}},
|
||||
{price = {{name = 'coin', count = 100}}, offer = {type = 'give-item', item = 'stone', count = 50}}, -- needed?
|
||||
{price = {{name = 'coin', count = 100}}, offer = {type = 'give-item', item = 'coal', count = 50}},
|
||||
{price = {{name = 'coin', count = 400}}, offer = {type = 'give-item', item = 'uranium-ore', count = 50}},
|
||||
{price = {{name = 'coin', count = 50}, {name = 'barrel', count = 1}}, offer = {type = 'give-item', item = 'crude-oil-barrel', count = 1}},
|
||||
{price = {{name = 'coin', count = 500}, {name = 'steel-plate', count = 20}, {name = 'electronic-circuit', count = 20}}, offer = {type = 'give-item', item = 'loader', count = 1}},
|
||||
{ price = { { name = 'coin', count = 40 } }, offer = { type = 'give-item', item = 'raw-fish' } },
|
||||
{ price = { { name = 'coin', count = 40 } }, offer = { type = 'give-item', item = 'wood', count = 50 } },
|
||||
{ price = { { name = 'coin', count = 100 } }, offer = { type = 'give-item', item = 'iron-ore', count = 50 } },
|
||||
{ price = { { name = 'coin', count = 100 } }, offer = { type = 'give-item', item = 'copper-ore', count = 50 } },
|
||||
{ price = { { name = 'coin', count = 100 } }, offer = { type = 'give-item', item = 'stone', count = 50 } }, -- needed?
|
||||
{ price = { { name = 'coin', count = 100 } }, offer = { type = 'give-item', item = 'coal', count = 50 } },
|
||||
{ price = { { name = 'coin', count = 400 } }, offer = { type = 'give-item', item = 'uranium-ore', count = 50 } },
|
||||
{ price = { { name = 'coin', count = 50 }, { name = 'barrel', count = 1 } }, offer = { type = 'give-item', item = 'crude-oil-barrel', count = 1 } },
|
||||
{ price = { { name = 'coin', count = 500 }, { name = 'steel-plate', count = 20 }, { name = 'electronic-circuit', count = 20 } }, offer = { type = 'give-item', item = 'loader', count = 1 } },
|
||||
{
|
||||
price = {{name = 'coin', count = 1000}, {name = 'steel-plate', count = 40}, {name = 'advanced-circuit', count = 10}, {name = 'loader', count = 1}},
|
||||
offer = {type = 'give-item', item = 'fast-loader', count = 1}
|
||||
price = { { name = 'coin', count = 1000 }, { name = 'steel-plate', count = 40 }, { name = 'advanced-circuit', count = 10 }, { name = 'loader', count = 1 } },
|
||||
offer = { type = 'give-item', item = 'fast-loader', count = 1 }
|
||||
},
|
||||
{
|
||||
price = {{name = 'coin', count = 3000}, {name = 'express-transport-belt', count = 10}, {name = 'fast-loader', count = 1}},
|
||||
offer = {type = 'give-item', item = 'express-loader', count = 1}
|
||||
price = { { name = 'coin', count = 3000 }, { name = 'express-transport-belt', count = 10 }, { name = 'fast-loader', count = 1 } },
|
||||
offer = { type = 'give-item', item = 'express-loader', count = 1 }
|
||||
},
|
||||
{price = {{name = 'coin', count = 2}, {name = 'steel-plate', count = 1}, {name = 'explosives', count = 10}}, offer = {type = 'give-item', item = 'land-mine', count = 1}}
|
||||
{ price = { { name = 'coin', count = 2 }, { name = 'steel-plate', count = 1 }, { name = 'explosives', count = 10 } }, offer = { type = 'give-item', item = 'land-mine', count = 1 } }
|
||||
}
|
||||
end
|
||||
|
||||
function Public.initial_cargo_boxes()
|
||||
return {
|
||||
{name = 'loader', count = 1},
|
||||
{name = 'coal', count = math_random(32, 64)},
|
||||
{name = 'coal', count = math_random(32, 64)},
|
||||
{name = 'iron-ore', count = math_random(32, 128)},
|
||||
{name = 'copper-ore', count = math_random(32, 128)},
|
||||
{name = 'barrel', count = math_random(16, 32)},
|
||||
{name = 'submachine-gun', count = 1},
|
||||
{name = 'submachine-gun', count = 1},
|
||||
{name = 'shotgun', count = 1},
|
||||
{name = 'shotgun', count = 1},
|
||||
{name = 'shotgun', count = 1},
|
||||
{name = 'shotgun-shell', count = math_random(4, 5)},
|
||||
{name = 'shotgun-shell', count = math_random(4, 5)},
|
||||
{name = 'land-mine', count = math_random(6, 18)},
|
||||
{name = 'grenade', count = math_random(2, 3)},
|
||||
{name = 'grenade', count = math_random(2, 3)},
|
||||
{name = 'grenade', count = math_random(2, 3)},
|
||||
{name = 'iron-gear-wheel', count = math_random(7, 15)},
|
||||
{name = 'iron-gear-wheel', count = math_random(7, 15)},
|
||||
{name = 'iron-gear-wheel', count = math_random(7, 15)},
|
||||
{name = 'iron-gear-wheel', count = math_random(7, 15)},
|
||||
{name = 'iron-plate', count = math_random(15, 23)},
|
||||
{name = 'iron-plate', count = math_random(15, 23)},
|
||||
{name = 'iron-plate', count = math_random(15, 23)},
|
||||
{name = 'iron-plate', count = math_random(15, 23)},
|
||||
{name = 'copper-plate', count = math_random(15, 23)},
|
||||
{name = 'copper-plate', count = math_random(15, 23)},
|
||||
{name = 'copper-plate', count = math_random(15, 23)},
|
||||
{name = 'copper-plate', count = math_random(15, 23)},
|
||||
{name = 'firearm-magazine', count = math_random(10, 30)},
|
||||
{name = 'firearm-magazine', count = math_random(10, 30)},
|
||||
{name = 'firearm-magazine', count = math_random(10, 30)},
|
||||
{name = 'rail', count = math_random(16, 24)},
|
||||
{name = 'rail', count = math_random(16, 24)}
|
||||
{ name = 'loader', count = 1 },
|
||||
{ name = 'coal', count = math_random(32, 64) },
|
||||
{ name = 'coal', count = math_random(32, 64) },
|
||||
{ name = 'iron-ore', count = math_random(32, 128) },
|
||||
{ name = 'copper-ore', count = math_random(32, 128) },
|
||||
{ name = 'barrel', count = math_random(16, 32) },
|
||||
{ name = 'submachine-gun', count = 1 },
|
||||
{ name = 'submachine-gun', count = 1 },
|
||||
{ name = 'shotgun', count = 1 },
|
||||
{ name = 'shotgun', count = 1 },
|
||||
{ name = 'shotgun', count = 1 },
|
||||
{ name = 'shotgun-shell', count = math_random(4, 5) },
|
||||
{ name = 'shotgun-shell', count = math_random(4, 5) },
|
||||
{ name = 'land-mine', count = math_random(6, 18) },
|
||||
{ name = 'grenade', count = math_random(2, 3) },
|
||||
{ name = 'grenade', count = math_random(2, 3) },
|
||||
{ name = 'grenade', count = math_random(2, 3) },
|
||||
{ name = 'iron-gear-wheel', count = math_random(7, 15) },
|
||||
{ name = 'iron-gear-wheel', count = math_random(7, 15) },
|
||||
{ name = 'iron-gear-wheel', count = math_random(7, 15) },
|
||||
{ name = 'iron-gear-wheel', count = math_random(7, 15) },
|
||||
{ name = 'iron-plate', count = math_random(15, 23) },
|
||||
{ name = 'iron-plate', count = math_random(15, 23) },
|
||||
{ name = 'iron-plate', count = math_random(15, 23) },
|
||||
{ name = 'iron-plate', count = math_random(15, 23) },
|
||||
{ name = 'copper-plate', count = math_random(15, 23) },
|
||||
{ name = 'copper-plate', count = math_random(15, 23) },
|
||||
{ name = 'copper-plate', count = math_random(15, 23) },
|
||||
{ name = 'copper-plate', count = math_random(15, 23) },
|
||||
{ name = 'firearm-magazine', count = math_random(10, 30) },
|
||||
{ name = 'firearm-magazine', count = math_random(10, 30) },
|
||||
{ name = 'firearm-magazine', count = math_random(10, 30) },
|
||||
{ name = 'rail', count = math_random(16, 24) },
|
||||
{ name = 'rail', count = math_random(16, 24) }
|
||||
}
|
||||
end
|
||||
|
||||
@ -307,77 +309,77 @@ end
|
||||
|
||||
function Public.scrap()
|
||||
local main_loot = {
|
||||
['iron-plate'] = {amount = 5, chance = 400},
|
||||
['iron-gear-wheel'] = {amount = 3, chance = 250},
|
||||
['iron-stick'] = {amount = 2, chance = 100},
|
||||
['copper-plate'] = {amount = 5, chance = 400},
|
||||
['copper-cable'] = {amount = 8, chance = 150},
|
||||
['electronic-circuit'] = {amount = 3, chance = 100},
|
||||
['steel-plate'] = {amount = 4, chance = 100},
|
||||
['pipe'] = {amount = 3, chance = 50},
|
||||
['pipe-to-ground'] = {amount = 1, chance = 10},
|
||||
['battery'] = {amount = 3, chance = 10},
|
||||
['explosives'] = {amount = 3, chance = 5},
|
||||
['advanced-circuit'] = {amount = 5, chance = 3},
|
||||
['plastic-bar'] = {amount = 5, chance = 6},
|
||||
['processing-unit'] = {amount = 2, chance = 1},
|
||||
['used-up-uranium-fuel-cell'] = {amount = 1, chance = 4},
|
||||
['uranium-fuel-cell'] = {amount = 0.3, chance = 1},
|
||||
['iron-plate'] = { amount = 5, chance = 400 },
|
||||
['iron-gear-wheel'] = { amount = 3, chance = 250 },
|
||||
['iron-stick'] = { amount = 2, chance = 100 },
|
||||
['copper-plate'] = { amount = 5, chance = 400 },
|
||||
['copper-cable'] = { amount = 8, chance = 150 },
|
||||
['electronic-circuit'] = { amount = 3, chance = 100 },
|
||||
['steel-plate'] = { amount = 4, chance = 100 },
|
||||
['pipe'] = { amount = 3, chance = 50 },
|
||||
['pipe-to-ground'] = { amount = 1, chance = 10 },
|
||||
['battery'] = { amount = 3, chance = 10 },
|
||||
['explosives'] = { amount = 3, chance = 5 },
|
||||
['advanced-circuit'] = { amount = 5, chance = 3 },
|
||||
['plastic-bar'] = { amount = 5, chance = 6 },
|
||||
['processing-unit'] = { amount = 2, chance = 1 },
|
||||
['depleted-uranium-fuel-cell'] = { amount = 1, chance = 4 },
|
||||
['uranium-fuel-cell'] = { amount = 0.3, chance = 1 },
|
||||
--['rocket-control-unit'] = {amount = 0.3, chance = 1},
|
||||
['low-density-structure'] = {amount = 0.5, chance = 2},
|
||||
['heat-pipe'] = {amount = 1, chance = 1},
|
||||
['engine-unit'] = {amount = 3, chance = 3},
|
||||
['electric-engine-unit'] = {amount = 2, chance = 2},
|
||||
['flying-robot-frame'] = {amount = 1, chance = 2},
|
||||
['logistic-robot'] = {amount = 0.3, chance = 1},
|
||||
['construction-robot'] = {amount = 0.3, chance = 1},
|
||||
['land-mine'] = {amount = 1, chance = 1},
|
||||
['rocket'] = {amount = 2, chance = 1},
|
||||
['explosive-rocket'] = {amount = 2, chance = 1},
|
||||
['defender-capsule'] = {amount = 2, chance = 1},
|
||||
['destroyer-capsule'] = {amount = 0.3, chance = 1},
|
||||
['distractor-capsule'] = {amount = 0.3, chance = 1}
|
||||
['low-density-structure'] = { amount = 0.5, chance = 2 },
|
||||
['heat-pipe'] = { amount = 1, chance = 1 },
|
||||
['engine-unit'] = { amount = 3, chance = 3 },
|
||||
['electric-engine-unit'] = { amount = 2, chance = 2 },
|
||||
['flying-robot-frame'] = { amount = 1, chance = 2 },
|
||||
['logistic-robot'] = { amount = 0.3, chance = 1 },
|
||||
['construction-robot'] = { amount = 0.3, chance = 1 },
|
||||
['land-mine'] = { amount = 1, chance = 1 },
|
||||
['rocket'] = { amount = 2, chance = 1 },
|
||||
['explosive-rocket'] = { amount = 2, chance = 1 },
|
||||
['defender-capsule'] = { amount = 2, chance = 1 },
|
||||
['destroyer-capsule'] = { amount = 0.3, chance = 1 },
|
||||
['distractor-capsule'] = { amount = 0.3, chance = 1 }
|
||||
}
|
||||
local second_loot = {
|
||||
['cannon-shell'] = {amount = 0.1, chance = 5},
|
||||
['explosive-cannon-shell'] = {amount = 0.1, chance = 4},
|
||||
['uranium-cannon-shell'] = {amount = 0.1, chance = 3},
|
||||
['explosive-uranium-cannon-shell'] = {amount = 0.1, chance = 2},
|
||||
['artillery-shell'] = {amount = 0.1, chance = 1},
|
||||
['cluster-grenade'] = {amount = 0.2, chance = 20},
|
||||
['firearm-magazine'] = {amount = 0.4, chance = 70},
|
||||
['piercing-rounds-magazine'] = {amount = 0.2, chance = 55},
|
||||
['uranium-rounds-magazine'] = {amount = 0.1, chance = 40},
|
||||
['nuclear-fuel'] = {amount = 0.1, chance = 3},
|
||||
['rocket-fuel'] = {amount = 0.3, chance = 8},
|
||||
['grenade'] = {amount = 0.3, chance = 40},
|
||||
['solid-fuel'] = {amount = 0.4, chance = 50},
|
||||
['barrel'] = {amount = 0.1, chance = 50},
|
||||
['crude-oil-barrel'] = {amount = 0.1, chance = 70},
|
||||
['lubricant-barrel'] = {amount = 0.1, chance = 40},
|
||||
['petroleum-gas-barrel'] = {amount = 0.1, chance = 60},
|
||||
['heavy-oil-barrel'] = {amount = 0.1, chance = 70},
|
||||
['light-oil-barrel'] = {amount = 0.1, chance = 70},
|
||||
['water-barrel'] = {amount = 0.1, chance = 40}
|
||||
['cannon-shell'] = { amount = 0.1, chance = 5 },
|
||||
['explosive-cannon-shell'] = { amount = 0.1, chance = 4 },
|
||||
['uranium-cannon-shell'] = { amount = 0.1, chance = 3 },
|
||||
['explosive-uranium-cannon-shell'] = { amount = 0.1, chance = 2 },
|
||||
['artillery-shell'] = { amount = 0.1, chance = 1 },
|
||||
['cluster-grenade'] = { amount = 0.2, chance = 20 },
|
||||
['firearm-magazine'] = { amount = 0.4, chance = 70 },
|
||||
['piercing-rounds-magazine'] = { amount = 0.2, chance = 55 },
|
||||
['uranium-rounds-magazine'] = { amount = 0.1, chance = 40 },
|
||||
['nuclear-fuel'] = { amount = 0.1, chance = 3 },
|
||||
['rocket-fuel'] = { amount = 0.3, chance = 8 },
|
||||
['grenade'] = { amount = 0.3, chance = 40 },
|
||||
['solid-fuel'] = { amount = 0.4, chance = 50 },
|
||||
['barrel'] = { amount = 0.1, chance = 50 },
|
||||
['crude-oil-barrel'] = { amount = 0.1, chance = 70 },
|
||||
['lubricant-barrel'] = { amount = 0.1, chance = 40 },
|
||||
['petroleum-gas-barrel'] = { amount = 0.1, chance = 60 },
|
||||
['heavy-oil-barrel'] = { amount = 0.1, chance = 70 },
|
||||
['light-oil-barrel'] = { amount = 0.1, chance = 70 },
|
||||
['water-barrel'] = { amount = 0.1, chance = 40 }
|
||||
}
|
||||
|
||||
local scrap_raffle = {}
|
||||
for k, t in pairs(main_loot) do
|
||||
for _ = 1, t.chance, 1 do
|
||||
table.insert(scrap_raffle, {name = k, amount = t.amount})
|
||||
table.insert(scrap_raffle, { name = k, amount = t.amount })
|
||||
end
|
||||
end
|
||||
|
||||
local second_raffle = {}
|
||||
for k, t in pairs(second_loot) do
|
||||
for _ = 1, t.chance, 1 do
|
||||
table.insert(second_raffle, {name = k, amount = t.amount})
|
||||
table.insert(second_raffle, { name = k, amount = t.amount })
|
||||
end
|
||||
end
|
||||
table.shuffle_table(scrap_raffle)
|
||||
table.shuffle_table(second_raffle)
|
||||
|
||||
return {main = scrap_raffle, second = second_raffle}
|
||||
return { main = scrap_raffle, second = second_raffle }
|
||||
end
|
||||
|
||||
return Public
|
||||
|
@ -310,13 +310,13 @@ local function set_comfy_speech_bubble(text)
|
||||
end
|
||||
objective.comfybubble =
|
||||
objective.comfylatron.surface.create_entity(
|
||||
{
|
||||
name = 'compi-speech-bubble',
|
||||
position = objective.comfylatron.position,
|
||||
source = objective.comfylatron,
|
||||
text = text
|
||||
}
|
||||
)
|
||||
{
|
||||
name = 'compi-speech-bubble',
|
||||
position = objective.comfylatron.position,
|
||||
source = objective.comfylatron,
|
||||
text = text
|
||||
}
|
||||
)
|
||||
end
|
||||
|
||||
local function is_target_inside_habitat(pos, surface)
|
||||
@ -343,11 +343,11 @@ local function get_nearby_players()
|
||||
local objective = Chrono_table.get_table()
|
||||
local players =
|
||||
objective.comfylatron.surface.find_entities_filtered(
|
||||
{
|
||||
name = 'character',
|
||||
area = {{objective.comfylatron.position.x - 9, objective.comfylatron.position.y - 9}, {objective.comfylatron.position.x + 9, objective.comfylatron.position.y + 9}}
|
||||
}
|
||||
)
|
||||
{
|
||||
name = 'character',
|
||||
area = { { objective.comfylatron.position.x - 9, objective.comfylatron.position.y - 9 }, { objective.comfylatron.position.x + 9, objective.comfylatron.position.y + 9 } }
|
||||
}
|
||||
)
|
||||
if not players[1] then
|
||||
return false
|
||||
end
|
||||
@ -387,7 +387,7 @@ local function visit_player()
|
||||
}
|
||||
}
|
||||
)
|
||||
local symbols = {'!', '!!', '..', '...', ' '}
|
||||
local symbols = { '!', '!!', '..', '...', ' ' }
|
||||
local arg1 = symbols[math_random(1, #symbols)]
|
||||
local randomphrase = texts['approach_player'][math_random(1, #texts['approach_player'])]
|
||||
local str = string.format(randomphrase, arg1)
|
||||
@ -409,7 +409,7 @@ local function greet_player(nearby_characters)
|
||||
for _, c in pairs(nearby_characters) do
|
||||
if c.player.index == objective.comfylatron_greet_player_index then
|
||||
local arg1 = c.player.name
|
||||
local symbols = {'.', '!', '.', '!', '?', '...', ' '}
|
||||
local symbols = { '.', '!', '.', '!', '?', '...', ' ' }
|
||||
local arg2 = symbols[math_random(1, #symbols)]
|
||||
local randomphrase = texts['solo_greetings'][math_random(1, #texts['solo_greetings'])]
|
||||
local str = string.format(randomphrase, arg1, arg2)
|
||||
@ -437,7 +437,7 @@ local function talks(nearby_characters)
|
||||
if #nearby_characters == 1 then
|
||||
local c = nearby_characters[math_random(1, #nearby_characters)]
|
||||
local arg1 = c.player.name
|
||||
local symbols = {'.', '!'}
|
||||
local symbols = { '.', '!' }
|
||||
local arg2 = symbols[math_random(1, #symbols)]
|
||||
local randomphrase = texts['convo_starters'][math_random(1, #texts['convo_starters'])]
|
||||
str = str .. string.format(randomphrase, arg1, arg2)
|
||||
@ -461,9 +461,9 @@ local function talks(nearby_characters)
|
||||
str = str .. 'A new day, a new Chronotrain!'
|
||||
elseif
|
||||
objective.chronojumps >= Balance.jumps_until_overstay_is_on(Difficulty.get().difficulty_vote_value) + 3 and
|
||||
objective.overstaycount > ((objective.chronojumps - Balance.jumps_until_overstay_is_on(Difficulty.get().difficulty_vote_value)) / 3) and
|
||||
math_random(1, 30) == 1
|
||||
then
|
||||
objective.overstaycount > ((objective.chronojumps - Balance.jumps_until_overstay_is_on(Difficulty.get().difficulty_vote_value)) / 3) and
|
||||
math_random(1, 30) == 1
|
||||
then
|
||||
str = str .. "You're so relaxed!"
|
||||
elseif objective.world.ores.factor == 2.5 and math_random(1, 100) == 1 then
|
||||
str = str .. 'You know what else is very rich?'
|
||||
@ -473,13 +473,13 @@ local function talks(nearby_characters)
|
||||
local randomphrase2 = texts['old_talks'][math_random(1, #texts['old_talks'])]
|
||||
str = str .. randomphrase2
|
||||
else
|
||||
local symbols2 = {'.', '!', '?', '..', ' '}
|
||||
local symbols2 = { '.', '!', '?', '..', ' ' }
|
||||
local arg3 = symbols2[math_random(1, #symbols2)]
|
||||
local randomphrase2 = texts['new_talks_solo'][math_random(1, #texts['new_talks_solo'])]
|
||||
str = str .. string.format(randomphrase2, arg3)
|
||||
end
|
||||
else
|
||||
local symbols = {'.', '!'}
|
||||
local symbols = { '.', '!' }
|
||||
local arg1 = symbols[math_random(1, #symbols)]
|
||||
local randomphrase = texts['multiple_characters_convo_starters'][math_random(1, #texts['multiple_characters_convo_starters'])]
|
||||
str = str .. string.format(randomphrase, arg1)
|
||||
@ -487,7 +487,7 @@ local function talks(nearby_characters)
|
||||
local randomphrase2 = texts['old_talks'][math_random(1, #texts['old_talks'])]
|
||||
str = str .. randomphrase2
|
||||
else
|
||||
local symbols2 = {'.', '!', '?', '..', ' '}
|
||||
local symbols2 = { '.', '!', '?', '..', ' ' }
|
||||
local arg3 = symbols2[math_random(1, #symbols2)]
|
||||
local randomphrase2 = texts['new_talks_group'][math_random(1, #texts['new_talks_group'])]
|
||||
str = str .. string.format(randomphrase2, arg3)
|
||||
@ -513,7 +513,7 @@ local function desync(event)
|
||||
frame_speed = 0.1,
|
||||
vertical_speed = 0.1,
|
||||
height = 0.1,
|
||||
movement = {m2 - (math_random(0, m) * 0.01), m2 - (math_random(0, m) * 0.01)}
|
||||
movement = { m2 - (math_random(0, m) * 0.01), m2 - (math_random(0, m) * 0.01) }
|
||||
}
|
||||
)
|
||||
end
|
||||
@ -522,15 +522,15 @@ local function desync(event)
|
||||
blocked = true
|
||||
end
|
||||
if not event or blocked or math_random(1, 5) == 1 then
|
||||
objective.comfylatron.surface.create_entity({name = 'medium-explosion', position = objective.comfylatron.position})
|
||||
FT.flying_text(nil, objective.comfylatron.surface, objective.comfylatron.position, 'desync', {r = 150, g = 0, b = 0})
|
||||
objective.comfylatron.surface.create_entity({ name = 'medium-explosion', position = objective.comfylatron.position })
|
||||
FT.flying_text(nil, objective.comfylatron.surface, objective.comfylatron.position, 'desync', { r = 150, g = 0, b = 0 })
|
||||
objective.comfylatron.destroy()
|
||||
objective.comfylatron = nil
|
||||
else
|
||||
FT.flying_text(nil, objective.comfylatron.surface, objective.comfylatron.position, 'desync evaded', {r = 0, g = 150, b = 0})
|
||||
FT.flying_text(nil, objective.comfylatron.surface, objective.comfylatron.position, 'desync evaded', { r = 0, g = 150, b = 0 })
|
||||
if event.cause then
|
||||
if event.cause.valid and event.cause.player then
|
||||
game.print({'chronosphere.message_comfylatron_desync', event.cause.player.name}, {r = 200, g = 0, b = 0})
|
||||
game.print({ 'chronosphere.message_comfylatron_desync', event.cause.player.name }, { r = 200, g = 0, b = 0 })
|
||||
event.cause.die('player', objective.comfylatron)
|
||||
end
|
||||
end
|
||||
@ -575,10 +575,10 @@ local function analyze_random_nearby_entity()
|
||||
|
||||
local entities =
|
||||
objective.comfylatron.surface.find_entities_filtered(
|
||||
{
|
||||
area = {{objective.comfylatron.position.x - 4, objective.comfylatron.position.y - 4}, {objective.comfylatron.position.x + 4, objective.comfylatron.position.y + 4}}
|
||||
}
|
||||
)
|
||||
{
|
||||
area = { { objective.comfylatron.position.x - 4, objective.comfylatron.position.y - 4 }, { objective.comfylatron.position.x + 4, objective.comfylatron.position.y + 4 } }
|
||||
}
|
||||
)
|
||||
if not entities[1] then
|
||||
return false
|
||||
end
|
||||
@ -600,12 +600,12 @@ local function analyze_random_nearby_entity()
|
||||
arg1 = arg1 .. ' health('
|
||||
arg1 = arg1 .. entity.health
|
||||
arg1 = arg1 .. '/'
|
||||
arg1 = arg1 .. entity.prototype.max_health
|
||||
arg1 = arg1 .. entity.max_health
|
||||
arg1 = arg1 .. ')'
|
||||
local randomphrase = texts['neutral_findings'][math_random(1, #texts['neutral_findings'])]
|
||||
str = string.format(randomphrase, arg1, arg2)
|
||||
else
|
||||
local symbols = {'.', '!', '?', '?'}
|
||||
local symbols = { '.', '!', '?', '?' }
|
||||
arg2 = symbols[math_random(1, 3)]
|
||||
local randomphrase = texts['neutral_findings'][math_random(1, #texts['neutral_findings'])]
|
||||
str = string.format(randomphrase, arg1, arg2)
|
||||
@ -664,7 +664,7 @@ local function go_to_some_location()
|
||||
}
|
||||
)
|
||||
else
|
||||
local p = {x = objective.comfylatron.position.x + (-96 + math_random(0, 192)), y = objective.comfylatron.position.y + (-96 + math_random(0, 192))}
|
||||
local p = { x = objective.comfylatron.position.x + (-96 + math_random(0, 192)), y = objective.comfylatron.position.y + (-96 + math_random(0, 192)) }
|
||||
local target = objective.comfylatron.surface.find_non_colliding_position(get_comfylatron_kind(), p, 8, 1)
|
||||
if not target then
|
||||
return false
|
||||
@ -687,7 +687,7 @@ local function go_to_some_location()
|
||||
)
|
||||
end
|
||||
|
||||
local symbols = {'!', '!!', '..', '...', ' '}
|
||||
local symbols = { '!', '!!', '..', '...', ' ' }
|
||||
local arg1 = symbols[math_random(1, #symbols)]
|
||||
local randomphrase = texts['random_travel'][math_random(1, #texts['random_travel'])]
|
||||
local str = string.format(randomphrase, arg1)
|
||||
@ -710,19 +710,19 @@ local function spawn_comfylatron(surface_index, x, y)
|
||||
end
|
||||
if not objective.comfylatron_habitat then
|
||||
objective.comfylatron_habitat = {
|
||||
left_top = {x = -32, y = -192},
|
||||
right_bottom = {x = 32, y = -24} -- stops comfytron getting stuck in chests
|
||||
left_top = { x = -32, y = -192 },
|
||||
right_bottom = { x = 32, y = -24 } -- stops comfytron getting stuck in chests
|
||||
}
|
||||
end
|
||||
objective.comfylatron =
|
||||
surface.create_entity(
|
||||
{
|
||||
name = get_comfylatron_kind(),
|
||||
position = {x, y + math_random(0, 256)},
|
||||
force = 'player',
|
||||
create_build_effect_smoke = false
|
||||
}
|
||||
)
|
||||
{
|
||||
name = get_comfylatron_kind(),
|
||||
position = { x, y + math_random(0, 256) },
|
||||
force = 'player',
|
||||
create_build_effect_smoke = false
|
||||
}
|
||||
)
|
||||
end
|
||||
|
||||
local function heartbeat()
|
||||
|
@ -37,8 +37,8 @@ function Public.on_player_mined_entity(event)
|
||||
elseif entity.name == 'huge-rock' or entity.name == 'big-rock' or entity.name == 'big-sand-rock' then
|
||||
if objective.world.id == 3 then --rocky worlds
|
||||
event.buffer.clear()
|
||||
-- elseif objective.world.id == 5 then --maze worlds
|
||||
-- --nothing
|
||||
-- elseif objective.world.id == 5 then --maze worlds
|
||||
-- --nothing
|
||||
else
|
||||
Ores.prospect_ores(entity, entity.surface, entity.position)
|
||||
end
|
||||
@ -67,7 +67,7 @@ function Public.on_pre_player_left_game(event)
|
||||
player.toggle_map_editor()
|
||||
end
|
||||
if player.character then
|
||||
playertable.offline_players[#playertable.offline_players + 1] = {index = event.player_index, tick = game.tick}
|
||||
playertable.offline_players[#playertable.offline_players + 1] = { index = event.player_index, tick = game.tick }
|
||||
end
|
||||
end
|
||||
|
||||
@ -79,7 +79,7 @@ function Public.on_player_joined_game(event)
|
||||
if not playertable.flame_boots[event.player_index] then
|
||||
playertable.flame_boots[event.player_index] = {}
|
||||
end
|
||||
playertable.flame_boots[event.player_index] = {fuel = 1}
|
||||
playertable.flame_boots[event.player_index] = { fuel = 1 }
|
||||
if not playertable.flame_boots[event.player_index].steps then
|
||||
playertable.flame_boots[event.player_index].steps = {}
|
||||
end
|
||||
@ -87,26 +87,26 @@ function Public.on_player_joined_game(event)
|
||||
local surface = game.surfaces[objective.active_surface_index]
|
||||
|
||||
if player.online_time == 0 then
|
||||
player.teleport(surface.find_non_colliding_position('character', player.force.get_spawn_position(surface), 32, 0.5) or {0, 0}, surface)
|
||||
player.teleport(surface.find_non_colliding_position('character', player.force.get_spawn_position(surface), 32, 0.5) or { 0, 0 }, surface)
|
||||
for item, amount in pairs(Balance.starting_items) do
|
||||
player.insert({name = item, count = amount})
|
||||
player.insert({ name = item, count = amount })
|
||||
end
|
||||
end
|
||||
|
||||
if player.surface.index ~= objective.active_surface_index and player.surface.name ~= 'cargo_wagon' then
|
||||
player.character = nil
|
||||
player.set_controller({type = defines.controllers.god})
|
||||
player.set_controller({ type = defines.controllers.god })
|
||||
player.create_character()
|
||||
player.teleport(surface.find_non_colliding_position('character', player.force.get_spawn_position(surface), 32, 0.5) or {0, 0}, surface)
|
||||
player.teleport(surface.find_non_colliding_position('character', player.force.get_spawn_position(surface), 32, 0.5) or { 0, 0 }, surface)
|
||||
for item, amount in pairs(Balance.starting_items) do
|
||||
player.insert({name = item, count = amount})
|
||||
player.insert({ name = item, count = amount })
|
||||
end
|
||||
end
|
||||
|
||||
local tile = surface.get_tile(player.position.x, player.position.y)
|
||||
if tile.valid then
|
||||
if tile.name == 'out-of-map' then
|
||||
player.teleport(surface.find_non_colliding_position('character', player.force.get_spawn_position(surface), 32, 0.5) or {0, 0}, surface)
|
||||
player.teleport(surface.find_non_colliding_position('character', player.force.get_spawn_position(surface), 32, 0.5) or { 0, 0 }, surface)
|
||||
end
|
||||
end
|
||||
Minimap.update_surface(player)
|
||||
@ -134,35 +134,34 @@ function Public.on_player_changed_surface(event)
|
||||
player.cursor_ghost = nil
|
||||
end
|
||||
end
|
||||
|
||||
end
|
||||
|
||||
local function try_destroy_platform(entity, cause)
|
||||
local function try_destroy_platform(entity, cause)
|
||||
local pos = entity.position
|
||||
local surface = entity.surface
|
||||
if surface.platform then return end
|
||||
local asteroids = {
|
||||
['small-metallic-asteroid'] = {size = 1, amount = 1},
|
||||
['medium-metallic-asteroid'] = {size = 2, amount = 2},
|
||||
['big-metallic-asteroid'] = {size = 3, amount = 4},
|
||||
['huge-metallic-asteroid'] = {size = 6, amount = 6},
|
||||
['small-carbonic-asteroid'] = {size = 1, amount = 1},
|
||||
['medium-carbonic-asteroid'] = {size = 2, amount = 2},
|
||||
['big-carbonic-asteroid'] = {size = 3, amount = 4},
|
||||
['huge-carbonic-asteroid'] = {size = 6, amount = 6},
|
||||
['small-oxide-asteroid'] = {size = 1, amount = 1},
|
||||
['medium-oxide-asteroid'] = {size = 2, amount = 2},
|
||||
['big-oxide-asteroid'] = {size = 3, amount = 4},
|
||||
['huge-oxide-asteroid'] = {size = 6, amount = 6},
|
||||
['small-interstellar-asteroid'] = {size = 1, amount = 1},
|
||||
['medium-interstellar-asteroid'] = {size = 2, amount = 2},
|
||||
['big-interstellar-asteroid'] = {size = 3, amount = 4},
|
||||
['huge-interstellar-asteroid'] = {size = 6, amount = 6},
|
||||
['small-metallic-asteroid'] = { size = 1, amount = 1 },
|
||||
['medium-metallic-asteroid'] = { size = 2, amount = 2 },
|
||||
['big-metallic-asteroid'] = { size = 3, amount = 4 },
|
||||
['huge-metallic-asteroid'] = { size = 6, amount = 6 },
|
||||
['small-carbonic-asteroid'] = { size = 1, amount = 1 },
|
||||
['medium-carbonic-asteroid'] = { size = 2, amount = 2 },
|
||||
['big-carbonic-asteroid'] = { size = 3, amount = 4 },
|
||||
['huge-carbonic-asteroid'] = { size = 6, amount = 6 },
|
||||
['small-oxide-asteroid'] = { size = 1, amount = 1 },
|
||||
['medium-oxide-asteroid'] = { size = 2, amount = 2 },
|
||||
['big-oxide-asteroid'] = { size = 3, amount = 4 },
|
||||
['huge-oxide-asteroid'] = { size = 6, amount = 6 },
|
||||
['small-interstellar-asteroid'] = { size = 1, amount = 1 },
|
||||
['medium-interstellar-asteroid'] = { size = 2, amount = 2 },
|
||||
['big-interstellar-asteroid'] = { size = 3, amount = 4 },
|
||||
['huge-interstellar-asteroid'] = { size = 6, amount = 6 },
|
||||
}
|
||||
local stone = asteroids[entity.name]
|
||||
if cause then
|
||||
for i = stone.amount, 0, -1 do
|
||||
--register some loot or something. Can't spawn chunks outside the actual space platform!
|
||||
--register some loot or something. Can't spawn chunks outside the actual space platform!
|
||||
end
|
||||
return
|
||||
end
|
||||
@ -170,9 +169,9 @@ local function try_destroy_platform(entity, cause)
|
||||
local size = stone.size
|
||||
for x = -size, size, 1 do
|
||||
for y = -size, size, 1 do
|
||||
local tile = entity.surface.get_tile(pos.x + x,pos.y + y)
|
||||
if tile and tile.valid and tile.name == 'space-platform-foundation' then
|
||||
tiles[#tiles+1] = {position = {x = pos.x + x, y = pos.y + y}, name = 'empty-space'}
|
||||
local tile = entity.surface.get_tile(pos.x + x, pos.y + y)
|
||||
if tile and tile.valid and tile.name == 'space-platform-foundation' then
|
||||
tiles[#tiles + 1] = { position = { x = pos.x + x, y = pos.y + y }, name = 'empty-space' }
|
||||
end
|
||||
end
|
||||
end
|
||||
@ -303,8 +302,8 @@ function Public.on_built_entity(event)
|
||||
if objective.world.id ~= 7 or entity.surface.name == 'cargo_wagon' then
|
||||
entity.destroy()
|
||||
local player = game.players[event.player_index]
|
||||
Alert.alert_player_warning(player, 8, {'chronosphere.spidertron_not_allowed'})
|
||||
player.insert({name = 'spidertron', count = 1})
|
||||
Alert.alert_player_warning(player, 8, { 'chronosphere.spidertron_not_allowed' })
|
||||
player.insert({ name = 'spidertron', count = 1 })
|
||||
end
|
||||
end
|
||||
end
|
||||
@ -313,48 +312,48 @@ function Public.on_pre_player_died(event)
|
||||
local player = game.get_player(event.player_index)
|
||||
if not player or not player.valid then return end
|
||||
local surface = player.surface
|
||||
local poisons = surface.count_entities_filtered {position = player.position, radius = 10, name = 'poison-cloud'}
|
||||
local poisons = surface.count_entities_filtered { position = player.position, radius = 10, name = 'poison-cloud' }
|
||||
if poisons > 0 then
|
||||
local objective = Chrono_table.get_table()
|
||||
objective.poison_mastery_unlocked = objective.poison_mastery_unlocked + 1
|
||||
if objective.poison_mastery_unlocked == 10 then
|
||||
game.print({'chronosphere.message_poison_mastery_unlock'}, {r = 0.98, g = 0.66, b = 0.22})
|
||||
game.print({ 'chronosphere.message_poison_mastery_unlock' }, { r = 0.98, g = 0.66, b = 0.22 })
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
function Public.script_raised_revive(event)
|
||||
local entity = event.entity
|
||||
if not entity or not entity.valid then return end
|
||||
if entity.force.name == "player" then
|
||||
local entity = event.entity
|
||||
if not entity or not entity.valid then return end
|
||||
if entity.force.name == "player" then
|
||||
entity.minable = false
|
||||
entity.destructible = false
|
||||
if entity.name == 'solar-panel' or entity.name == 'substation' then
|
||||
entity.operable = false
|
||||
end
|
||||
end
|
||||
if entity.force.name == "scrapyard" then
|
||||
if entity.name == "gun-turret" then
|
||||
if entity.force.name == "scrapyard" then
|
||||
if entity.name == "gun-turret" then
|
||||
local objective = Chrono_table.get_table()
|
||||
if objective.chronojumps > 2 then
|
||||
entity.insert({name = "uranium-rounds-magazine", count = 128})
|
||||
entity.insert({ name = "uranium-rounds-magazine", count = 128 })
|
||||
else
|
||||
entity.insert({name = "firearm-magazine", count = 12})
|
||||
entity.insert({ name = "firearm-magazine", count = 12 })
|
||||
end
|
||||
elseif entity.name == "artillery-turret" then
|
||||
entity.insert({name = "artillery-shell", count = 30})
|
||||
elseif entity.name == "accumulator" then
|
||||
entity.energy = 5000000
|
||||
elseif entity.name == "storage-tank" then
|
||||
entity.insert_fluid({name = "light-oil", amount = 15000})
|
||||
end
|
||||
end
|
||||
if entity.force.name == "neutral" then
|
||||
if entity.is_entity_with_health then
|
||||
entity.health = math.random(-10, entity.prototype.max_health)
|
||||
if entity.health <= 0 then entity.die(entity.force) end
|
||||
end
|
||||
end
|
||||
elseif entity.name == "artillery-turret" then
|
||||
entity.insert({ name = "artillery-shell", count = 30 })
|
||||
elseif entity.name == "accumulator" then
|
||||
entity.energy = 5000000
|
||||
elseif entity.name == "storage-tank" then
|
||||
entity.insert_fluid({ name = "light-oil", amount = 15000 })
|
||||
end
|
||||
end
|
||||
if entity.force.name == "neutral" then
|
||||
if entity.is_entity_with_health then
|
||||
entity.health = math.random(-10, entity.max_health)
|
||||
if entity.health <= 0 then entity.die(entity.force) end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
return Public
|
||||
|
@ -20,10 +20,10 @@ local function on_player_changed_position(event)
|
||||
if not player.vehicle.valid then
|
||||
return
|
||||
end
|
||||
if player.vehicle.health == player.vehicle.prototype.max_health then
|
||||
if player.vehicle.health == player.vehicle.max_health then
|
||||
return
|
||||
end
|
||||
player.vehicle.health = player.vehicle.health + player.vehicle.prototype.max_health * 0.005
|
||||
player.vehicle.health = player.vehicle.health + player.vehicle.max_health * 0.005
|
||||
end
|
||||
|
||||
Event.add(defines.events.on_player_changed_position, on_player_changed_position)
|
||||
|
@ -39,12 +39,12 @@ local function reward_tokens(expanse, entity)
|
||||
if chance > 0 then
|
||||
chance = math.floor(chance * 1000)
|
||||
if math.random(1, 1000) <= chance then
|
||||
entity.surface.spill_item_stack({position = entity.position, stack = { name = 'coin', count = 1 }, enable_looted = true, allow_belts = false})
|
||||
entity.surface.spill_item_stack({ position = entity.position, stack = { name = 'coin', count = 1 }, enable_looted = true, allow_belts = false })
|
||||
end
|
||||
end
|
||||
if count > 0 then
|
||||
for _ = 1, count, 1 do
|
||||
entity.surface.spill_item_stack({position = entity.position, stack = { name = 'coin', count = 1 }, enable_looted = true, allow_belts = false})
|
||||
entity.surface.spill_item_stack({ position = entity.position, stack = { name = 'coin', count = 1 }, enable_looted = true, allow_belts = false })
|
||||
end
|
||||
end
|
||||
end
|
||||
@ -222,7 +222,7 @@ function Public.invasion_detonate(event)
|
||||
local entities_nearby = surface.find_entities_filtered { position = position, radius = 16 }
|
||||
for _, entity in pairs(entities_nearby) do
|
||||
if entity.valid and entity.is_entity_with_health then
|
||||
entity.damage(entity.prototype.max_health * 0.75, 'enemy')
|
||||
entity.damage(entity.max_health * 0.75, 'enemy')
|
||||
end
|
||||
end
|
||||
surface.create_entity({ name = 'nuke-explosion', position = position })
|
||||
@ -288,10 +288,10 @@ local function plan_invasion(expanse, invasion_numbers)
|
||||
for ii = 1, rounds, 1 do
|
||||
schedule_biters(expanse, surface, position, 120 + (ii - 1) * 300, ii)
|
||||
end
|
||||
candidates[i].render.time_to_live = ( 122 * 60 + rounds * 300)
|
||||
candidates[i].render.time_to_live = (122 * 60 + rounds * 300)
|
||||
end
|
||||
for j = invasion_numbers.groups + 1, #candidates, 1 do
|
||||
candidates[j].render.time_to_live = ( 122 * 60)
|
||||
candidates[j].render.time_to_live = (122 * 60)
|
||||
end
|
||||
expanse.invasion_candidates = {}
|
||||
end
|
||||
@ -356,9 +356,9 @@ function Public.expand(expanse, left_top)
|
||||
surface.create_entity({ name = 'crude-oil', position = { a - 4, a - 4 }, amount = 1500000 })
|
||||
Task.set_timeout_in_ticks(30, delay_infini_tree_token, { surface = surface, position = { a - 4, a + 4 } })
|
||||
surface.create_entity({ name = 'big-rock', position = { a + 4, a - 4 } })
|
||||
surface.spill_item_stack({position = {a, a + 2}, stack = { name = 'coin', count = 1 }, enable_looted = false, allow_belts = false})
|
||||
surface.spill_item_stack({position = { a + 0.5, a + 2.5 }, stack = { name = 'coin', count = 1 }, enable_looted = false, allow_belts = false})
|
||||
surface.spill_item_stack({position = { a - 0.5, a + 2.5 }, stack = { name = 'coin', count = 1 }, enable_looted = false, allow_belts = false})
|
||||
surface.spill_item_stack({ position = { a, a + 2 }, stack = { name = 'coin', count = 1 }, enable_looted = false, allow_belts = false })
|
||||
surface.spill_item_stack({ position = { a + 0.5, a + 2.5 }, stack = { name = 'coin', count = 1 }, enable_looted = false, allow_belts = false })
|
||||
surface.spill_item_stack({ position = { a - 0.5, a + 2.5 }, stack = { name = 'coin', count = 1 }, enable_looted = false, allow_belts = false })
|
||||
|
||||
for x = 0, square_size, 1 do
|
||||
for y = 0, square_size, 1 do
|
||||
@ -462,7 +462,7 @@ function Public.set_container(expanse, entity)
|
||||
for index = 1, #inventory, 1 do
|
||||
local slot = inventory[index]
|
||||
if slot.valid_for_read then
|
||||
entity.surface.spill_item_stack({position = entity.position, stack = slot, enable_looted = true, allow_belts = false})
|
||||
entity.surface.spill_item_stack({ position = entity.position, stack = slot, enable_looted = true, allow_belts = false })
|
||||
end
|
||||
end
|
||||
end
|
||||
@ -484,7 +484,7 @@ function Public.set_container(expanse, entity)
|
||||
for slot = 1, #container.price, 1 do
|
||||
if #container.price >= slot then
|
||||
local item = container.price[slot]
|
||||
section.set_slot(slot, {value = item.name, min = item.count, import_from = 'nauvis'})
|
||||
section.set_slot(slot, { value = item.name, min = item.count, import_from = 'nauvis' })
|
||||
end
|
||||
end
|
||||
end
|
||||
|
@ -576,7 +576,7 @@ local function damage_entity_outside_of_fence(e)
|
||||
return
|
||||
end
|
||||
|
||||
e.health = e.health - math_random(math.floor(e.prototype.max_health * 0.05), math.floor(e.prototype.max_health * 0.1))
|
||||
e.health = e.health - math_random(math.floor(e.max_health * 0.05), math.floor(e.max_health * 0.1))
|
||||
if e.health <= 0 then
|
||||
e.die('enemy')
|
||||
end
|
||||
|
@ -20,10 +20,10 @@ local function on_player_changed_position(event)
|
||||
if not player.vehicle.valid then
|
||||
return
|
||||
end
|
||||
if player.vehicle.health == player.vehicle.prototype.max_health then
|
||||
if player.vehicle.health == player.vehicle.max_health then
|
||||
return
|
||||
end
|
||||
player.vehicle.health = player.vehicle.health + player.vehicle.prototype.max_health * 0.005
|
||||
player.vehicle.health = player.vehicle.health + player.vehicle.max_health * 0.005
|
||||
end
|
||||
|
||||
Event.add(defines.events.on_player_changed_position, on_player_changed_position)
|
||||
|
@ -666,7 +666,7 @@ local function damage_entity_outside_of_fence(e)
|
||||
return
|
||||
end
|
||||
|
||||
e.health = e.health - math_random(math.floor(e.prototype.max_health * 0.05), math.floor(e.prototype.max_health * 0.1))
|
||||
e.health = e.health - math_random(math.floor(e.max_health * 0.05), math.floor(e.max_health * 0.1))
|
||||
if e.health <= 0 then
|
||||
e.die('enemy')
|
||||
end
|
||||
|
@ -17,10 +17,10 @@ local function on_player_changed_position(event)
|
||||
if not player.vehicle.valid then
|
||||
return
|
||||
end
|
||||
if player.vehicle.health == player.vehicle.prototype.max_health then
|
||||
if player.vehicle.health == player.vehicle.max_health then
|
||||
return
|
||||
end
|
||||
player.vehicle.health = player.vehicle.health + player.vehicle.prototype.max_health * 0.005
|
||||
player.vehicle.health = player.vehicle.health + player.vehicle.max_health * 0.005
|
||||
end
|
||||
|
||||
Event.add(defines.events.on_player_changed_position, on_player_changed_position)
|
||||
|
@ -23,10 +23,10 @@ local function on_player_changed_position(event)
|
||||
return
|
||||
end
|
||||
|
||||
if player.vehicle.health == player.vehicle.prototype.max_health then
|
||||
if player.vehicle.health == player.vehicle.max_health then
|
||||
return
|
||||
end
|
||||
player.vehicle.health = player.vehicle.health + player.vehicle.prototype.max_health * 0.005
|
||||
player.vehicle.health = player.vehicle.health + player.vehicle.max_health * 0.005
|
||||
end
|
||||
|
||||
Event.add(defines.events.on_player_changed_position, on_player_changed_position)
|
||||
|
@ -548,14 +548,14 @@ local function on_player_mined_entity(event)
|
||||
return
|
||||
end
|
||||
local positions = {}
|
||||
local r = math.ceil(entity.prototype.max_health / 32)
|
||||
local r = math.ceil(entity.max_health / 32)
|
||||
for x = r * -1, r, 1 do
|
||||
for y = r * -1, r, 1 do
|
||||
positions[#positions + 1] = { x = entity.position.x + x, y = entity.position.y + y }
|
||||
end
|
||||
end
|
||||
positions = shuffle(positions)
|
||||
for i = 1, math.ceil(entity.prototype.max_health / 32), 1 do
|
||||
for i = 1, math.ceil(entity.max_health / 32), 1 do
|
||||
if not positions[i] then
|
||||
return
|
||||
end
|
||||
|
@ -583,7 +583,7 @@ local function on_entity_died(event)
|
||||
return
|
||||
end
|
||||
local revived_entity = entity.clone({ position = entity.position })
|
||||
revived_entity.health = entity.prototype.max_health
|
||||
revived_entity.health = entity.max_health
|
||||
entity.destroy()
|
||||
end
|
||||
|
||||
|
@ -18,6 +18,7 @@ local scenario_name = Public.scenario_name
|
||||
local StatData = require 'utils.datastore.statistics'
|
||||
StatData.add_normalize('coins', 'Coins collected'):set_tooltip('The amount of coins the player has collected through mining/killed enemies.')
|
||||
|
||||
|
||||
local random = math.random
|
||||
local floor = math.floor
|
||||
local abs = math.abs
|
||||
@ -165,6 +166,7 @@ local function check_health()
|
||||
if locomotive_health <= 0 then
|
||||
Public.set('locomotive_health', 0)
|
||||
end
|
||||
|
||||
local m = locomotive_health / locomotive_max_health
|
||||
if carriages then
|
||||
for i = 1, #carriages do
|
||||
@ -172,11 +174,10 @@ local function check_health()
|
||||
if not (entity and entity.valid) then
|
||||
return
|
||||
end
|
||||
local cargo_health = 600
|
||||
if entity.type == 'locomotive' then
|
||||
entity.health = 1000 * m
|
||||
entity.health = entity.max_health * m
|
||||
else
|
||||
entity.health = cargo_health * m
|
||||
entity.health = entity.max_health * m
|
||||
end
|
||||
end
|
||||
end
|
||||
@ -288,7 +289,7 @@ end
|
||||
|
||||
local function is_protected(e)
|
||||
local map_name = 'mtn_v3'
|
||||
if string.sub(e.surface.name, 0, #map_name) ~= map_name then
|
||||
if string.sub(e.surface.name, 0, #scenario_name) ~= scenario_name then
|
||||
return true
|
||||
end
|
||||
|
||||
@ -571,7 +572,7 @@ local mining_events = {
|
||||
return
|
||||
end
|
||||
|
||||
Public.tick_tack_trap(entity.surface, entity.position)
|
||||
Public.tick_tack_trap(entity)
|
||||
entity.destroy()
|
||||
end,
|
||||
2048,
|
||||
@ -737,7 +738,7 @@ local function on_player_mined_entity(event)
|
||||
|
||||
local map_name = 'mtn_v3'
|
||||
|
||||
if string.sub(entity.surface.name, 0, #map_name) ~= map_name then
|
||||
if string.sub(entity.surface.name, 0, #scenario_name) ~= scenario_name then
|
||||
return
|
||||
end
|
||||
|
||||
@ -790,7 +791,7 @@ local function on_robot_mined_entity(event)
|
||||
|
||||
local map_name = 'mtn_v3'
|
||||
|
||||
if string.sub(entity.surface.name, 0, #map_name) ~= map_name then
|
||||
if string.sub(entity.surface.name, 0, #scenario_name) ~= scenario_name then
|
||||
return
|
||||
end
|
||||
|
||||
@ -1010,7 +1011,7 @@ local function on_entity_died(event)
|
||||
|
||||
local map_name = 'mtn_v3'
|
||||
|
||||
if string.sub(entity.surface.name, 0, #map_name) ~= map_name then
|
||||
if string.sub(entity.surface.name, 0, #scenario_name) ~= scenario_name then
|
||||
return
|
||||
end
|
||||
|
||||
@ -1057,7 +1058,7 @@ local function on_entity_died(event)
|
||||
return
|
||||
end
|
||||
if random(1, 512) == 1 then
|
||||
Public.tick_tack_trap(entity.surface, entity.position)
|
||||
Public.tick_tack_trap(entity)
|
||||
return
|
||||
end
|
||||
end
|
||||
@ -1102,7 +1103,7 @@ local function on_entity_died(event)
|
||||
return
|
||||
end
|
||||
if random(1, 512) == 1 then
|
||||
Public.tick_tack_trap(entity.surface, entity.position)
|
||||
Public.tick_tack_trap(entity)
|
||||
return
|
||||
end
|
||||
entity.destroy()
|
||||
@ -1433,7 +1434,7 @@ function Public.loco_died(invalid_locomotive)
|
||||
}
|
||||
)
|
||||
|
||||
surface.spill_item_stack(this.locomotive.position, { name = 'coin', count = 512 }, false)
|
||||
surface.spill_item_stack(this.locomotive.position, { name = 'coin', count = 512, quality = 'normal' }, false)
|
||||
this.game_reset_tick = 5400
|
||||
for _, player in pairs(game.connected_players) do
|
||||
player.play_sound { path = 'utility/game_lost', volume_modifier = 0.75 }
|
||||
@ -1483,7 +1484,7 @@ local function on_built_entity(event)
|
||||
|
||||
local map_name = 'mtn_v3'
|
||||
|
||||
if string.sub(entity.surface.name, 0, #map_name) ~= map_name then
|
||||
if string.sub(entity.surface.name, 0, #scenario_name) ~= scenario_name then
|
||||
return
|
||||
end
|
||||
|
||||
@ -1502,7 +1503,7 @@ local function on_built_entity(event)
|
||||
}
|
||||
)
|
||||
|
||||
player.surface.spill_item_stack(position, { name = entity.name, count = 1, true })
|
||||
player.surface.spill_item_stack(position, { name = entity.name, count = 1, true, quality = 'normal' }, false)
|
||||
entity.destroy()
|
||||
return
|
||||
end
|
||||
@ -1583,7 +1584,7 @@ local function on_robot_built_entity(event)
|
||||
|
||||
local map_name = 'mtn_v3'
|
||||
|
||||
if string.sub(entity.surface.name, 0, #map_name) ~= map_name then
|
||||
if string.sub(entity.surface.name, 0, #scenario_name) ~= scenario_name then
|
||||
return
|
||||
end
|
||||
|
||||
@ -1680,7 +1681,7 @@ local on_player_or_robot_built_tile = function (event)
|
||||
|
||||
local map_name = 'mtn_v3'
|
||||
|
||||
if string.sub(surface.name, 0, #map_name) ~= map_name then
|
||||
if string.sub(surface.name, 0, #scenario_name) ~= scenario_name then
|
||||
return
|
||||
end
|
||||
|
||||
|
@ -19,6 +19,7 @@ local BottomFrame = require 'utils.gui.bottom_frame'
|
||||
local Modifiers = require 'utils.player_modifiers'
|
||||
local Session = require 'utils.datastore.session_data'
|
||||
|
||||
local scenario_name = Public.scenario_name
|
||||
local zone_settings = Public.zone_settings
|
||||
local remove_boost_movement_speed_on_respawn
|
||||
local de = defines.events
|
||||
@ -987,7 +988,7 @@ local function on_player_cursor_stack_changed(event)
|
||||
|
||||
local blacklisted_spawn_items = {
|
||||
['cut-paste-tool'] = true,
|
||||
['rts-tool'] = true,
|
||||
['spidertron-remote'] = true,
|
||||
['artillery-targeting-remote'] = true,
|
||||
}
|
||||
|
||||
@ -1630,7 +1631,7 @@ function Public.on_player_changed_position(event)
|
||||
|
||||
local map_name = 'mtn_v3'
|
||||
|
||||
if string.sub(player.surface.name, 0, #map_name) ~= map_name then
|
||||
if string.sub(player.surface.name, 0, #scenario_name) ~= scenario_name then
|
||||
return
|
||||
end
|
||||
|
||||
@ -1711,8 +1712,10 @@ function Public.disable_tech()
|
||||
force.technologies['artillery-shell-range-1'].researched = false
|
||||
force.technologies['artillery-shell-speed-1'].enabled = false
|
||||
force.technologies['artillery-shell-speed-1'].researched = false
|
||||
force.technologies['artillery-shell-damage-1'].enabled = false
|
||||
force.technologies['artillery-shell-damage-1'].researched = false
|
||||
if Public.get('space_age') then
|
||||
force.technologies['artillery-shell-damage-1'].enabled = false
|
||||
force.technologies['artillery-shell-damage-1'].researched = false
|
||||
end
|
||||
force.technologies['lamp'].researched = true
|
||||
force.technologies['railway'].researched = true
|
||||
force.technologies['land-mine'].enabled = false
|
||||
|
@ -273,8 +273,7 @@ local function wintery(ent, extra_lights)
|
||||
minimum_darkness = 0,
|
||||
oriented = false,
|
||||
color = color,
|
||||
target = e,
|
||||
target_offset = { 0, -0.5 },
|
||||
target = { entity = e, offset = { 0, -0.5 } },
|
||||
surface = e.surface
|
||||
}
|
||||
)
|
||||
|
@ -136,8 +136,7 @@ local function render_owner_text(renders, player, entity, new_owner)
|
||||
rendering.draw_text {
|
||||
text = '## - ' .. new_owner.name .. "'s " .. ce_name .. ' - ##',
|
||||
surface = entity.surface,
|
||||
target = entity,
|
||||
target_offset = { 0, -2.6 },
|
||||
target = { entity = entity, offset = { 0, -2.6 } },
|
||||
color = color,
|
||||
scale = 1.05,
|
||||
font = 'default-large-semibold',
|
||||
@ -149,8 +148,7 @@ local function render_owner_text(renders, player, entity, new_owner)
|
||||
rendering.draw_text {
|
||||
text = '## - ' .. player.name .. "'s " .. ce_name .. ' - ##',
|
||||
surface = entity.surface,
|
||||
target = entity,
|
||||
target_offset = { 0, -2.6 },
|
||||
target = { entity = entity, offset = { 0, -2.6 } },
|
||||
color = color,
|
||||
scale = 1.05,
|
||||
font = 'default-large-semibold',
|
||||
@ -1135,6 +1133,7 @@ function Public.create_room_surface(car)
|
||||
}
|
||||
}
|
||||
local surface = game.create_surface(car.surface_name, map_gen_settings)
|
||||
surface.no_enemies_mode = true
|
||||
surface.freeze_daytime = true
|
||||
surface.daytime = 0.1
|
||||
surface.request_to_generate_chunks({ 16, 16 }, 1)
|
||||
|
@ -12,6 +12,7 @@ local deepcopy = table.deepcopy
|
||||
local random = math.random
|
||||
local sqrt = math.sqrt
|
||||
|
||||
local scenario_name = Public.scenario_name
|
||||
local fallout_width = 64
|
||||
local fallout_debris = {}
|
||||
|
||||
@ -571,7 +572,7 @@ function Public.create_room_surface(icw, unit_number)
|
||||
if game.surfaces[tostring(unit_number)] then
|
||||
return game.surfaces[tostring(unit_number)]
|
||||
end
|
||||
local map_gen_settings = {
|
||||
local map_gen_settings = {
|
||||
['width'] = 2,
|
||||
['height'] = 2,
|
||||
['water'] = 0,
|
||||
@ -584,9 +585,10 @@ function Public.create_room_surface(icw, unit_number)
|
||||
['decorative'] = { treat_missing_as_default = false }
|
||||
}
|
||||
}
|
||||
local surface = game.create_surface(tostring(unit_number), map_gen_settings)
|
||||
surface.freeze_daytime = true
|
||||
surface.daytime = 0.1
|
||||
local surface = game.create_surface(tostring(unit_number), map_gen_settings)
|
||||
surface.no_enemies_mode = true
|
||||
surface.freeze_daytime = true
|
||||
surface.daytime = 0.1
|
||||
surface.request_to_generate_chunks({ 16, 16 }, 1)
|
||||
surface.force_generate_chunk_requests()
|
||||
exclude_surface(surface)
|
||||
@ -1094,7 +1096,7 @@ function Public.on_player_or_robot_built_tile(event)
|
||||
|
||||
local map_name = 'mtn_v3'
|
||||
|
||||
if string.sub(surface.name, 0, #map_name) == map_name then
|
||||
if string.sub(surface.name, 0, #scenario_name) == scenario_name then
|
||||
return
|
||||
end
|
||||
|
||||
|
@ -13,6 +13,7 @@ local Core = require 'utils.core'
|
||||
local Task = require 'utils.task_token'
|
||||
|
||||
local zone_settings = Public.zone_settings
|
||||
local scenario_name = Public.scenario_name
|
||||
|
||||
local rpg_main_frame = RPG.main_frame_name
|
||||
local random = math.random
|
||||
@ -186,7 +187,7 @@ local function hurt_players_outside_of_aura()
|
||||
local map_name = 'mtn_v3'
|
||||
Core.iter_connected_players(
|
||||
function (player)
|
||||
if sub(player.surface.name, 0, #map_name) == map_name then
|
||||
if sub(player.surface.name, 0, #scenario_name) == scenario_name then
|
||||
local position = player.position
|
||||
local inside = ((position.x - loco.x) ^ 2 + (position.y - loco.y) ^ 2) < upgrades.locomotive_aura_radius ^ 2
|
||||
if not inside then
|
||||
@ -197,7 +198,7 @@ local function hurt_players_outside_of_aura()
|
||||
if random(1, 3) == 1 then
|
||||
player.surface.create_entity({ name = 'medium-scorchmark', position = position, force = 'neutral' })
|
||||
end
|
||||
local max_health = floor(player.character.prototype.max_health + player.character_health_bonus + player.force.character_health_bonus)
|
||||
local max_health = floor(player.character.max_health + player.character_health_bonus + player.force.character_health_bonus)
|
||||
local vehicle = player.vehicle
|
||||
if vehicle and vehicle.valid and non_valid_vehicles[vehicle.type] then
|
||||
player.driving = false
|
||||
@ -458,6 +459,10 @@ local function set_locomotive_health()
|
||||
if health_text and health_text.valid then
|
||||
health_text.text = 'HP: ' .. round(locomotive_health) .. ' / ' .. round(locomotive_max_health)
|
||||
end
|
||||
|
||||
|
||||
|
||||
|
||||
local carriages = Public.get('carriages')
|
||||
if carriages then
|
||||
for i = 1, #carriages do
|
||||
@ -466,11 +471,10 @@ local function set_locomotive_health()
|
||||
return
|
||||
end
|
||||
get_driver_action(entity)
|
||||
local cargo_health = 600
|
||||
if entity.type == 'locomotive' then
|
||||
entity.health = 1000 * m
|
||||
entity.health = entity.max_health * m
|
||||
else
|
||||
entity.health = cargo_health * m
|
||||
entity.health = entity.max_health * m
|
||||
end
|
||||
end
|
||||
end
|
||||
|
@ -2,6 +2,40 @@ local Event = require 'utils.event'
|
||||
local Public = require 'maps.mountain_fortress_v3.table'
|
||||
|
||||
local random = math.random
|
||||
local biters
|
||||
|
||||
if has_space_age() then
|
||||
biters = {
|
||||
'small-biter',
|
||||
'medium-biter',
|
||||
'big-biter',
|
||||
'behemoth-biter',
|
||||
'small-spitter',
|
||||
'medium-spitter',
|
||||
'big-spitter',
|
||||
'behemoth-spitter',
|
||||
'small-wriggler-pentapod',
|
||||
'medium-wriggler-pentapod',
|
||||
'big-wriggler-pentapod',
|
||||
'small-strafer-pentapod',
|
||||
'medium-strafer-pentapod',
|
||||
'big-strafer-pentapod',
|
||||
'small-stomper-pentapod',
|
||||
'medium-stomper-pentapod',
|
||||
'big-stomper-pentapod',
|
||||
}
|
||||
else
|
||||
biters = {
|
||||
'small-biter',
|
||||
'medium-biter',
|
||||
'big-biter',
|
||||
'behemoth-biter',
|
||||
'small-spitter',
|
||||
'medium-spitter',
|
||||
'big-spitter',
|
||||
'behemoth-spitter',
|
||||
}
|
||||
end
|
||||
|
||||
local function shoo(event)
|
||||
local icw_locomotive = Public.get('icw_locomotive')
|
||||
@ -74,16 +108,7 @@ function Public.spawn_biter()
|
||||
end
|
||||
|
||||
local position = loco_surface.find_non_colliding_position('market', center_position, 128, 0.5)
|
||||
local biters = {
|
||||
'small-biter',
|
||||
'medium-biter',
|
||||
'big-biter',
|
||||
'behemoth-biter',
|
||||
'small-spitter',
|
||||
'medium-spitter',
|
||||
'big-spitter',
|
||||
'behemoth-spitter',
|
||||
}
|
||||
|
||||
|
||||
local size_of = #biters
|
||||
|
||||
@ -93,22 +118,20 @@ function Public.spawn_biter()
|
||||
|
||||
local chosen_ent = biters[random(1, size_of)]
|
||||
|
||||
this.locomotive_biter = loco_surface.create_entity({name = chosen_ent, position = position, force = 'player', create_build_effect_smoke = false})
|
||||
this.locomotive_biter = loco_surface.create_entity({ name = chosen_ent, position = position, force = 'player', create_build_effect_smoke = false })
|
||||
|
||||
rendering.draw_text {
|
||||
text = ({'locomotive.shoo'}),
|
||||
text = ({ 'locomotive.shoo' }),
|
||||
surface = this.locomotive_biter.surface,
|
||||
target = this.locomotive_biter,
|
||||
target_offset = {0, -3.5},
|
||||
target = { entity = this.locomotive_biter, offset = { 0, -3.5 } },
|
||||
scale = 1.05,
|
||||
font = 'heading-2',
|
||||
color = {r = 175, g = 75, b = 255},
|
||||
color = { r = 175, g = 75, b = 255 },
|
||||
alignment = 'center',
|
||||
scale_with_zoom = false
|
||||
}
|
||||
|
||||
this.locomotive_biter.ai_settings.allow_destroy_when_commands_fail = false
|
||||
this.locomotive_biter.ai_settings.allow_try_return_to_spawner = false
|
||||
end
|
||||
|
||||
local function on_console_chat(event)
|
||||
|
@ -41,6 +41,7 @@ local function add_space(frame)
|
||||
add_style(frame.add { type = 'line', direction = 'horizontal' }, space)
|
||||
end
|
||||
|
||||
|
||||
local function get_items()
|
||||
local market_limits = Public.get('market_limits')
|
||||
local main_market_items = Public.get('main_market_items')
|
||||
@ -511,6 +512,33 @@ local function get_items()
|
||||
}
|
||||
end
|
||||
|
||||
main_market_items['roboport'] = {
|
||||
stack = 1,
|
||||
value = 'coin',
|
||||
price = fixed_prices.roboport_cost,
|
||||
tooltip = ({ 'entity-name.roboport' }),
|
||||
upgrade = false,
|
||||
static = true
|
||||
}
|
||||
|
||||
main_market_items['construction-robot'] = {
|
||||
stack = 1,
|
||||
value = 'coin',
|
||||
price = fixed_prices.construction_bot_cost,
|
||||
tooltip = ({ 'entity-name.construction-robot' }),
|
||||
upgrade = false,
|
||||
static = true
|
||||
}
|
||||
|
||||
main_market_items['storage-chest'] = {
|
||||
stack = 1,
|
||||
value = 'coin',
|
||||
price = fixed_prices.chest_cost,
|
||||
tooltip = ({ 'entity-name.storage-chest' }),
|
||||
upgrade = false,
|
||||
static = true
|
||||
}
|
||||
|
||||
return main_market_items
|
||||
end
|
||||
|
||||
@ -1080,17 +1108,17 @@ local function gui_click(event)
|
||||
]]
|
||||
local m = this.locomotive_health / this.locomotive_max_health
|
||||
|
||||
|
||||
if this.carriages then
|
||||
for i = 1, #this.carriages do
|
||||
local entity = this.carriages[i]
|
||||
if not (entity and entity.valid) then
|
||||
return
|
||||
end
|
||||
local cargo_health = 600
|
||||
if entity.type == 'locomotive' then
|
||||
entity.health = 1000 * m
|
||||
entity.health = entity.max_health * m
|
||||
else
|
||||
entity.health = cargo_health * m
|
||||
entity.health = entity.max_health * m
|
||||
end
|
||||
end
|
||||
end
|
||||
@ -1484,8 +1512,7 @@ local function create_market(data, rebuild)
|
||||
y_scale = scale,
|
||||
tint = { random(60, 255), random(60, 255), random(60, 255) },
|
||||
render_layer = 'selection-box',
|
||||
target = this.market,
|
||||
target_offset = { -0.7 + random(0, 140) * 0.01, y },
|
||||
target = { entity = this.market, offset = { -0.7 + random(0, 140) * 0.01, y } },
|
||||
surface = surface
|
||||
}
|
||||
)
|
||||
@ -1510,7 +1537,6 @@ local function create_market(data, rebuild)
|
||||
surface = surface,
|
||||
target = this.mystical_chest.entity,
|
||||
scale = 1.2,
|
||||
target_offset = { 0, 0 },
|
||||
color = { r = 0.98, g = 0.66, b = 0.22 },
|
||||
alignment = 'center'
|
||||
}
|
||||
@ -1521,9 +1547,8 @@ local function create_market(data, rebuild)
|
||||
rendering.draw_text {
|
||||
text = 'Market',
|
||||
surface = surface,
|
||||
target = this.market,
|
||||
target = { entity = this.market, offset = { 0, -2 } },
|
||||
scale = 1.5,
|
||||
target_offset = { 0, -2 },
|
||||
color = { r = 0.98, g = 0.66, b = 0.22 },
|
||||
alignment = 'center'
|
||||
}
|
||||
|
@ -137,24 +137,26 @@ function Public.locomotive_spawn(surface, position, reversed)
|
||||
extra_wagons = 0
|
||||
end
|
||||
|
||||
local quality = this.space_age and 'legendary' or 'normal'
|
||||
|
||||
if reversed then
|
||||
position.y = position.y - (6 * extra_wagons)
|
||||
for y = -6, 6, 2 do
|
||||
surface.create_entity({ name = 'straight-rail', position = { position.x, position.y + y }, force = 'player', direction = 0 })
|
||||
end
|
||||
this.locomotive = surface.create_entity({ name = 'locomotive', position = { position.x, position.y + -3 }, force = 'player', direction = defines.direction.south })
|
||||
this.locomotive = surface.create_entity({ name = 'locomotive', position = { position.x, position.y + -3 }, force = 'player', direction = defines.direction.south, quality = quality })
|
||||
this.locomotive.get_inventory(defines.inventory.fuel).insert({ name = 'wood', count = 100 })
|
||||
|
||||
this.locomotive_cargo = surface.create_entity({ name = 'cargo-wagon', position = { position.x, position.y + 3 }, force = 'player', direction = defines.direction.south })
|
||||
this.locomotive_cargo = surface.create_entity({ name = 'cargo-wagon', position = { position.x, position.y + 3 }, force = 'player', direction = defines.direction.south, quality = quality })
|
||||
this.locomotive_cargo.get_inventory(defines.inventory.cargo_wagon).insert({ name = 'raw-fish', count = 8 })
|
||||
else
|
||||
for y = -6, 6, 2 do
|
||||
surface.create_entity({ name = 'straight-rail', position = { position.x, position.y + y }, force = 'player', direction = 0 })
|
||||
end
|
||||
this.locomotive = surface.create_entity({ name = 'locomotive', position = { position.x, position.y + -3 }, force = 'player' })
|
||||
this.locomotive = surface.create_entity({ name = 'locomotive', position = { position.x, position.y + -3 }, force = 'player', quality = quality })
|
||||
this.locomotive.get_inventory(defines.inventory.fuel).insert({ name = 'wood', count = 100 })
|
||||
|
||||
this.locomotive_cargo = surface.create_entity({ name = 'cargo-wagon', position = { position.x, position.y + 3 }, force = 'player' })
|
||||
this.locomotive_cargo = surface.create_entity({ name = 'cargo-wagon', position = { position.x, position.y + 3 }, force = 'player', quality = quality })
|
||||
this.locomotive_cargo.get_inventory(defines.inventory.cargo_wagon).insert({ name = 'raw-fish', count = 8 })
|
||||
end
|
||||
|
||||
@ -207,8 +209,7 @@ function Public.locomotive_spawn(surface, position, reversed)
|
||||
y_scale = scale,
|
||||
tint = { random(60, 255), random(60, 255), random(60, 255) },
|
||||
render_layer = 'selection-box',
|
||||
target = this.locomotive_cargo,
|
||||
target_offset = { -0.7 + random(0, 140) * 0.01, y },
|
||||
target = { entity = this.locomotive_cargo, offset = { -0.7 + random(0, 140) * 0.01, y } },
|
||||
surface = surface
|
||||
}
|
||||
)
|
||||
|
@ -302,8 +302,10 @@ function Public.reset_map()
|
||||
end
|
||||
|
||||
game.speed = 1
|
||||
surface.destroy_decoratives({ name = "brown-cup", invert = true })
|
||||
surface.destroy_decoratives({ name = "small-sand-rock", invert = true })
|
||||
if this.space_age then
|
||||
surface.destroy_decoratives({ name = "brown-cup", invert = true })
|
||||
surface.destroy_decoratives({ name = "small-sand-rock", invert = true })
|
||||
end
|
||||
|
||||
Task.set_queue_speed(16)
|
||||
|
||||
|
@ -38,7 +38,7 @@ local mining_chance_weights = {
|
||||
{ name = 'pipe-to-ground', chance = 10 },
|
||||
{ name = 'plastic-bar', chance = 5 },
|
||||
{ name = 'processing-unit', chance = 2 },
|
||||
{ name = 'used-up-uranium-fuel-cell', chance = 1 },
|
||||
{ name = 'depleted-uranium-fuel-cell', chance = 1 },
|
||||
{ name = 'uranium-fuel-cell', chance = 1 },
|
||||
{ name = 'rocket-fuel', chance = 3 },
|
||||
{ name = 'low-density-structure', chance = 1 },
|
||||
@ -87,7 +87,7 @@ local scrap_yield_amounts = {
|
||||
['pipe-to-ground'] = 1,
|
||||
['plastic-bar'] = 4,
|
||||
['processing-unit'] = 1,
|
||||
['used-up-uranium-fuel-cell'] = 1,
|
||||
['depleted-uranium-fuel-cell'] = 1,
|
||||
['uranium-fuel-cell'] = 0.3,
|
||||
['rocket-fuel'] = 0.3,
|
||||
['low-density-structure'] = 0.3,
|
||||
|
@ -20,6 +20,7 @@ local function reset_forces(new_surface, old_surface)
|
||||
end
|
||||
end
|
||||
|
||||
---@param surface LuaSurface
|
||||
local function teleport_players(surface)
|
||||
local adjusted_zones = Public.get('adjusted_zones')
|
||||
local position
|
||||
@ -43,13 +44,15 @@ local function teleport_players(surface)
|
||||
end
|
||||
|
||||
for _, player in pairs(game.connected_players) do
|
||||
player.teleport(surface.find_non_colliding_position('character', position, 3, 0, 5), surface)
|
||||
local pos = surface.find_non_colliding_position('character', position, 3, 0)
|
||||
player.teleport({ x = pos.x, y = pos.y }, surface)
|
||||
end
|
||||
end
|
||||
|
||||
local function clear_scheduler(scheduler)
|
||||
scheduler.operation = nil
|
||||
scheduler.surface = nil
|
||||
scheduler.old_surface_name = nil
|
||||
scheduler.remove_surface = false
|
||||
scheduler.start_after = 0
|
||||
end
|
||||
@ -117,6 +120,11 @@ local function scheduled_surface_clearing()
|
||||
scheduler.start_after = tick + 100
|
||||
elseif operation == 'done' then
|
||||
game.print(mapkeeper .. ' Done clearing old surface.')
|
||||
local new_surface_index = Public.get('active_surface_index')
|
||||
local new_surface = game.get_surface(new_surface_index)
|
||||
if new_surface and new_surface.valid then
|
||||
new_surface.name = scheduler.old_surface_name
|
||||
end
|
||||
clear_scheduler(scheduler)
|
||||
end
|
||||
end
|
||||
@ -184,6 +192,7 @@ function Public.add_schedule_to_delete_surface(remove_surface)
|
||||
local scheduler = Public.get('scheduler')
|
||||
scheduler.operation = 'warn'
|
||||
scheduler.surface = surface
|
||||
scheduler.old_surface_name = surface.name
|
||||
scheduler.remove_surface = remove_surface or false
|
||||
scheduler.start_after = tick + 500
|
||||
end
|
||||
|
@ -143,6 +143,10 @@ local function notify_won_to_discord(buff)
|
||||
else
|
||||
Server.to_discord_embed_parsed(text)
|
||||
end
|
||||
|
||||
Alert.alert_all_players(100, 'Buff granted: ' .. buff.discord)
|
||||
Alert.alert_all_players(100, 'Buff granted: ' .. buff.discord)
|
||||
Alert.alert_all_players(100, 'Buff granted: ' .. buff.discord)
|
||||
end
|
||||
|
||||
local function clear_all_frames()
|
||||
@ -917,7 +921,7 @@ local function update_data()
|
||||
local objective = stateful.selected_objectives[objective_index]
|
||||
local objective_name = objective.name
|
||||
local callback = Task.get(objective.token)
|
||||
local _, _, objective_locale_right, _, objective_tooltip_right = callback()
|
||||
local _, _, objective_locale_right, _, objective_tooltip_right = callback(player)
|
||||
if name == objective_name and frame and frame.valid then
|
||||
frame.caption = objective_locale_right
|
||||
frame.tooltip = objective_tooltip_right
|
||||
|
@ -16,7 +16,6 @@ local RPG = require 'modules.rpg.table'
|
||||
local Beam = require 'modules.render_beam'
|
||||
local Discord = require 'utils.discord'
|
||||
local Difficulty = require 'modules.difficulty_vote_by_amount'
|
||||
local scenario_name = Public.scenario_name
|
||||
|
||||
local this = {
|
||||
enabled = false,
|
||||
@ -34,7 +33,9 @@ local dataset = 'scenario_settings'
|
||||
local dataset_key = 'mtn_v3'
|
||||
local dataset_key_dev = 'mtn_v3_dev'
|
||||
local dataset_key_previous = 'mtn_v3_previous'
|
||||
local dataset_key_previous_dev = 'mtn_v3_previous_dev'
|
||||
local send_ping_to_channel = Discord.channel_names.mtn_channel
|
||||
local scenario_name = Public.scenario_name
|
||||
|
||||
Global.register(
|
||||
this,
|
||||
@ -296,17 +297,6 @@ local function get_random_buff(fetch_all, only_force)
|
||||
{ name = 'solar-panel-equipment', count = 2 }
|
||||
}
|
||||
},
|
||||
{
|
||||
name = 'production',
|
||||
discord = 'Production starting supplies - start with some furnaces and coal',
|
||||
modifier = 'starting_items',
|
||||
limit = 2,
|
||||
add_per_buff = 1,
|
||||
items = {
|
||||
{ name = 'stone-furnace', count = 4 },
|
||||
{ name = 'coal', count = 100 }
|
||||
}
|
||||
},
|
||||
{
|
||||
name = 'production_1',
|
||||
discord = 'Production starting supplies - start with some steel furnaces and solid fuel',
|
||||
@ -566,7 +556,7 @@ local function on_pre_player_died(event)
|
||||
return
|
||||
end
|
||||
|
||||
if string.sub(surface.name, 0, #map_name) ~= map_name then
|
||||
if string.sub(surface.name, 0, #scenario_name) ~= scenario_name then
|
||||
return
|
||||
end
|
||||
|
||||
@ -1440,7 +1430,7 @@ function Public.save_settings_before_reset()
|
||||
if server_name_matches then
|
||||
Server.set_data(dataset, dataset_key_previous, settings)
|
||||
else
|
||||
Server.set_data(dataset, dataset_key_previous, settings)
|
||||
Server.set_data(dataset, dataset_key_previous_dev, settings)
|
||||
end
|
||||
end
|
||||
|
||||
|
@ -1,6 +1,6 @@
|
||||
local Global = require 'utils.global'
|
||||
local surface_name = 'mtn_v3'
|
||||
local Public = require 'maps.mountain_fortress_v3.table'
|
||||
local surface_name = Public.scenario_name
|
||||
local zone_settings = Public.zone_settings
|
||||
|
||||
local this = {
|
||||
@ -50,9 +50,11 @@ function Public.create_surface()
|
||||
mine['control-setting:moisture:frequency:multiplier'] = 1
|
||||
|
||||
map_gen_settings.property_expression_names = mine
|
||||
map_gen_settings.default_enable_all_autoplace_controls = false
|
||||
|
||||
if not this.active_surface_index then
|
||||
this.active_surface_index = game.create_surface(surface_name, map_gen_settings).index
|
||||
-- this.active_surface_index = game.planets['fulgora'].create_surface(surface_name, map_gen_settings).index
|
||||
else
|
||||
this.active_surface_index = Public.soft_reset_map(game.surfaces[this.active_surface_index], map_gen_settings).index
|
||||
end
|
||||
|
@ -122,6 +122,7 @@ Public.pickaxe_upgrades = {
|
||||
|
||||
function Public.reset_main_table()
|
||||
-- @start
|
||||
this.space_age = has_space_age()
|
||||
-- these 3 are in case of stop/start/reloading the instance.
|
||||
this.soft_reset = true
|
||||
this.restart = false
|
||||
@ -265,7 +266,10 @@ function Public.reset_main_table()
|
||||
land_mine_cost = 2,
|
||||
car_health_upgrade_pool_cost = 100000,
|
||||
tile_when_mining_cost = random(45000, 70000),
|
||||
redraw_mystical_chest_cost = 3000
|
||||
redraw_mystical_chest_cost = 3000,
|
||||
roboport_cost = random(750, 1500),
|
||||
construction_bot_cost = random(150, 350),
|
||||
chest_cost = random(400, 600)
|
||||
}
|
||||
this.collapse_grace = true
|
||||
this.corpse_removal_disabled = true
|
||||
|
@ -7,11 +7,12 @@ local abs = math.abs
|
||||
local floor = math.floor
|
||||
local ceil = math.ceil
|
||||
|
||||
local scenario_name = Public.scenario_name
|
||||
local zone_settings = Public.zone_settings
|
||||
local worm_level_modifier = 0.19
|
||||
local base_tile = 'grass-1'
|
||||
|
||||
local start_ground_tiles = {
|
||||
local vanilla_start_ground_tiles = {
|
||||
'grass-1',
|
||||
'grass-1',
|
||||
'grass-2',
|
||||
@ -26,6 +27,25 @@ local start_ground_tiles = {
|
||||
'grass-4'
|
||||
}
|
||||
|
||||
local start_ground_tiles = {
|
||||
'volcanic-jagged-ground',
|
||||
'volcanic-folds-warm',
|
||||
'volcanic-soil-light',
|
||||
'volcanic-smooth-stone-warm',
|
||||
'volcanic-folds-warm',
|
||||
'volcanic-jagged-ground',
|
||||
'volcanic-soil-dark',
|
||||
'volcanic-smooth-stone-warm',
|
||||
'volcanic-soil-dark',
|
||||
'volcanic-folds-warm',
|
||||
'volcanic-soil-light',
|
||||
'volcanic-smooth-stone-warm',
|
||||
}
|
||||
|
||||
if not has_space_age() then
|
||||
start_ground_tiles = vanilla_start_ground_tiles
|
||||
end
|
||||
|
||||
local nuclear_tiles = {
|
||||
'nuclear-ground',
|
||||
'nuclear-ground',
|
||||
@ -2926,7 +2946,7 @@ function Public.heavy_functions(data)
|
||||
local surface = data.surface
|
||||
local map_name = 'mtn_v3'
|
||||
|
||||
if string.sub(surface.name, 0, #map_name) ~= map_name then
|
||||
if string.sub(surface.name, 0, #scenario_name) ~= scenario_name then
|
||||
return
|
||||
end
|
||||
local adjusted_zones = Public.get('adjusted_zones')
|
||||
@ -3015,7 +3035,7 @@ Event.add(
|
||||
local surface = e.surface
|
||||
local map_name = 'mtn_v3'
|
||||
|
||||
if string.sub(surface.name, 0, #map_name) ~= map_name then
|
||||
if string.sub(surface.name, 0, #scenario_name) ~= scenario_name then
|
||||
return
|
||||
end
|
||||
|
||||
|
@ -24,35 +24,34 @@ for _, t in pairs(kaboom_weights) do
|
||||
end
|
||||
end
|
||||
|
||||
local function create_flying_text(surface, position, text)
|
||||
if not surface.valid then
|
||||
local function create_flying_text(entity, text)
|
||||
if not entity or not entity.valid then return end
|
||||
if not entity.surface.valid then
|
||||
return
|
||||
end
|
||||
surface.create_entity(
|
||||
entity.surface.create_entity(
|
||||
{
|
||||
name = 'compi-speech-bubble',
|
||||
position = position,
|
||||
position = entity.position,
|
||||
text = text,
|
||||
source = position,
|
||||
source = entity,
|
||||
lifetime = 30
|
||||
}
|
||||
)
|
||||
|
||||
surface.play_sound({ path = 'utility/armor_insert', position = position, volume_modifier = 0.75 })
|
||||
entity.surface.play_sound({ path = 'utility/armor_insert', position = entity.position, volume_modifier = 0.75 })
|
||||
end
|
||||
|
||||
local function create_kaboom(surface, position, name)
|
||||
if not surface.valid then
|
||||
return
|
||||
end
|
||||
local function create_kaboom(entity, name)
|
||||
if not entity or not entity.valid then return end
|
||||
|
||||
local target = position
|
||||
local target = entity.position
|
||||
local speed = 0.5
|
||||
if name == 'coin' then
|
||||
local rng = random(1, 512)
|
||||
local chest = 'crash-site-chest-' .. random(1, 2)
|
||||
|
||||
local container = surface.create_entity({ name = chest, position = position, force = 'neutral' })
|
||||
local container = entity.surface.create_entity({ name = chest, position = entity.position, force = 'neutral' })
|
||||
if container and container.health then
|
||||
container.insert({ name = 'coin', count = rng })
|
||||
container.health = random(1, container.health)
|
||||
@ -61,25 +60,25 @@ local function create_kaboom(surface, position, name)
|
||||
end
|
||||
|
||||
if name == 'defender-capsule' or name == 'destroyer-capsule' or name == 'distractor-capsule' then
|
||||
surface.create_entity(
|
||||
entity.surface.create_entity(
|
||||
{
|
||||
name = 'compi-speech-bubble',
|
||||
position = position,
|
||||
position = entity.position,
|
||||
text = '(((Sentries Engaging Target)))',
|
||||
source = position,
|
||||
source = entity,
|
||||
lifetime = 30
|
||||
}
|
||||
)
|
||||
local nearest_player_unit = surface.find_nearest_enemy({ position = position, max_distance = 128, force = 'enemy' })
|
||||
local nearest_player_unit = entity.surface.find_nearest_enemy({ position = entity.position, max_distance = 128, force = 'enemy' })
|
||||
if nearest_player_unit then
|
||||
target = nearest_player_unit.position
|
||||
end
|
||||
speed = 0.001
|
||||
end
|
||||
surface.create_entity(
|
||||
entity.surface.create_entity(
|
||||
{
|
||||
name = name,
|
||||
position = position,
|
||||
position = entity.position,
|
||||
force = 'enemy',
|
||||
target = target,
|
||||
speed = speed
|
||||
@ -87,22 +86,9 @@ local function create_kaboom(surface, position, name)
|
||||
)
|
||||
end
|
||||
|
||||
function Public.tick_tack_trap(surface, position)
|
||||
if not surface then
|
||||
return
|
||||
end
|
||||
if not surface.valid then
|
||||
return
|
||||
end
|
||||
if not position then
|
||||
return
|
||||
end
|
||||
if not position.x then
|
||||
return
|
||||
end
|
||||
if not position.y then
|
||||
return
|
||||
end
|
||||
function Public.tick_tack_trap(entity)
|
||||
if not entity or not entity.valid then return end
|
||||
|
||||
local traps = Public.get('traps')
|
||||
local tick_tack_count = random(5, 9)
|
||||
for t = 60, tick_tack_count * 60, 60 do
|
||||
@ -113,18 +99,18 @@ function Public.tick_tack_trap(surface, position)
|
||||
if t < tick_tack_count * 60 then
|
||||
traps[game.tick + t][#traps[game.tick + t] + 1] = {
|
||||
callback = 'create_flying_text',
|
||||
params = { surface, { x = position.x, y = position.y }, tick_tacks[random(1, #tick_tacks)] }
|
||||
params = { entity = entity, message = tick_tacks[random(1, #tick_tacks)] }
|
||||
}
|
||||
else
|
||||
if random(1, 10) == 1 then
|
||||
traps[game.tick + t][#traps[game.tick + t] + 1] = {
|
||||
callback = 'create_flying_text',
|
||||
params = { surface, { x = position.x, y = position.y }, '( ͡° ͜ʖ ͡°)' }
|
||||
params = { entity = entity, message = '( ͡° ͜ʖ ͡°)' }
|
||||
}
|
||||
else
|
||||
traps[game.tick + t][#traps[game.tick + t] + 1] = {
|
||||
callback = 'create_kaboom',
|
||||
params = { surface, { x = position.x, y = position.y }, kabooms[random(1, #kabooms)] }
|
||||
params = { entity = entity, explosion = kabooms[random(1, #kabooms)] }
|
||||
}
|
||||
end
|
||||
end
|
||||
@ -140,9 +126,9 @@ local function on_tick()
|
||||
local callback = token.callback
|
||||
local params = token.params
|
||||
if callback == 'create_kaboom' then
|
||||
create_kaboom(params[1], params[2], params[3])
|
||||
create_kaboom(params.entity, params.explosion)
|
||||
elseif callback == 'create_flying_text' then
|
||||
create_flying_text(params[1], params[2], params[3])
|
||||
create_flying_text(params.entity, params.message)
|
||||
end
|
||||
end
|
||||
traps[game.tick] = nil
|
||||
|
@ -28,7 +28,7 @@ local mining_chance_weights = {
|
||||
{ name = 'pipe-to-ground', chance = 10 },
|
||||
{ name = 'plastic-bar', chance = 5 },
|
||||
{ name = 'processing-unit', chance = 2 },
|
||||
{ name = 'used-up-uranium-fuel-cell', chance = 1 },
|
||||
{ name = 'depleted-uranium-fuel-cell', chance = 1 },
|
||||
{ name = 'uranium-fuel-cell', chance = 1 },
|
||||
{ name = 'rocket-fuel', chance = 3 },
|
||||
{ name = 'low-density-structure', chance = 1 },
|
||||
@ -77,7 +77,7 @@ local scrap_yield_amounts = {
|
||||
['pipe-to-ground'] = 1,
|
||||
['plastic-bar'] = 4,
|
||||
['processing-unit'] = 1,
|
||||
['used-up-uranium-fuel-cell'] = 1,
|
||||
['depleted-uranium-fuel-cell'] = 1,
|
||||
['uranium-fuel-cell'] = 0.3,
|
||||
['rocket-fuel'] = 0.3,
|
||||
['low-density-structure'] = 0.3,
|
||||
|
@ -235,10 +235,10 @@ local function on_pre_player_mined_item(event)
|
||||
return
|
||||
end
|
||||
if entity.force.name == 'neutral' then
|
||||
gain_xp(player, 1.5 + event.entity.prototype.max_health * 0.0035)
|
||||
gain_xp(player, 1.5 + event.entity.max_health * 0.0035)
|
||||
return
|
||||
end
|
||||
gain_xp(player, 0.1 + event.entity.prototype.max_health * 0.0005)
|
||||
gain_xp(player, 0.1 + event.entity.max_health * 0.0005)
|
||||
end
|
||||
|
||||
local function on_built_entity(event)
|
||||
|
@ -177,7 +177,7 @@ local function handle_damage_to_silo(event)
|
||||
destination.dynamic_data.rocketsilohp = remaining_health
|
||||
end
|
||||
else
|
||||
entity.health = entity.prototype.max_health
|
||||
entity.health = entity.max_health
|
||||
end
|
||||
end
|
||||
end
|
||||
@ -291,7 +291,7 @@ local function handle_damage_to_artillery(event)
|
||||
event.entity.die()
|
||||
end
|
||||
else
|
||||
event.entity.health = event.entity.prototype.max_health --nothing else should damage it
|
||||
event.entity.health = event.entity.max_health --nothing else should damage it
|
||||
end
|
||||
end
|
||||
|
||||
@ -731,13 +731,13 @@ local function handle_maze_walls_damage_resistance(event)
|
||||
elseif event.damage_type.name and event.damage_type.name == 'fire' then
|
||||
-- put out forest fires:
|
||||
for _, e2 in
|
||||
pairs(entity.surface.find_entities_filtered({
|
||||
area = {
|
||||
{ entity.position.x - 4, entity.position.y - 4 },
|
||||
{ entity.position.x + 4, entity.position.y + 4 },
|
||||
},
|
||||
name = 'fire-flame-on-tree',
|
||||
}))
|
||||
pairs(entity.surface.find_entities_filtered({
|
||||
area = {
|
||||
{ entity.position.x - 4, entity.position.y - 4 },
|
||||
{ entity.position.x + 4, entity.position.y + 4 },
|
||||
},
|
||||
name = 'fire-flame-on-tree',
|
||||
}))
|
||||
do
|
||||
if e2.valid then
|
||||
e2.destroy()
|
||||
@ -1946,7 +1946,7 @@ function Public.player_entered_vehicle(player, vehicle)
|
||||
-- if not vehicle.valid then log('vehicle invalid') return end
|
||||
|
||||
local player_relative_pos =
|
||||
{ x = player.character.position.x - vehicle.position.x, y = player.character.position.y - vehicle.position.y }
|
||||
{ x = player.character.position.x - vehicle.position.x, y = player.character.position.y - vehicle.position.y }
|
||||
|
||||
local memory = Memory.get_crew_memory()
|
||||
|
||||
@ -2131,7 +2131,7 @@ function Public.event_on_chunk_generated(event)
|
||||
})
|
||||
else
|
||||
tiles[#tiles + 1] =
|
||||
{ name = 'out-of-map', position = Utils.psum({ p, { 1, terraingen_coordinates_offset } }) }
|
||||
{ name = 'out-of-map', position = Utils.psum({ p, { 1, terraingen_coordinates_offset } }) }
|
||||
end
|
||||
end
|
||||
end
|
||||
@ -2179,7 +2179,7 @@ function Public.event_on_chunk_generated(event)
|
||||
if special.name == 'buried-treasure' then
|
||||
if destination.dynamic_data.buried_treasure and crewid ~= 0 then
|
||||
destination.dynamic_data.buried_treasure[#destination.dynamic_data.buried_treasure + 1] =
|
||||
{ treasure = Loot.buried_treasure_loot(), position = special.position }
|
||||
{ treasure = Loot.buried_treasure_loot(), position = special.position }
|
||||
end
|
||||
elseif special.name == 'chest' then
|
||||
local e = surface.create_entity({
|
||||
@ -2253,7 +2253,7 @@ function Public.event_on_chunk_generated(event)
|
||||
|
||||
if special.components then
|
||||
destination.dynamic_data.structures_waiting_to_be_placed[#destination.dynamic_data.structures_waiting_to_be_placed + 1] =
|
||||
{ data = special, tick = game.tick }
|
||||
{ data = special, tick = game.tick }
|
||||
end
|
||||
end
|
||||
|
||||
@ -2463,7 +2463,7 @@ local function event_on_market_item_purchased(event)
|
||||
Shop.event_on_market_item_purchased(event)
|
||||
end
|
||||
|
||||
local remove_boost_movement_speed_on_respawn = Token.register(function(data)
|
||||
local remove_boost_movement_speed_on_respawn = Token.register(function (data)
|
||||
local player = data.player
|
||||
local crew_id = data.crew_id
|
||||
if not (player and player.valid) then
|
||||
@ -2486,7 +2486,7 @@ local remove_boost_movement_speed_on_respawn = Token.register(function(data)
|
||||
Common.notify_player_expected(player, { 'pirates.respawn_speed_bonus_removed' })
|
||||
end)
|
||||
|
||||
local boost_movement_speed_on_respawn = Token.register(function(data)
|
||||
local boost_movement_speed_on_respawn = Token.register(function (data)
|
||||
local player = data.player
|
||||
local crew_id = data.crew_id
|
||||
if not player or not player.valid then
|
||||
|
@ -325,7 +325,7 @@ function Public.give(player, stacks, spill_position, short_form, spill_surface,
|
||||
local text2 = ''
|
||||
|
||||
local stacks2 = stacks
|
||||
table.sort(stacks2, function(a, b)
|
||||
table.sort(stacks2, function (a, b)
|
||||
return a.name < b.name
|
||||
end)
|
||||
|
||||
@ -927,7 +927,7 @@ function Public.entity_damage_healthbar(entity, damage, location_override)
|
||||
Public.update_healthbar_rendering(healthbar, new_health)
|
||||
|
||||
if entity and entity.valid then
|
||||
entity.health = entity.prototype.max_health
|
||||
entity.health = entity.max_health
|
||||
end
|
||||
|
||||
if healthbar.health > healthbar.max_health then
|
||||
@ -1217,7 +1217,7 @@ function Public.add_tiles_from_blueprint(tilesTable, bp_string, tile_name, offse
|
||||
if bp_tiles then
|
||||
for _, tile in pairs(bp_tiles) do
|
||||
tilesTable[#tilesTable + 1] =
|
||||
{ name = tile_name, position = { x = tile.position.x + offset.x, y = tile.position.y + offset.y } }
|
||||
{ name = tile_name, position = { x = tile.position.x + offset.x, y = tile.position.y + offset.y } }
|
||||
end
|
||||
end
|
||||
|
||||
@ -1448,7 +1448,7 @@ end
|
||||
function Public.tileslist_add_area_offset(tiles_list_to_add_to, area, offset, tile_type)
|
||||
for _, p in pairs(Public.orthog_positions_in_orthog_area(area)) do
|
||||
tiles_list_to_add_to[#tiles_list_to_add_to + 1] =
|
||||
{ name = tile_type, position = { x = offset.x + p.x, y = offset.y + p.y } }
|
||||
{ name = tile_type, position = { x = offset.x + p.x, y = offset.y + p.y } }
|
||||
end
|
||||
end
|
||||
|
||||
@ -1782,7 +1782,7 @@ function Public.init_game_settings(technology_price_multiplier)
|
||||
|
||||
-- (0,2) for a symmetric search:
|
||||
game.map_settings.path_finder.goal_pressure_ratio = -0.1 --small pressure for stupid paths
|
||||
game.map_settings.path_finder.fwd2bwd_ratio = 2 -- on experiments I found that this value was symmetric, despite the vanilla game comments saying it is 1...
|
||||
game.map_settings.path_finder.fwd2bwd_ratio = 2 -- on experiments I found that this value was symmetric, despite the vanilla game comments saying it is 1...
|
||||
game.map_settings.max_failed_behavior_count = 2
|
||||
game.map_settings.path_finder.max_work_done_per_tick = 20000
|
||||
game.map_settings.path_finder.short_cache_min_algo_steps_to_cache = 100
|
||||
@ -2159,7 +2159,7 @@ function Public.try_make_biter_elite(entity)
|
||||
health_multiplier = health_multiplier * 2 ^ ((Public.overworldx() - 1000) / 1000)
|
||||
end
|
||||
|
||||
local max_hp = Math.ceil(entity.prototype.max_health * health_multiplier)
|
||||
local max_hp = Math.ceil(entity.max_health * health_multiplier)
|
||||
Public.new_healthbar(false, entity, max_hp, nil, max_hp, 0.4, -1)
|
||||
|
||||
local elite_biters = memory.elite_biters
|
||||
|
@ -180,7 +180,7 @@ function Public.explanation(class, add_is_class_obtainable)
|
||||
|
||||
if add_is_class_obtainable then
|
||||
full_explanation[#full_explanation + 1] = Public.class_is_obtainable(class)
|
||||
and { '', ' ', { 'pirates.class_obtainable' } }
|
||||
and { '', ' ', { 'pirates.class_obtainable' } }
|
||||
or { '', ' ', { 'pirates.class_unobtainable' } }
|
||||
end
|
||||
|
||||
@ -480,7 +480,7 @@ local function class_on_player_used_capsule(event)
|
||||
if Math.distance(player.character.position, member.position) <= Balance.medic_heal_radius then
|
||||
if member.character then
|
||||
local amount =
|
||||
Math.ceil(member.character.prototype.max_health * Balance.medic_heal_percentage_amount)
|
||||
Math.ceil(member.character.max_health * Balance.medic_heal_percentage_amount)
|
||||
member.character.health = member.character.health + amount
|
||||
end
|
||||
end
|
||||
@ -490,7 +490,7 @@ local function class_on_player_used_capsule(event)
|
||||
if Math.distance(player.character.position, member.position) <= Balance.doctor_heal_radius then
|
||||
if member.character then
|
||||
local amount =
|
||||
Math.ceil(member.character.prototype.max_health * Balance.doctor_heal_percentage_amount)
|
||||
Math.ceil(member.character.max_health * Balance.doctor_heal_percentage_amount)
|
||||
member.character.health = member.character.health + amount
|
||||
end
|
||||
end
|
||||
@ -658,7 +658,7 @@ function Public.try_unlock_class(class_for_sale, player, force_unlock)
|
||||
|
||||
-- update GUI data
|
||||
memory.unlocked_classes[#memory.unlocked_classes + 1] =
|
||||
{ class = class_for_sale, taken_by = player.index }
|
||||
{ class = class_for_sale, taken_by = player.index }
|
||||
else
|
||||
-- update GUI data
|
||||
memory.unlocked_classes[#memory.unlocked_classes + 1] = { class = class_for_sale }
|
||||
|
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
@ -101,7 +101,7 @@ local container_loot_chance = {
|
||||
{ name = 'sulfuric-acid-barrel', chance = 15 },
|
||||
--{name = "uranium-cannon-shell", chance = 1},
|
||||
{ name = 'uranium-fuel-cell', chance = 1 },
|
||||
--{name = "used-up-uranium-fuel-cell", chance = 1},
|
||||
--{name = "depleted-uranium-fuel-cell", chance = 1},
|
||||
{ name = 'water-barrel', chance = 10 }
|
||||
}
|
||||
|
||||
@ -152,7 +152,7 @@ local container_loot_amounts = {
|
||||
['sulfuric-acid-barrel'] = 3,
|
||||
--["uranium-cannon-shell"] = 2,
|
||||
['uranium-fuel-cell'] = 0.3,
|
||||
--["used-up-uranium-fuel-cell"] = 1,
|
||||
--["depleted-uranium-fuel-cell"] = 1,
|
||||
['water-barrel'] = 3
|
||||
}
|
||||
|
||||
|
@ -570,14 +570,14 @@ local function on_player_mined_entity(event)
|
||||
return
|
||||
end
|
||||
local positions = {}
|
||||
local r = math.ceil(entity.prototype.max_health / 32)
|
||||
local r = math.ceil(entity.max_health / 32)
|
||||
for x = r * -1, r, 1 do
|
||||
for y = r * -1, r, 1 do
|
||||
positions[#positions + 1] = { x = entity.position.x + x, y = entity.position.y + y }
|
||||
end
|
||||
end
|
||||
positions = shuffle(positions)
|
||||
for i = 1, math.ceil(entity.prototype.max_health / 32), 1 do
|
||||
for i = 1, math.ceil(entity.max_health / 32), 1 do
|
||||
if not positions[i] then
|
||||
return
|
||||
end
|
||||
|
@ -23,7 +23,7 @@ local function on_entity_damaged(event)
|
||||
if not types[event.entity.type] then
|
||||
return
|
||||
end
|
||||
if event.final_damage_amount > event.entity.prototype.max_health * storage.biter_evasion_health_increase_factor then
|
||||
if event.final_damage_amount > event.entity.max_health * storage.biter_evasion_health_increase_factor then
|
||||
return
|
||||
end
|
||||
if math.random(1, random_max) > get_evade_chance() then
|
||||
|
@ -76,7 +76,7 @@ function Public.add_unit(unit, health_multiplier)
|
||||
health_multiplier = storage.biter_health_boost
|
||||
end
|
||||
storage.biter_health_boost_units[unit.unit_number] = {
|
||||
math_floor(unit.prototype.max_health * health_multiplier),
|
||||
math_floor(unit.max_health * health_multiplier),
|
||||
math_round(1 / health_multiplier, 5)
|
||||
}
|
||||
clean_table()
|
||||
@ -89,7 +89,7 @@ function Public.add_boss_unit(unit, health_multiplier, health_bar_size)
|
||||
if not health_bar_size then
|
||||
health_bar_size = 0.5
|
||||
end
|
||||
local health = math_floor(unit.prototype.max_health * health_multiplier)
|
||||
local health = math_floor(unit.max_health * health_multiplier)
|
||||
storage.biter_health_boost_units[unit.unit_number] = {
|
||||
health,
|
||||
math_round(1 / health_multiplier, 5),
|
||||
|
@ -53,7 +53,7 @@ local acid_lines = {
|
||||
for x = radius * -1, radius, 1 do
|
||||
for y = radius * -1, radius, 1 do
|
||||
if sqrt(x ^ 2 + y ^ 2) <= radius then
|
||||
targets[#targets + 1] = {x = x, y = y}
|
||||
targets[#targets + 1] = { x = x, y = y }
|
||||
end
|
||||
end
|
||||
end
|
||||
@ -73,17 +73,17 @@ local projectiles = {
|
||||
|
||||
Global.register(
|
||||
this,
|
||||
function(t)
|
||||
function (t)
|
||||
this = t
|
||||
end
|
||||
)
|
||||
|
||||
local filters = {
|
||||
{filter = 'name', name = 'unit'},
|
||||
{filter = 'name', name = 'turret'},
|
||||
{filter = 'name', name = 'ammo-turret'},
|
||||
{filter = 'name', name = 'electric-turret'},
|
||||
{filter = 'name', name = 'unit-spawner'}
|
||||
{ filter = 'name', name = 'unit' },
|
||||
{ filter = 'name', name = 'turret' },
|
||||
{ filter = 'name', name = 'ammo-turret' },
|
||||
{ filter = 'name', name = 'electric-turret' },
|
||||
{ filter = 'name', name = 'unit-spawner' }
|
||||
}
|
||||
|
||||
local entity_types = {
|
||||
@ -96,15 +96,15 @@ local entity_types = {
|
||||
|
||||
local remove_unit_token =
|
||||
Token.register(
|
||||
function(data)
|
||||
local unit_number = data.unit_number
|
||||
if not unit_number then
|
||||
return
|
||||
end
|
||||
function (data)
|
||||
local unit_number = data.unit_number
|
||||
if not unit_number then
|
||||
return
|
||||
end
|
||||
|
||||
this.biter_health_boost_units[unit_number] = nil
|
||||
end
|
||||
)
|
||||
this.biter_health_boost_units[unit_number] = nil
|
||||
end
|
||||
)
|
||||
|
||||
local function loaded_biters(event)
|
||||
local cause = event.cause
|
||||
@ -120,7 +120,7 @@ local function loaded_biters(event)
|
||||
end
|
||||
end
|
||||
if not position then
|
||||
position = {entity.position.x + (-20 + random(0, 40)), entity.position.y + (-20 + random(0, 40))}
|
||||
position = { entity.position.x + (-20 + random(0, 40)), entity.position.y + (-20 + random(0, 40)) }
|
||||
end
|
||||
|
||||
entity.surface.create_entity(
|
||||
@ -145,7 +145,7 @@ local function acid_nova(event)
|
||||
position = event.entity.position,
|
||||
force = event.entity.force.name,
|
||||
source = event.entity.position,
|
||||
target = {x = event.entity.position.x + targets[i].x, y = event.entity.position.y + targets[i].y},
|
||||
target = { x = event.entity.position.x + targets[i].x, y = event.entity.position.y + targets[i].y },
|
||||
max_range = radius,
|
||||
speed = 0.001
|
||||
}
|
||||
@ -155,9 +155,9 @@ end
|
||||
|
||||
local function create_entity_radius(surface, name, source, target)
|
||||
local distance = sqrt((source.x - target.x) ^ 2 + (source.y - target.y) ^ 2)
|
||||
local modifier = {(target.x - source.x) / distance, (target.y - source.y) / distance}
|
||||
local modifier = { (target.x - source.x) / distance, (target.y - source.y) / distance }
|
||||
|
||||
local position = {source.x, source.y}
|
||||
local position = { source.x, source.y }
|
||||
|
||||
for _ = 1, distance * 1.5, 1 do
|
||||
if random(1, 2) ~= 1 then
|
||||
@ -173,7 +173,7 @@ local function create_entity_radius(surface, name, source, target)
|
||||
}
|
||||
)
|
||||
end
|
||||
position = {position[1] + modifier[1], position[2] + modifier[2]}
|
||||
position = { position[1] + modifier[1], position[2] + modifier[2] }
|
||||
end
|
||||
end
|
||||
|
||||
@ -196,7 +196,7 @@ local function clean_table()
|
||||
for name, enabled in pairs(this.active_surfaces) do
|
||||
local surface = game.surfaces[name]
|
||||
if surface and surface.valid and enabled then
|
||||
for _, unit in pairs(surface.find_entities_filtered({type = validTypes})) do
|
||||
for _, unit in pairs(surface.find_entities_filtered({ type = validTypes })) do
|
||||
units_to_delete[unit.unit_number] = nil
|
||||
end
|
||||
end
|
||||
@ -207,7 +207,7 @@ local function clean_table()
|
||||
return
|
||||
end
|
||||
|
||||
for _, unit in pairs(surface.find_entities_filtered({type = validTypes})) do
|
||||
for _, unit in pairs(surface.find_entities_filtered({ type = validTypes })) do
|
||||
units_to_delete[unit.unit_number] = nil
|
||||
end
|
||||
|
||||
@ -229,12 +229,12 @@ local function create_boss_healthbar(entity, size)
|
||||
return rendering.draw_sprite(
|
||||
{
|
||||
sprite = 'virtual-signal/signal-white',
|
||||
tint = {0, 200, 0},
|
||||
tint = { 0, 200, 0 },
|
||||
x_scale = size * 15,
|
||||
y_scale = size,
|
||||
render_layer = 'light-effect',
|
||||
target = entity,
|
||||
target_offset = {0, -2.5},
|
||||
target_offset = { 0, -2.5 },
|
||||
surface = entity.surface
|
||||
}
|
||||
)
|
||||
@ -247,7 +247,7 @@ local function set_boss_healthbar(health, max_health, healthbar_id)
|
||||
end
|
||||
local x_scale = rendering.get_y_scale(healthbar_id) * 15
|
||||
rendering.set_x_scale(healthbar_id, x_scale * m)
|
||||
rendering.set_color(healthbar_id, {floor(255 - 255 * m), floor(200 * m), 0})
|
||||
rendering.set_color(healthbar_id, { floor(255 - 255 * m), floor(200 * m), 0 })
|
||||
end
|
||||
|
||||
local function extra_projectiles(cause, target)
|
||||
@ -306,7 +306,7 @@ local function on_entity_damaged(event)
|
||||
if stickers[i].name == 'stun-sticker' then
|
||||
stickers[i].destroy()
|
||||
if random(1, 2) == 1 then
|
||||
local slow = surface.create_entity {name = 'slowdown-sticker', position = biter.position, target = biter}
|
||||
local slow = surface.create_entity { name = 'slowdown-sticker', position = biter.position, target = biter }
|
||||
slow.time_to_live = 200
|
||||
end
|
||||
break
|
||||
@ -345,7 +345,7 @@ local function on_entity_damaged(event)
|
||||
--Set entity health relative to health pool
|
||||
local max_health = health_pool[3].max_health
|
||||
local m = health_pool[1] / max_health
|
||||
local final_health = round(biter.prototype.max_health * m)
|
||||
local final_health = round(biter.max_health * m)
|
||||
biter.health = final_health
|
||||
|
||||
--Proceed to kill entity if health is 0
|
||||
@ -385,7 +385,7 @@ local function on_entity_died(event)
|
||||
local wave_count = WD.get_wave()
|
||||
|
||||
if health_pool then
|
||||
Task.set_timeout_in_ticks(30, remove_unit_token, {unit_number = unit_number})
|
||||
Task.set_timeout_in_ticks(30, remove_unit_token, { unit_number = unit_number })
|
||||
if health_pool[3] and health_pool[3].healthbar_id then
|
||||
if this.enable_boss_loot then
|
||||
if random(1, 128) == 1 then
|
||||
@ -457,12 +457,12 @@ function Public.add_unit(unit, health_multiplier)
|
||||
if not health_multiplier then
|
||||
health_multiplier = this.biter_health_boost
|
||||
end
|
||||
local health = floor(unit.prototype.max_health * health_multiplier)
|
||||
local health = floor(unit.max_health * health_multiplier)
|
||||
local xp_modifier = round(1 / health_multiplier, 5)
|
||||
this.biter_health_boost_units[unit.unit_number] = {
|
||||
health,
|
||||
xp_modifier,
|
||||
{max_health = health}
|
||||
{ max_health = health }
|
||||
}
|
||||
|
||||
check_clear_table()
|
||||
@ -480,11 +480,11 @@ function Public.add_boss_unit(unit, health_multiplier, health_bar_size)
|
||||
health_bar_size = 0.5
|
||||
end
|
||||
local xp_modifier = round(1 / health_multiplier, 5)
|
||||
local health = floor(unit.prototype.max_health * health_multiplier)
|
||||
local health = floor(unit.max_health * health_multiplier)
|
||||
this.biter_health_boost_units[unit.unit_number] = {
|
||||
health,
|
||||
xp_modifier,
|
||||
{max_health = health, healthbar_id = create_boss_healthbar(unit, health_bar_size)}
|
||||
{ max_health = health, healthbar_id = create_boss_healthbar(unit, health_bar_size) }
|
||||
}
|
||||
|
||||
check_clear_table()
|
||||
@ -566,7 +566,7 @@ function Public.enable_randomize_stun_and_slowdown_sticker(boolean)
|
||||
end
|
||||
|
||||
Event.on_init(
|
||||
function()
|
||||
function ()
|
||||
Public.reset_table()
|
||||
end
|
||||
)
|
||||
|
@ -60,10 +60,10 @@ local function find_unit(player, entity)
|
||||
end
|
||||
|
||||
local function feed_pet(unit)
|
||||
if unit.prototype.max_health == unit.health then
|
||||
if unit.max_health == unit.health then
|
||||
return
|
||||
end
|
||||
unit.health = unit.health + 8 + math.floor(unit.prototype.max_health * 0.05)
|
||||
unit.health = unit.health + 8 + math.floor(unit.max_health * 0.05)
|
||||
feed_floaty_text(unit)
|
||||
floaty_hearts(unit, math_random(1, 2))
|
||||
return true
|
||||
@ -87,7 +87,7 @@ function Public.biter_pets_tame_unit(player, unit, forced)
|
||||
return false
|
||||
end
|
||||
if not forced then
|
||||
if math_random(1, math.floor(unit.prototype.max_health * 0.01) + 1) ~= 1 then
|
||||
if math_random(1, math.floor(unit.max_health * 0.01) + 1) ~= 1 then
|
||||
feed_floaty_text(unit)
|
||||
return true
|
||||
end
|
||||
|
@ -28,7 +28,7 @@ local function on_entity_damaged(event)
|
||||
if math.random(1, 100) >= storage.connected_players then
|
||||
return
|
||||
end
|
||||
if event.final_damage_amount > event.entity.prototype.max_health then
|
||||
if event.final_damage_amount > event.entity.max_health then
|
||||
return
|
||||
end
|
||||
event.entity.health = event.entity.health + event.final_damage_amount
|
||||
|
@ -31,7 +31,7 @@ local function reanimate(entity)
|
||||
end
|
||||
|
||||
local revived_entity = entity.clone({ position = entity.position, surface = entity.surface, force = entity.force })
|
||||
revived_entity.health = revived_entity.prototype.max_health
|
||||
revived_entity.health = revived_entity.max_health
|
||||
register_unit(revived_entity, extra_lifes - 1, unit_group)
|
||||
|
||||
if unit_group then
|
||||
|
@ -12,7 +12,7 @@ local function on_entity_damaged(event)
|
||||
if event.entity.type ~= 'unit' then
|
||||
return
|
||||
end
|
||||
if event.final_damage_amount > event.entity.prototype.max_health then
|
||||
if event.final_damage_amount > event.entity.max_health then
|
||||
return
|
||||
end
|
||||
event.entity.health = event.entity.health + event.final_damage_amount
|
||||
|
@ -313,7 +313,7 @@ local function analyze_random_nearby_entity()
|
||||
str = str .. ' health('
|
||||
str = str .. entity.health
|
||||
str = str .. '/'
|
||||
str = str .. entity.prototype.max_health
|
||||
str = str .. entity.max_health
|
||||
str = str .. ')'
|
||||
else
|
||||
local symbols = { '.', '!', '?' }
|
||||
|
@ -1746,7 +1746,7 @@ local function on_entity_damaged(event)
|
||||
if not entity.health then
|
||||
return
|
||||
end
|
||||
if entity.health > entity.prototype.max_health * 0.75 then
|
||||
if entity.health > entity.max_health * 0.75 then
|
||||
return
|
||||
end
|
||||
|
||||
|
@ -938,7 +938,7 @@ local function on_entity_damaged(event)
|
||||
if not fluid_damages[entity.fluidbox[1].name] then
|
||||
return
|
||||
end
|
||||
if entity.health > entity.prototype.max_health * 0.75 then
|
||||
if entity.health > entity.max_health * 0.75 then
|
||||
return
|
||||
end
|
||||
|
||||
|
@ -13,7 +13,7 @@ local math_round = math.round
|
||||
local fhb = {}
|
||||
Global.register(
|
||||
fhb,
|
||||
function(tbl)
|
||||
function (tbl)
|
||||
fhb = tbl
|
||||
end
|
||||
)
|
||||
@ -52,7 +52,7 @@ local function on_entity_damaged(event)
|
||||
return
|
||||
end
|
||||
if not boost[unit_number] then
|
||||
boost[unit_number] = entity.prototype.max_health
|
||||
boost[unit_number] = entity.max_health
|
||||
end
|
||||
|
||||
local new_health = boost[unit_number] - event.final_damage_amount * boost.m
|
||||
|
@ -174,7 +174,7 @@ end
|
||||
local function on_player_used_capsule(event)
|
||||
if event.item.name == 'raw-fish' then
|
||||
local player = game.players[event.player_index]
|
||||
if player.character.health < player.character.prototype.max_health + player.character_health_bonus + player.force.character_health_bonus then
|
||||
if player.character.health < player.character.max_health + player.character_health_bonus + player.force.character_health_bonus then
|
||||
return
|
||||
end
|
||||
Public.hunger_update(player, player_hunger_fish_food_value)
|
||||
|
@ -27,7 +27,7 @@ local mining_chance_weights = {
|
||||
{ name = 'pipe-to-ground', chance = 10 },
|
||||
{ name = 'plastic-bar', chance = 5 },
|
||||
{ name = 'processing-unit', chance = 2 },
|
||||
{ name = 'used-up-uranium-fuel-cell', chance = 1 },
|
||||
{ name = 'depleted-uranium-fuel-cell', chance = 1 },
|
||||
{ name = 'uranium-fuel-cell', chance = 1 },
|
||||
{ name = 'rocket-fuel', chance = 3 },
|
||||
{ name = 'low-density-structure', chance = 1 },
|
||||
@ -76,7 +76,7 @@ local scrap_yield_amounts = {
|
||||
['pipe-to-ground'] = 1,
|
||||
['plastic-bar'] = 4,
|
||||
['processing-unit'] = 1,
|
||||
['used-up-uranium-fuel-cell'] = 1,
|
||||
['depleted-uranium-fuel-cell'] = 1,
|
||||
['uranium-fuel-cell'] = 0.3,
|
||||
['rocket-fuel'] = 0.3,
|
||||
['low-density-structure'] = 0.3,
|
||||
|
@ -133,7 +133,7 @@ local item_worths = {
|
||||
['uranium-235'] = 1024,
|
||||
['uranium-238'] = 32,
|
||||
['uranium-fuel-cell'] = 128,
|
||||
['used-up-uranium-fuel-cell'] = 8,
|
||||
['depleted-uranium-fuel-cell'] = 8,
|
||||
['automation-science-pack'] = 4,
|
||||
['logistic-science-pack'] = 16,
|
||||
['military-science-pack'] = 64,
|
||||
|
@ -19,8 +19,8 @@ local function process_entity(v, key)
|
||||
end
|
||||
|
||||
if v.last_damage + 36000 < game.tick then
|
||||
v.entity.health = v.entity.health + math.floor(v.entity.prototype.max_health * 0.02)
|
||||
if v.entity.prototype.max_health == v.entity.health then
|
||||
v.entity.health = v.entity.health + math.floor(v.entity.max_health * 0.02)
|
||||
if v.entity.max_health == v.entity.health then
|
||||
storage.entities_regenerate_health[key] = nil
|
||||
end
|
||||
end
|
||||
|
@ -340,7 +340,7 @@ local function draw_gui(player, forced)
|
||||
|
||||
add_gui_description(tt, 'LIFE', w1)
|
||||
add_gui_stat(tt, math.floor(player.character.health), w2)
|
||||
add_gui_stat(tt, math.floor(player.character.prototype.max_health + player.character_health_bonus + player.force.character_health_bonus), w2)
|
||||
add_gui_stat(tt, math.floor(player.character.max_health + player.character_health_bonus + player.force.character_health_bonus), w2)
|
||||
|
||||
local shield = 0
|
||||
local shield_max = 0
|
||||
@ -446,8 +446,8 @@ local function draw_level_text(player)
|
||||
return
|
||||
end
|
||||
|
||||
if rpg_t[player.index].text then
|
||||
rendering.destroy(rpg_t[player.index].text)
|
||||
if rpg_t[player.index].text and rpg_t[player.index].text.valid then
|
||||
rpg_t[player.index].text.destroy()
|
||||
rpg_t[player.index].text = nil
|
||||
end
|
||||
|
||||
@ -465,8 +465,7 @@ local function draw_level_text(player)
|
||||
rendering.draw_text {
|
||||
text = 'lvl ' .. rpg_t[player.index].level,
|
||||
surface = player.surface,
|
||||
target = player.character,
|
||||
target_offset = { 0, -3.25 },
|
||||
target = { entity = player.character, offset = { 0, -3.25 } },
|
||||
color = {
|
||||
r = player.color.r * 0.6 + 0.25,
|
||||
g = player.color.g * 0.6 + 0.25,
|
||||
@ -967,7 +966,7 @@ local function on_pre_player_mined_item(event)
|
||||
if entity.type == 'resource' then
|
||||
xp_amount = 0.5 * distance_multiplier
|
||||
else
|
||||
xp_amount = (1.5 + event.entity.prototype.max_health * 0.0035) * distance_multiplier
|
||||
xp_amount = (1.5 + event.entity.max_health * 0.0035) * distance_multiplier
|
||||
end
|
||||
|
||||
gain_xp(player, xp_amount)
|
||||
|
@ -54,8 +54,7 @@ local function create_healthbar(player, size)
|
||||
x_scale = size * 8,
|
||||
y_scale = size - 0.2,
|
||||
render_layer = 'light-effect',
|
||||
target = player.character,
|
||||
target_offset = { 0, -2.5 },
|
||||
target = { entity = player.character, offset = { 0, -2.5 } },
|
||||
surface = player.surface
|
||||
}
|
||||
)
|
||||
@ -69,22 +68,21 @@ local function create_manabar(player, size)
|
||||
x_scale = size * 8,
|
||||
y_scale = size - 0.2,
|
||||
render_layer = 'light-effect',
|
||||
target = player.character,
|
||||
target_offset = { 0, -2.0 },
|
||||
target = { entity = player.character, offset = { 0, -2.0 } },
|
||||
surface = player.surface
|
||||
}
|
||||
)
|
||||
end
|
||||
|
||||
local function set_bar(min, max, id, mana)
|
||||
local function set_bar(min, max, render_object, mana)
|
||||
local m = min / max
|
||||
if not rendering.is_valid(id) then
|
||||
if not render_object or not render_object.valid then
|
||||
return
|
||||
end
|
||||
local x_scale = rendering.get_y_scale(id) * 8
|
||||
rendering.set_x_scale(id, x_scale * m)
|
||||
local x_scale = render_object.y_scale * 8
|
||||
render_object.x_scale = x_scale * m
|
||||
if not mana then
|
||||
rendering.set_color(id, { math.floor(255 - 255 * m), math.floor(200 * m), 0 })
|
||||
render_object.color = { math.floor(255 - 255 * m), math.floor(200 * m), 0 }
|
||||
end
|
||||
end
|
||||
|
||||
@ -159,7 +157,7 @@ local function has_health_boost(entity, damage, final_damage_amount, cause)
|
||||
--Set entity health relative to health pool
|
||||
local max_health = health_pool[3].max_health
|
||||
local m = health_pool[1] / max_health
|
||||
local final_health = round(entity.prototype.max_health * m)
|
||||
local final_health = round(entity.max_health * m)
|
||||
|
||||
health_pool[1] = round(health_pool[1] + final_damage_amount)
|
||||
health_pool[1] = round(health_pool[1] - damage)
|
||||
@ -212,7 +210,7 @@ local function set_health_boost(entity, damage, cause)
|
||||
--Set entity health relative to health pool
|
||||
local max_health = health_pool[3].max_health
|
||||
local m = health_pool[1] / max_health
|
||||
local final_health = round(entity.prototype.max_health * m)
|
||||
local final_health = round(entity.max_health * m)
|
||||
|
||||
health_pool[1] = round(health_pool[1] - damage)
|
||||
|
||||
@ -261,7 +259,7 @@ local repair_buildings =
|
||||
elseif random(1, 8) == 1 then
|
||||
rng = 0.4
|
||||
end
|
||||
local to_heal = entity.prototype.max_health * rng
|
||||
local to_heal = entity.max_health * rng
|
||||
if entity.health and to_heal then
|
||||
entity.health = entity.health + to_heal
|
||||
end
|
||||
@ -274,7 +272,7 @@ function Public.repair_aoe(player, position)
|
||||
local count = 0
|
||||
for i = 1, #entities do
|
||||
local e = entities[i]
|
||||
if e.prototype.max_health ~= e.health then
|
||||
if e.max_health ~= e.health then
|
||||
count = count + 1
|
||||
Task.set_timeout_in_ticks(10, repair_buildings, { entity = e })
|
||||
end
|
||||
@ -437,18 +435,14 @@ function Public.update_mana(player)
|
||||
if rpg_extra.enable_health_and_mana_bars then
|
||||
if rpg_t.show_bars then
|
||||
if player.character and player.character.valid then
|
||||
if not rpg_t.mana_bar then
|
||||
rpg_t.mana_bar = create_manabar(player, 0.5)
|
||||
elseif not rendering.is_valid(rpg_t.mana_bar) then
|
||||
if not rpg_t.mana_bar or not rpg_t.mana_bar.valid then
|
||||
rpg_t.mana_bar = create_manabar(player, 0.5)
|
||||
end
|
||||
set_bar(rpg_t.mana, rpg_t.mana_max, rpg_t.mana_bar, true)
|
||||
end
|
||||
else
|
||||
if rpg_t.mana_bar then
|
||||
if rendering.is_valid(rpg_t.mana_bar) then
|
||||
rendering.destroy(rpg_t.mana_bar)
|
||||
end
|
||||
if rpg_t.mana_bar and rpg_t.mana_bar.valid then
|
||||
rpg_t.mana_bar.destroy()
|
||||
end
|
||||
end
|
||||
end
|
||||
@ -541,18 +535,14 @@ function Public.update_health(player)
|
||||
|
||||
if rpg_extra.enable_health_and_mana_bars then
|
||||
if rpg_t.show_bars then
|
||||
local max_life = math.floor(player.character.prototype.max_health + player.character_health_bonus + player.force.character_health_bonus)
|
||||
if not rpg_t.health_bar then
|
||||
rpg_t.health_bar = create_healthbar(player, 0.5)
|
||||
elseif not rendering.is_valid(rpg_t.health_bar) then
|
||||
local max_life = math.floor(player.character.max_health + player.character_health_bonus + player.force.character_health_bonus)
|
||||
if not rpg_t.health_bar or not rpg_t.health_bar.valid then
|
||||
rpg_t.health_bar = create_healthbar(player, 0.5)
|
||||
end
|
||||
set_bar(player.character.health, max_life, rpg_t.health_bar)
|
||||
else
|
||||
if rpg_t.health_bar then
|
||||
if rendering.is_valid(rpg_t.health_bar) then
|
||||
rendering.destroy(rpg_t.health_bar)
|
||||
end
|
||||
if rpg_t.health_bar and rpg_t.health_bar.valid then
|
||||
rpg_t.health_bar.destroy()
|
||||
end
|
||||
end
|
||||
end
|
||||
@ -1370,8 +1360,8 @@ function Public.rpg_reset_player(player, one_time_reset)
|
||||
if not total then
|
||||
total = 0
|
||||
end
|
||||
if rpg_t.text then
|
||||
rendering.destroy(rpg_t.text)
|
||||
if rpg_t.text and rpg_t.text.valid then
|
||||
rpg_t.text.destroy()
|
||||
rpg_t.text = nil
|
||||
end
|
||||
local old_level = rpg_t.level
|
||||
|
@ -319,7 +319,7 @@ local function draw_main_frame(player, location)
|
||||
add_gui_description(left_bottom_table, ({ 'rpg_gui.life_name' }), w1, ({ 'rpg_gui.life_tooltip' }))
|
||||
local health_gui = add_gui_stat(left_bottom_table, floor(player.character.health), w2, ({ 'rpg_gui.life_increase' }))
|
||||
data.health = health_gui
|
||||
add_gui_stat(left_bottom_table, floor(player.character.prototype.max_health + player.character_health_bonus + player.force.character_health_bonus), w2, ({ 'rpg_gui.life_maximum' }))
|
||||
add_gui_stat(left_bottom_table, floor(player.character.max_health + player.character_health_bonus + player.force.character_health_bonus), w2, ({ 'rpg_gui.life_maximum' }))
|
||||
|
||||
local shield = 0
|
||||
local shield_max = 0
|
||||
@ -468,10 +468,7 @@ function Public.draw_level_text(player)
|
||||
end
|
||||
|
||||
if rpg_t.text and rpg_t.text.valid then
|
||||
local rend = rendering.get_object_by_id(rpg_t.text and rpg_t.text.id)
|
||||
if rend and rend.valid then
|
||||
rend.destroy()
|
||||
end
|
||||
rpg_t.text.destroy()
|
||||
rpg_t.text = nil
|
||||
end
|
||||
|
||||
@ -480,12 +477,13 @@ function Public.draw_level_text(player)
|
||||
return
|
||||
end
|
||||
|
||||
if player.character.surface.index ~= player.surface.index then return end
|
||||
|
||||
rpg_t.text =
|
||||
rendering.draw_text {
|
||||
text = 'lvl ' .. rpg_t.level,
|
||||
surface = player.surface,
|
||||
target = player.character,
|
||||
target_offset = { 0, -3.25 },
|
||||
target = { entity = player.character, offset = { 0, -3.25 } },
|
||||
color = {
|
||||
r = player.color.r * 0.6 + 0.25,
|
||||
g = player.color.g * 0.6 + 0.25,
|
||||
|
@ -702,7 +702,7 @@ local function on_pre_player_mined_item(event)
|
||||
if entity.type == 'resource' then
|
||||
xp_amount = 0.9 * distance_multiplier
|
||||
else
|
||||
xp_amount = (1.5 + entity.prototype.max_health * xp_modifier_when_mining) * distance_multiplier
|
||||
xp_amount = (1.5 + entity.max_health * xp_modifier_when_mining) * distance_multiplier
|
||||
end
|
||||
|
||||
if player.gui.screen[main_frame_name] then
|
||||
@ -869,8 +869,7 @@ local function tame_unit_effects(player, entity)
|
||||
rendering.draw_text {
|
||||
text = '~' .. player.name .. "'s pet~",
|
||||
surface = player.surface,
|
||||
target = entity,
|
||||
target_offset = { 0, -2.6 },
|
||||
target = { entity = entity, offset = { 0, -2.6 } },
|
||||
color = {
|
||||
r = player.color.r * 0.6 + 0.25,
|
||||
g = player.color.g * 0.6 + 0.25,
|
||||
|
@ -26,7 +26,7 @@ local repair_buildings =
|
||||
elseif random(1, 8) == 1 then
|
||||
rng = 0.4
|
||||
end
|
||||
local to_heal = entity.prototype.max_health * rng
|
||||
local to_heal = entity.max_health * rng
|
||||
if entity.health and to_heal then
|
||||
entity.health = entity.health + to_heal
|
||||
end
|
||||
@ -884,7 +884,7 @@ spells[#spells + 1] = {
|
||||
'support',
|
||||
range,
|
||||
function (entity)
|
||||
if entity.prototype.max_health ~= entity.health then
|
||||
if entity.max_health ~= entity.health then
|
||||
if self.mana_cost < rpg_t.mana then
|
||||
Task.set_timeout_in_ticks(10, repair_buildings, { entity = entity })
|
||||
Public.remove_mana(player, self.mana_cost)
|
||||
|
@ -1,3 +1,5 @@
|
||||
local Event = require 'utils.event'
|
||||
|
||||
local function on_research_finished(event)
|
||||
local research = event.research
|
||||
if string.sub(research.name, 0, 26) ~= 'physical-projectile-damage' then
|
||||
@ -10,11 +12,12 @@ local function on_research_finished(event)
|
||||
|
||||
local modifier = game.forces[research.force.name].get_ammo_damage_modifier('shotgun-shell')
|
||||
|
||||
modifier = modifier - research.effects[3].modifier
|
||||
modifier = modifier + research.effects[3].modifier * multiplier
|
||||
local proto = prototypes.technology[research.name]
|
||||
|
||||
modifier = modifier - proto.effects[3].modifier
|
||||
modifier = modifier + proto.effects[3].modifier * multiplier
|
||||
|
||||
game.forces[research.force.name].set_ammo_damage_modifier('shotgun-shell', modifier)
|
||||
end
|
||||
|
||||
local event = require 'utils.event'
|
||||
event.add(defines.events.on_research_finished, on_research_finished)
|
||||
Event.add(defines.events.on_research_finished, on_research_finished)
|
||||
|
@ -4,16 +4,16 @@ local Event = require 'utils.event'
|
||||
local math_random = math.random
|
||||
|
||||
local biter_building_inhabitants = {
|
||||
[1] = {{'small-biter', 8, 16}},
|
||||
[2] = {{'small-biter', 12, 24}},
|
||||
[3] = {{'small-biter', 8, 16}, {'medium-biter', 1, 2}},
|
||||
[4] = {{'small-biter', 4, 8}, {'medium-biter', 4, 8}},
|
||||
[5] = {{'small-biter', 3, 5}, {'medium-biter', 8, 12}},
|
||||
[6] = {{'small-biter', 3, 5}, {'medium-biter', 5, 7}, {'big-biter', 1, 2}},
|
||||
[7] = {{'medium-biter', 6, 8}, {'big-biter', 3, 5}},
|
||||
[8] = {{'medium-biter', 2, 4}, {'big-biter', 6, 8}},
|
||||
[9] = {{'medium-biter', 2, 3}, {'big-biter', 7, 9}},
|
||||
[10] = {{'big-biter', 4, 8}, {'behemoth-biter', 3, 4}}
|
||||
[1] = { { 'small-biter', 8, 16 } },
|
||||
[2] = { { 'small-biter', 12, 24 } },
|
||||
[3] = { { 'small-biter', 8, 16 }, { 'medium-biter', 1, 2 } },
|
||||
[4] = { { 'small-biter', 4, 8 }, { 'medium-biter', 4, 8 } },
|
||||
[5] = { { 'small-biter', 3, 5 }, { 'medium-biter', 8, 12 } },
|
||||
[6] = { { 'small-biter', 3, 5 }, { 'medium-biter', 5, 7 }, { 'big-biter', 1, 2 } },
|
||||
[7] = { { 'medium-biter', 6, 8 }, { 'big-biter', 3, 5 } },
|
||||
[8] = { { 'medium-biter', 2, 4 }, { 'big-biter', 6, 8 } },
|
||||
[9] = { { 'medium-biter', 2, 3 }, { 'big-biter', 7, 9 } },
|
||||
[10] = { { 'big-biter', 4, 8 }, { 'behemoth-biter', 3, 4 } }
|
||||
}
|
||||
|
||||
local function on_entity_died(event)
|
||||
@ -27,8 +27,9 @@ local function on_entity_died(event)
|
||||
if entity.force.index == 1 then
|
||||
return
|
||||
end
|
||||
local evo = entity.force.get_evolution_factor(entity.surface.index)
|
||||
|
||||
local e = math.ceil(entity.force.evolution_factor * 10)
|
||||
local e = math.ceil(evo * 10)
|
||||
if e < 1 then
|
||||
e = 1
|
||||
end
|
||||
@ -36,7 +37,7 @@ local function on_entity_died(event)
|
||||
for _ = 1, math_random(t[2], t[3]), 1 do
|
||||
local p = entity.surface.find_non_colliding_position(t[1], entity.position, 6, 1)
|
||||
if p then
|
||||
entity.surface.create_entity {name = t[1], position = p, force = entity.force.name}
|
||||
entity.surface.create_entity { name = t[1], position = p, force = entity.force.name }
|
||||
end
|
||||
end
|
||||
end
|
||||
|
@ -30,12 +30,12 @@ end
|
||||
|
||||
local function damage_entity(entity, player)
|
||||
if math.random(1, 5) == 1 then
|
||||
entity.surface.create_entity({name = 'fire-flame', position = player.position})
|
||||
entity.surface.create_entity({ name = 'fire-flame', position = player.position })
|
||||
end
|
||||
entity.health = entity.health - entity.prototype.max_health / 75
|
||||
entity.health = entity.health - entity.max_health / 75
|
||||
if entity.health <= 0 then
|
||||
if entity.name == 'character' then
|
||||
game.print(player.name .. messages[math.random(1, #messages)], {r = 200, g = 0, b = 0})
|
||||
game.print(player.name .. messages[math.random(1, #messages)], { r = 200, g = 0, b = 0 })
|
||||
end
|
||||
entity.die()
|
||||
end
|
||||
@ -74,7 +74,7 @@ local function on_player_joined_game(event)
|
||||
local player = game.players[event.player_index]
|
||||
|
||||
if player.online_time == 0 then
|
||||
player.insert({name = 'stone-brick', count = 64})
|
||||
player.insert({ name = 'stone-brick', count = 64 })
|
||||
end
|
||||
end
|
||||
|
||||
|
@ -489,7 +489,7 @@ local function on_entity_damaged(event)
|
||||
return
|
||||
end
|
||||
|
||||
local max = entity.prototype.max_health
|
||||
local max = entity.max_health
|
||||
|
||||
if state.boss_unit then
|
||||
state:spawn_children()
|
||||
@ -704,7 +704,7 @@ function Public._esp:spawn_children()
|
||||
return
|
||||
end
|
||||
|
||||
local max = entity.prototype.max_health
|
||||
local max = entity.max_health
|
||||
|
||||
if entity.health <= max / 4 and not self.spawned_children then
|
||||
self.spawned_children = true
|
||||
|
@ -348,13 +348,15 @@ local on_player_joined_game = function (player)
|
||||
Public.insert_all_items(player)
|
||||
end
|
||||
|
||||
local quality = has_space_age() and 'legendary' or 'normal'
|
||||
|
||||
function Public.insert_all_items(player)
|
||||
if this.creative_enabled and not this.players[player.index] then
|
||||
if player.character ~= nil then
|
||||
if player.get_inventory(defines.inventory.character_armor) then
|
||||
player.get_inventory(defines.inventory.character_armor).clear()
|
||||
end
|
||||
player.insert { name = 'power-armor-mk2', count = 1 }
|
||||
player.insert { name = 'power-armor-mk2', count = 1, quality = quality }
|
||||
Modifiers.update_single_modifier(player, 'character_inventory_slots_bonus', 'creative', #prototypes.item)
|
||||
Modifiers.update_single_modifier(player, 'character_mining_speed_modifier', 'creative', 150)
|
||||
Modifiers.update_single_modifier(player, 'character_health_bonus', 'creative', 2000)
|
||||
@ -367,20 +369,20 @@ function Public.insert_all_items(player)
|
||||
|
||||
local p_armor = player.get_inventory(5)[1].grid
|
||||
if p_armor and p_armor.valid then
|
||||
p_armor.put({ name = 'fusion-reactor-equipment' })
|
||||
p_armor.put({ name = 'fusion-reactor-equipment' })
|
||||
p_armor.put({ name = 'fusion-reactor-equipment' })
|
||||
p_armor.put({ name = 'exoskeleton-equipment' })
|
||||
p_armor.put({ name = 'exoskeleton-equipment' })
|
||||
p_armor.put({ name = 'exoskeleton-equipment' })
|
||||
p_armor.put({ name = 'energy-shield-mk2-equipment' })
|
||||
p_armor.put({ name = 'energy-shield-mk2-equipment' })
|
||||
p_armor.put({ name = 'energy-shield-mk2-equipment' })
|
||||
p_armor.put({ name = 'energy-shield-mk2-equipment' })
|
||||
p_armor.put({ name = 'personal-roboport-mk2-equipment' })
|
||||
p_armor.put({ name = 'night-vision-equipment' })
|
||||
p_armor.put({ name = 'battery-mk2-equipment' })
|
||||
p_armor.put({ name = 'battery-mk2-equipment' })
|
||||
p_armor.put({ name = 'fusion-reactor-equipment', quality = quality })
|
||||
p_armor.put({ name = 'fusion-reactor-equipment', quality = quality })
|
||||
p_armor.put({ name = 'fusion-reactor-equipment', quality = quality })
|
||||
p_armor.put({ name = 'exoskeleton-equipment', quality = quality })
|
||||
p_armor.put({ name = 'exoskeleton-equipment', quality = quality })
|
||||
p_armor.put({ name = 'exoskeleton-equipment', quality = quality })
|
||||
p_armor.put({ name = 'energy-shield-mk2-equipment', quality = quality })
|
||||
p_armor.put({ name = 'energy-shield-mk2-equipment', quality = quality })
|
||||
p_armor.put({ name = 'energy-shield-mk2-equipment', quality = quality })
|
||||
p_armor.put({ name = 'energy-shield-mk2-equipment', quality = quality })
|
||||
p_armor.put({ name = 'personal-roboport-mk2-equipment', quality = quality })
|
||||
p_armor.put({ name = 'night-vision-equipment', quality = quality })
|
||||
p_armor.put({ name = 'battery-mk2-equipment', quality = quality })
|
||||
p_armor.put({ name = 'battery-mk2-equipment', quality = quality })
|
||||
end
|
||||
local item = prototypes.item
|
||||
local i = 0
|
||||
@ -388,7 +390,7 @@ function Public.insert_all_items(player)
|
||||
i = i + 1
|
||||
if _k and _v.type ~= 'mining-tool' then
|
||||
player.character_inventory_slots_bonus = Modifiers.get_single_modifier(player, 'character_inventory_slots_bonus', 'creative')
|
||||
player.insert { name = _k, count = _v.stack_size }
|
||||
player.insert { name = _k, count = _v.stack_size, quality = quality }
|
||||
player.print('[CREATIVE] Inserted all base items.', Color.success)
|
||||
end
|
||||
end
|
||||
|
@ -42,32 +42,32 @@ local Public = {
|
||||
}
|
||||
|
||||
local normalized_names = {
|
||||
['map_tags_made'] = {name = 'Map-tags created', tooltip = "Tags that you've created in minimap."},
|
||||
['chat_messages'] = {name = 'Messages', tooltip = 'Messages sent in chat.'},
|
||||
['commands_used'] = {name = 'Commands', tooltip = 'Commands used in console.'},
|
||||
['machines_built'] = {name = 'Entities built', tooltip = 'Entities built by the player.'},
|
||||
['items_picked_up'] = {name = 'Items picked-up', tooltip = 'Items picked-up by the player.'},
|
||||
['tiles_built'] = {name = 'Tiles placed', tooltip = 'Tiles placed by the player.'},
|
||||
['join_count'] = {name = 'Join count', tooltip = 'How many times the player has joined the game.'},
|
||||
['deaths'] = {name = 'Deaths', tooltip = 'How many times the player has died.'},
|
||||
['entities_repaired'] = {name = 'Entities repaired', tooltip = 'How many entities the player has repaired.'},
|
||||
['items_crafted'] = {name = 'Items crafted', tooltip = 'How many items the player has crafted.'},
|
||||
['capsules_used'] = {name = 'Capsules used', tooltip = 'How many capsules the player has used.'},
|
||||
['tiles_removed'] = {name = 'Tiles removed', tooltip = 'How many tiles the player has removed.'},
|
||||
['deconstructer_planner_used'] = {name = 'Decon planner used', tooltip = 'How many times the player has used the deconstruction planner.'},
|
||||
['maps_played'] = {name = 'Maps played', tooltip = 'How many maps the player has played.'},
|
||||
['afk_time'] = {name = 'Total AFK', tooltip = 'How long the player has been AFK.'},
|
||||
['distance_moved'] = {name = 'Distance travelled', tooltip = 'How far the player has travelled.\nIncluding standing still in looped belts.'},
|
||||
['damage_dealt'] = {name = 'Damage dealt', tooltip = 'How much damage the player has dealt.'},
|
||||
['enemies_killed'] = {name = 'Enemies killed', tooltip = 'How many enemies the player has killed.'},
|
||||
['friendly_killed'] = {name = 'Friendlies killed', tooltip = 'How many friendlies the player has killed.\n This includes entities such as buildings etc.'},
|
||||
['rockets_launched'] = {name = 'Rockets launched', tooltip = 'How many rockets the player has launched.'},
|
||||
['research_complete'] = {name = 'Research completed', tooltip = 'How many researches the player has completed.'},
|
||||
['force_mined_machines'] = {name = 'Mined friendly entities', tooltip = 'How many friendly entities the player has mined.'},
|
||||
['trees'] = {name = 'Trees chopped', tooltip = 'How many trees the player has chopped.'},
|
||||
['rocks'] = {name = 'Rocks mined', tooltip = 'How many rocks the player has mined.'},
|
||||
['resources'] = {name = 'Ores mined', tooltip = 'How many ores the player has mined.'},
|
||||
['kicked'] = {name = 'Kicked', tooltip = 'How many times the player has been kicked.'}
|
||||
['map_tags_made'] = { name = 'Map-tags created', tooltip = "Tags that you've created in minimap." },
|
||||
['chat_messages'] = { name = 'Messages', tooltip = 'Messages sent in chat.' },
|
||||
['commands_used'] = { name = 'Commands', tooltip = 'Commands used in console.' },
|
||||
['machines_built'] = { name = 'Entities built', tooltip = 'Entities built by the player.' },
|
||||
['items_picked_up'] = { name = 'Items picked-up', tooltip = 'Items picked-up by the player.' },
|
||||
['tiles_built'] = { name = 'Tiles placed', tooltip = 'Tiles placed by the player.' },
|
||||
['join_count'] = { name = 'Join count', tooltip = 'How many times the player has joined the game.' },
|
||||
['deaths'] = { name = 'Deaths', tooltip = 'How many times the player has died.' },
|
||||
['entities_repaired'] = { name = 'Entities repaired', tooltip = 'How many entities the player has repaired.' },
|
||||
['items_crafted'] = { name = 'Items crafted', tooltip = 'How many items the player has crafted.' },
|
||||
['capsules_used'] = { name = 'Capsules used', tooltip = 'How many capsules the player has used.' },
|
||||
['tiles_removed'] = { name = 'Tiles removed', tooltip = 'How many tiles the player has removed.' },
|
||||
['deconstructer_planner_used'] = { name = 'Decon planner used', tooltip = 'How many times the player has used the deconstruction planner.' },
|
||||
['maps_played'] = { name = 'Maps played', tooltip = 'How many maps the player has played.' },
|
||||
['afk_time'] = { name = 'Total AFK', tooltip = 'How long the player has been AFK.' },
|
||||
['distance_moved'] = { name = 'Distance travelled', tooltip = 'How far the player has travelled.\nIncluding standing still in looped belts.' },
|
||||
['damage_dealt'] = { name = 'Damage dealt', tooltip = 'How much damage the player has dealt.' },
|
||||
['enemies_killed'] = { name = 'Enemies killed', tooltip = 'How many enemies the player has killed.' },
|
||||
['friendly_killed'] = { name = 'Friendlies killed', tooltip = 'How many friendlies the player has killed.\n This includes entities such as buildings etc.' },
|
||||
['rockets_launched'] = { name = 'Rockets launched', tooltip = 'How many rockets the player has launched.' },
|
||||
['research_complete'] = { name = 'Research completed', tooltip = 'How many researches the player has completed.' },
|
||||
['force_mined_machines'] = { name = 'Mined friendly entities', tooltip = 'How many friendly entities the player has mined.' },
|
||||
['trees'] = { name = 'Trees chopped', tooltip = 'How many trees the player has chopped.' },
|
||||
['rocks'] = { name = 'Rocks mined', tooltip = 'How many rocks the player has mined.' },
|
||||
['resources'] = { name = 'Ores mined', tooltip = 'How many ores the player has mined.' },
|
||||
['kicked'] = { name = 'Kicked', tooltip = 'How many times the player has been kicked.' }
|
||||
}
|
||||
local statistics = {}
|
||||
|
||||
@ -76,7 +76,7 @@ Global.register(
|
||||
{
|
||||
statistics = statistics
|
||||
},
|
||||
function(tbl)
|
||||
function (tbl)
|
||||
statistics = tbl.statistics
|
||||
|
||||
for _, stat in pairs(statistics) do
|
||||
@ -86,7 +86,7 @@ Global.register(
|
||||
)
|
||||
|
||||
-- Metatable for the statistics table
|
||||
Public.metatable = {__index = Public}
|
||||
Public.metatable = { __index = Public }
|
||||
|
||||
-- Add a normalization entry to the normalized_names table
|
||||
function Public.add_normalize(name, normalize)
|
||||
@ -94,7 +94,7 @@ function Public.add_normalize(name, normalize)
|
||||
error('cannot call during runtime', 2)
|
||||
end
|
||||
|
||||
local mt = setmetatable({name = normalize}, Public.metatable)
|
||||
local mt = setmetatable({ name = normalize }, Public.metatable)
|
||||
|
||||
normalized_names[name] = mt
|
||||
|
||||
@ -144,51 +144,51 @@ end
|
||||
|
||||
local try_download_data_token =
|
||||
Token.register(
|
||||
function(data)
|
||||
local player_name = data.key
|
||||
local player = game.get_player(player_name)
|
||||
if not player or not player.valid then
|
||||
return
|
||||
end
|
||||
|
||||
local stats = data.value
|
||||
if stats then
|
||||
local s = setmetatable(stats, Public.metatable)
|
||||
statistics[player.index] = s
|
||||
else
|
||||
get_data(player)
|
||||
end
|
||||
end
|
||||
)
|
||||
|
||||
local try_upload_data_token =
|
||||
Token.register(
|
||||
function(data)
|
||||
local player_name = data.key
|
||||
if not player_name then
|
||||
return
|
||||
end
|
||||
local stats = data.value
|
||||
local player = game.get_player(player_name)
|
||||
if not player or not player.valid then
|
||||
return
|
||||
end
|
||||
|
||||
if stats then
|
||||
-- we don't want to clutter the database with players less than 10 minutes played.
|
||||
if player.online_time <= settings.required_only_time_to_save_time then
|
||||
function (data)
|
||||
local player_name = data.key
|
||||
local player = game.get_player(player_name)
|
||||
if not player or not player.valid then
|
||||
return
|
||||
end
|
||||
|
||||
set_data(statistics_dataset, player_name, get_data(player))
|
||||
else
|
||||
local d = get_data(player)
|
||||
if player.online_time >= settings.required_only_time_to_save_time then
|
||||
set_data(statistics_dataset, player_name, d)
|
||||
local stats = data.value
|
||||
if stats then
|
||||
local s = setmetatable(stats, Public.metatable)
|
||||
statistics[player.index] = s
|
||||
else
|
||||
get_data(player)
|
||||
end
|
||||
end
|
||||
end
|
||||
)
|
||||
)
|
||||
|
||||
local try_upload_data_token =
|
||||
Token.register(
|
||||
function (data)
|
||||
local player_name = data.key
|
||||
if not player_name then
|
||||
return
|
||||
end
|
||||
local stats = data.value
|
||||
local player = game.get_player(player_name)
|
||||
if not player or not player.valid then
|
||||
return
|
||||
end
|
||||
|
||||
if stats then
|
||||
-- we don't want to clutter the database with players less than 10 minutes played.
|
||||
if player.online_time <= settings.required_only_time_to_save_time then
|
||||
return
|
||||
end
|
||||
|
||||
set_data(statistics_dataset, player_name, get_data(player))
|
||||
else
|
||||
local d = get_data(player)
|
||||
if player.online_time >= settings.required_only_time_to_save_time then
|
||||
set_data(statistics_dataset, player_name, d)
|
||||
end
|
||||
end
|
||||
end
|
||||
)
|
||||
|
||||
-- Increase a statistic by a delta value
|
||||
function Public:increase(name, delta)
|
||||
@ -254,16 +254,16 @@ end
|
||||
|
||||
local nth_tick_token =
|
||||
Token.register(
|
||||
function(event)
|
||||
local player_index = event.player_index
|
||||
local player = game.get_player(player_index)
|
||||
if not player or not player.valid then
|
||||
return
|
||||
end
|
||||
function (event)
|
||||
local player_index = event.player_index
|
||||
local player = game.get_player(player_index)
|
||||
if not player or not player.valid then
|
||||
return
|
||||
end
|
||||
|
||||
get_data(player):save()
|
||||
end
|
||||
)
|
||||
get_data(player):save()
|
||||
end
|
||||
)
|
||||
|
||||
--- Uploads each connected players play time to the dataset
|
||||
local function upload_data()
|
||||
@ -272,7 +272,7 @@ local function upload_data()
|
||||
for i = 1, #players do
|
||||
count = count + 10
|
||||
local player = players[i]
|
||||
set_timeout_in_ticks(count, nth_tick_token, {player_index = player.index})
|
||||
set_timeout_in_ticks(count, nth_tick_token, { player_index = player.index })
|
||||
end
|
||||
end
|
||||
|
||||
@ -294,21 +294,21 @@ end
|
||||
|
||||
Event.add(
|
||||
e.on_player_joined_game,
|
||||
function(event)
|
||||
function (event)
|
||||
get_data(event.player_index):try_get_data()
|
||||
end
|
||||
)
|
||||
|
||||
Event.add(
|
||||
e.on_player_left_game,
|
||||
function(event)
|
||||
function (event)
|
||||
get_data(event.player_index):try_upload_data()
|
||||
end
|
||||
)
|
||||
|
||||
Event.add(
|
||||
Public.events.on_player_removed,
|
||||
function(event)
|
||||
function (event)
|
||||
local player_index = event.player_index
|
||||
statistics[player_index] = nil
|
||||
end
|
||||
@ -316,7 +316,7 @@ Event.add(
|
||||
|
||||
Event.add(
|
||||
e.on_player_removed,
|
||||
function(event)
|
||||
function (event)
|
||||
local player_index = event.player_index
|
||||
statistics[player_index] = nil
|
||||
end
|
||||
@ -326,7 +326,7 @@ Event.on_nth_tick(settings.nth_tick, upload_data)
|
||||
|
||||
Server.on_data_set_changed(
|
||||
statistics_dataset,
|
||||
function(data)
|
||||
function (data)
|
||||
local player = game.get_player(data.key)
|
||||
if player and player.valid then
|
||||
local stats = data.value
|
||||
@ -367,12 +367,12 @@ end
|
||||
for stat_name, event_name in pairs(events) do
|
||||
Event.add(
|
||||
event_name,
|
||||
function(event)
|
||||
function (event)
|
||||
if not event.player_index then
|
||||
return
|
||||
end
|
||||
local player = game.get_player(event.player_index)
|
||||
if not player.valid or not player.connected then
|
||||
if not player or not player.valid or not player.connected then
|
||||
return
|
||||
end
|
||||
local data = get_data(event.player_index)
|
||||
@ -383,7 +383,7 @@ end
|
||||
|
||||
Event.add(
|
||||
e.on_research_finished,
|
||||
function(event)
|
||||
function (event)
|
||||
local research = event.research
|
||||
if event.by_script or not research or not research.valid then
|
||||
return
|
||||
@ -401,7 +401,7 @@ Event.add(
|
||||
|
||||
Event.add(
|
||||
e.on_rocket_launched,
|
||||
function(event)
|
||||
function (event)
|
||||
local silo = event.rocket_silo
|
||||
if not silo or not silo.valid then
|
||||
return
|
||||
@ -419,7 +419,7 @@ Event.add(
|
||||
|
||||
Event.add(
|
||||
e.on_entity_died,
|
||||
function(event)
|
||||
function (event)
|
||||
local character = event.cause
|
||||
if not character or not character.valid or character.type ~= 'character' then
|
||||
return
|
||||
@ -443,13 +443,13 @@ Event.add(
|
||||
|
||||
Event.add(
|
||||
e.on_entity_damaged,
|
||||
function(event)
|
||||
function (event)
|
||||
local character = event.cause
|
||||
if not character or not character.valid or character.type ~= 'character' then
|
||||
return
|
||||
end
|
||||
local player = character.player
|
||||
if not player.valid or not player.connected then
|
||||
if not player or not player.valid or not player.connected then
|
||||
return
|
||||
end
|
||||
local entity = event.entity
|
||||
@ -466,9 +466,9 @@ Event.add(
|
||||
|
||||
Event.add(
|
||||
e.on_player_changed_position,
|
||||
function(event)
|
||||
function (event)
|
||||
local player = game.get_player(event.player_index)
|
||||
if not player.valid or not player.connected or player.afk_time > settings.required_only_time_to_save_time then
|
||||
if not player or not player.valid or not player.connected or player.afk_time > settings.required_only_time_to_save_time then
|
||||
return
|
||||
end
|
||||
local data = get_data(event.player_index)
|
||||
@ -478,7 +478,7 @@ Event.add(
|
||||
|
||||
Event.on_nth_tick(
|
||||
3600,
|
||||
function()
|
||||
function ()
|
||||
if game.tick == 0 then
|
||||
return
|
||||
end
|
||||
@ -493,14 +493,14 @@ Event.on_nth_tick(
|
||||
|
||||
Event.add(
|
||||
e.on_player_created,
|
||||
function(event)
|
||||
function (event)
|
||||
get_data(event.player_index):increase('maps_played')
|
||||
end
|
||||
)
|
||||
|
||||
Event.add(
|
||||
e.on_player_kicked,
|
||||
function(event)
|
||||
function (event)
|
||||
get_data(event.player_index):increase('kicked')
|
||||
end
|
||||
)
|
||||
|
@ -8,7 +8,7 @@ local concat = table.concat
|
||||
|
||||
local Public = {}
|
||||
|
||||
local ignore = {tokens = true}
|
||||
local ignore = { tokens = true }
|
||||
|
||||
local header_name = Gui.uid_name()
|
||||
local left_panel_name = Gui.uid_name()
|
||||
@ -16,38 +16,38 @@ local right_panel_name = Gui.uid_name()
|
||||
local input_text_box_name = Gui.uid_name()
|
||||
local refresh_name = Gui.uid_name()
|
||||
|
||||
Public.name = 'global'
|
||||
Public.name = 'Storage'
|
||||
|
||||
function Public.show(container)
|
||||
local main_flow = container.add {type = 'flow', direction = 'horizontal'}
|
||||
local main_flow = container.add { type = 'flow', direction = 'horizontal' }
|
||||
|
||||
local left_panel = main_flow.add {type = 'scroll-pane', name = left_panel_name}
|
||||
local left_panel = main_flow.add { type = 'scroll-pane', name = left_panel_name }
|
||||
local left_panel_style = left_panel.style
|
||||
left_panel_style.width = 400
|
||||
|
||||
for key, _ in pairs(global) do
|
||||
for key, _ in pairs(storage) do
|
||||
if not ignore[key] then
|
||||
local header = left_panel.add({type = 'flow'}).add {type = 'label', name = header_name, caption = tostring(key)}
|
||||
local header = left_panel.add({ type = 'flow' }).add { type = 'label', name = header_name, caption = tostring(key) }
|
||||
Gui.set_data(header, key)
|
||||
end
|
||||
end
|
||||
|
||||
local right_flow = main_flow.add {type = 'flow', direction = 'vertical'}
|
||||
local right_flow = main_flow.add { type = 'flow', direction = 'vertical' }
|
||||
|
||||
local right_top_flow = right_flow.add {type = 'flow', direction = 'horizontal'}
|
||||
local right_top_flow = right_flow.add { type = 'flow', direction = 'horizontal' }
|
||||
|
||||
local input_text_box = right_top_flow.add {type = 'text-box', name = input_text_box_name}
|
||||
local input_text_box = right_top_flow.add { type = 'text-box', name = input_text_box_name }
|
||||
local input_text_box_style = input_text_box.style
|
||||
input_text_box_style.horizontally_stretchable = true
|
||||
input_text_box_style.height = 32
|
||||
input_text_box_style.maximal_width = 1000
|
||||
|
||||
local refresh_button = right_top_flow.add {type = 'sprite-button', name = refresh_name, sprite = 'utility/reset', tooltip = 'Refresh'}
|
||||
local refresh_button = right_top_flow.add { type = 'sprite-button', name = refresh_name, sprite = 'utility/reset', tooltip = 'Refresh' }
|
||||
local refresh_button_style = refresh_button.style
|
||||
refresh_button_style.width = 32
|
||||
refresh_button_style.height = 32
|
||||
|
||||
local right_panel = right_flow.add {type = 'text-box', name = right_panel_name}
|
||||
local right_panel = right_flow.add { type = 'text-box', name = right_panel_name }
|
||||
right_panel.read_only = true
|
||||
right_panel.selectable = true
|
||||
|
||||
@ -71,7 +71,7 @@ end
|
||||
|
||||
Gui.on_click(
|
||||
header_name,
|
||||
function(event)
|
||||
function (event)
|
||||
local element = event.element
|
||||
local key = Gui.get_data(element)
|
||||
|
||||
@ -92,7 +92,7 @@ Gui.on_click(
|
||||
element.style.font_color = Color.orange
|
||||
data.selected_header = element
|
||||
|
||||
input_text_box.text = concat {"global['", key, "']"}
|
||||
input_text_box.text = concat { "global['", key, "']" }
|
||||
input_text_box.style.font_color = Color.black
|
||||
|
||||
local content = dump(global[key]) or 'nil'
|
||||
@ -112,7 +112,7 @@ end
|
||||
|
||||
Gui.on_text_changed(
|
||||
input_text_box_name,
|
||||
function(event)
|
||||
function (event)
|
||||
local element = event.element
|
||||
local data = Gui.get_data(element)
|
||||
|
||||
@ -122,7 +122,7 @@ Gui.on_text_changed(
|
||||
|
||||
Gui.on_click(
|
||||
refresh_name,
|
||||
function(event)
|
||||
function (event)
|
||||
local element = event.element
|
||||
local data = Gui.get_data(element)
|
||||
if not data then
|
||||
|
@ -16,7 +16,7 @@ local input_text_box_name = Gui.uid_name()
|
||||
local filter_text_box_name = Gui.uid_name()
|
||||
local refresh_name = Gui.uid_name()
|
||||
|
||||
Public.name = 'Global'
|
||||
Public.name = 'Tokens'
|
||||
|
||||
function Public.show(container, filter)
|
||||
container.clear()
|
||||
|
@ -31,7 +31,7 @@ end
|
||||
if not health_factor then
|
||||
return
|
||||
end
|
||||
local health = math.floor(entity.prototype.max_health * health_factor)
|
||||
local health = math.floor(entity.max_health * health_factor)
|
||||
if health == 0 then
|
||||
return
|
||||
end
|
||||
|
@ -140,7 +140,7 @@ local item_worths = {
|
||||
['uranium-235'] = 1024,
|
||||
['uranium-238'] = 32,
|
||||
['uranium-fuel-cell'] = 128,
|
||||
['used-up-uranium-fuel-cell'] = 8,
|
||||
['depleted-uranium-fuel-cell'] = 8,
|
||||
['automation-science-pack'] = 4,
|
||||
['logistic-science-pack'] = 16,
|
||||
['military-science-pack'] = 64,
|
||||
@ -357,7 +357,7 @@ local tech_tier_list = {
|
||||
'steam-turbine',
|
||||
'centrifuge',
|
||||
'uranium-fuel-cell',
|
||||
'used-up-uranium-fuel-cell',
|
||||
'depleted-uranium-fuel-cell',
|
||||
'uranium-235',
|
||||
'uranium-238',
|
||||
'power-armor',
|
||||
|
@ -1,5 +1,5 @@
|
||||
local Poll = {
|
||||
send_poll_result_to_discord = function()
|
||||
send_poll_result_to_discord = function ()
|
||||
end
|
||||
}
|
||||
local Token = require 'utils.token'
|
||||
@ -72,4 +72,22 @@ function is_game_modded()
|
||||
return false
|
||||
end
|
||||
|
||||
local space_age_mods = {
|
||||
['space-age'] = true,
|
||||
['elevated-rails'] = true,
|
||||
['quality'] = true,
|
||||
|
||||
}
|
||||
|
||||
function has_space_age()
|
||||
local active_mods = script.active_mods
|
||||
for mod_name, _ in pairs(active_mods) do
|
||||
if space_age_mods[mod_name] then
|
||||
return true
|
||||
end
|
||||
end
|
||||
return false
|
||||
end
|
||||
|
||||
|
||||
return ServerCommands
|
||||
|
@ -46,7 +46,7 @@ local mining_chance_weights = {
|
||||
{ name = 'pipe-to-ground', chance = 10 },
|
||||
{ name = 'plastic-bar', chance = 5 },
|
||||
{ name = 'processing-unit', chance = 2 },
|
||||
{ name = 'used-up-uranium-fuel-cell', chance = 1 },
|
||||
{ name = 'depleted-uranium-fuel-cell', chance = 1 },
|
||||
{ name = 'uranium-fuel-cell', chance = 1 },
|
||||
{ name = 'rocket-fuel', chance = 3 },
|
||||
{ name = 'low-density-structure', chance = 1 },
|
||||
@ -95,7 +95,7 @@ local scrap_yield_amounts = {
|
||||
['pipe-to-ground'] = 1,
|
||||
['plastic-bar'] = 4,
|
||||
['processing-unit'] = 1,
|
||||
['used-up-uranium-fuel-cell'] = 1,
|
||||
['depleted-uranium-fuel-cell'] = 1,
|
||||
['uranium-fuel-cell'] = 0.3,
|
||||
['rocket-fuel'] = 0.3,
|
||||
['low-density-structure'] = 0.3,
|
||||
|
@ -80,7 +80,7 @@ local mining_chance_weights = {
|
||||
{ name = 'pipe-to-ground', chance = 10 },
|
||||
{ name = 'plastic-bar', chance = 5 },
|
||||
{ name = 'processing-unit', chance = 2 },
|
||||
{ name = 'used-up-uranium-fuel-cell', chance = 1 },
|
||||
{ name = 'depleted-uranium-fuel-cell', chance = 1 },
|
||||
{ name = 'uranium-fuel-cell', chance = 1 },
|
||||
{ name = 'rocket-fuel', chance = 3 },
|
||||
{ name = 'low-density-structure', chance = 1 },
|
||||
@ -129,7 +129,7 @@ local scrap_yield_amounts = {
|
||||
['pipe-to-ground'] = 1,
|
||||
['plastic-bar'] = 4,
|
||||
['processing-unit'] = 1,
|
||||
['used-up-uranium-fuel-cell'] = 1,
|
||||
['depleted-uranium-fuel-cell'] = 1,
|
||||
['uranium-fuel-cell'] = 0.3,
|
||||
['rocket-fuel'] = 0.3,
|
||||
['low-density-structure'] = 0.3,
|
||||
|
Loading…
x
Reference in New Issue
Block a user