1
0
mirror of https://github.com/ComfyFactory/ComfyFactorio.git synced 2026-06-20 16:32:28 +02:00

more tweaks

This commit is contained in:
Gerkiz
2020-08-14 17:16:04 +02:00
parent 9f0db44cc1
commit 376fbbd569
12 changed files with 122 additions and 59 deletions
+27 -6
View File
@@ -35,6 +35,7 @@ local this = {
enable_autoban = false, enable_autoban = false,
enable_jail = false, enable_jail = false,
enable_capsule_warning = false, enable_capsule_warning = false,
enable_damage_warning = false,
enable_capsule_cursor_warning = false, enable_capsule_cursor_warning = false,
required_playtime = 2592000, required_playtime = 2592000,
damage_entity_threshold = 20, damage_entity_threshold = 20,
@@ -416,13 +417,13 @@ local function on_entity_damaged(event)
if playtime > this.required_playtime then if playtime > this.required_playtime then
return return
end end
if this.enable_capsule_warning then if not this.damage_history[player.index] then
if not this.damage_history[player.index] then this.damage_history[player.index] = {}
this.damage_history[player.index] = {} this.damage_history[player.index].targets = ''
this.damage_history[player.index].targets = '' this.damage_history[player.index].count = 0
this.damage_history[player.index].count = 0 end
end
if this.enable_damage_warning then
if name ~= 'entity-ghost' and name ~= 'character' and not blacklisted_types[e_type] then if name ~= 'entity-ghost' and name ~= 'character' and not blacklisted_types[e_type] then
if chests[e_type] then if chests[e_type] then
local inv = entity.get_inventory(1) local inv = entity.get_inventory(1)
@@ -955,6 +956,8 @@ end
function Public.do_not_check_trusted(value) function Public.do_not_check_trusted(value)
if value then if value then
this.do_not_check_trusted = value this.do_not_check_trusted = value
else
this.do_not_check_trusted = false
end end
return this.do_not_check_trusted return this.do_not_check_trusted
@@ -965,16 +968,32 @@ end
function Public.enable_capsule_warning(value) function Public.enable_capsule_warning(value)
if value then if value then
this.enable_capsule_warning = value this.enable_capsule_warning = value
else
this.enable_capsule_warning = false
end end
return this.enable_capsule_warning return this.enable_capsule_warning
end end
--- If ANY actions should be performed when a player misbehaves.
---@param value <string>
function Public.enable_damage_warning(value)
if value then
this.enable_damage_warning = value
else
this.enable_damage_warning = false
end
return this.enable_damage_warning
end
--- If ANY actions should be performed when a player misbehaves. --- If ANY actions should be performed when a player misbehaves.
---@param value <string> ---@param value <string>
function Public.enable_capsule_cursor_warning(value) function Public.enable_capsule_cursor_warning(value)
if value then if value then
this.enable_capsule_cursor_warning = value this.enable_capsule_cursor_warning = value
else
this.enable_capsule_cursor_warning = false
end end
return this.enable_capsule_cursor_warning return this.enable_capsule_cursor_warning
@@ -985,6 +1004,8 @@ end
function Public.enable_jail(value) function Public.enable_jail(value)
if value then if value then
this.enable_jail = value this.enable_jail = value
else
this.enable_jail = false
end end
return this.enable_jail return this.enable_jail
@@ -11,6 +11,7 @@ local Token = require 'utils.token'
local raise_event = script.raise_event local raise_event = script.raise_event
local floor = math.floor local floor = math.floor
local random = math.random
local sqrt = math.sqrt local sqrt = math.sqrt
local concat = table.concat local concat = table.concat
@@ -28,6 +29,14 @@ local collapse_message =
end end
) )
local spidertron_unlocked =
Token.register(
function()
local message = 'Attention! Spidertron has been unlocked at the main market!'
Alert.alert_all_players(30, message, nil, 'achievement/tech-maniac', 0.1)
end
)
local zone_complete = local zone_complete =
Token.register( Token.register(
function(data) function(data)
@@ -84,6 +93,22 @@ local function distance(player)
WPT.set().placed_trains_in_zone.positions = {} WPT.set().placed_trains_in_zone.positions = {}
raise_event(Balance.events.breached_wall, {}) raise_event(Balance.events.breached_wall, {})
if WPT.get('breached_wall') == WPT.get('spidertron_unlocked_at_wave') then
local main_market_items = WPT.get('main_market_items')
if not main_market_items['spidertron'] then
local rng = random(70000, 120000)
main_market_items['spidertron'] = {
stack = 1,
value = 'coin',
price = rng,
tooltip = 'Chonk Spidertron',
upgrade = false,
static = true
}
Task.set_timeout_in_ticks(150, spidertron_unlocked)
end
end
local data = { local data = {
player = player, player = player,
breached_wall = breached_wall breached_wall = breached_wall
+1 -1
View File
@@ -903,7 +903,7 @@ local on_player_or_robot_built_tile = function(event)
local map_name = 'mountain_fortress_v3' local map_name = 'mountain_fortress_v3'
if string.sub(surface.name, 0, #map_name) == map_name then if string.sub(surface.name, 0, #map_name) ~= map_name then
return return
end end
+11 -4
View File
@@ -624,6 +624,8 @@ function Public.create_car_room(ic, car)
surface.create_entity({name = 'sand-rock-big', position = {0, 20}}) surface.create_entity({name = 'sand-rock-big', position = {0, 20}})
elseif entity_name == 'tank' then elseif entity_name == 'tank' then
surface.create_entity({name = 'sand-rock-big', position = {0, 40}}) surface.create_entity({name = 'sand-rock-big', position = {0, 40}})
elseif entity_name == 'spidertron' then
surface.create_entity({name = 'sand-rock-big', position = {0, 40}})
end end
local fishes = {} local fishes = {}
@@ -701,7 +703,8 @@ function Public.create_car(ic, event)
if if
name == 'tank' and ce.name == 'car' and not mined or name == 'car' and ce.name == 'car' and not mined or name == 'tank' and ce.name == 'car' and not mined or name == 'car' and ce.name == 'car' and not mined or
name == 'car' and ce.name == 'tank' and not mined or name == 'car' and ce.name == 'tank' and not mined or
name == 'tank' and ce.name == 'tank' and not mined name == 'tank' and ce.name == 'tank' and not mined or
name == 'spidertron' and ce.name == 'spidertron' and not mined
then then
return player.print('Multiple vehicles are not supported at the moment.', Color.warning) return player.print('Multiple vehicles are not supported at the moment.', Color.warning)
end end
@@ -710,7 +713,11 @@ function Public.create_car(ic, event)
return player.print('Multi-surface is not supported at the moment.', Color.warning) return player.print('Multi-surface is not supported at the moment.', Color.warning)
end end
if get_owner_car_name(ic, player) == 'car' and ce.name == 'tank' then if
get_owner_car_name(ic, player) == 'car' and ce.name == 'tank' or
get_owner_car_name(ic, player) == 'car' and ce.name == 'spidertron' or
get_owner_car_name(ic, player) == 'tank' and ce.name == 'spidertron'
then
upgrade_surface(ic, player, ce) upgrade_surface(ic, player, ce)
render_owner_text(player, ce) render_owner_text(player, ce)
player.print('Your car-surface has been upgraded!', Color.success) player.print('Your car-surface has been upgraded!', Color.success)
@@ -854,7 +861,7 @@ function Public.infinity_scrap(ic, event, recreate)
name = 'flying-text', name = 'flying-text',
position = entity.position, position = entity.position,
text = '+' .. count .. ' [img=item/' .. name .. ']', text = '+' .. count .. ' [img=item/' .. name .. ']',
color = {r = 0, g = 127, b = 33} color = {r = 188, g = 201, b = 63}
} }
) )
end end
@@ -905,7 +912,7 @@ function Public.teleport_players_around(ic)
local x_vector = (door.position.x / math.abs(door.position.x)) * 2 local x_vector = (door.position.x / math.abs(door.position.x)) * 2
local position = {car.entity.position.x + x_vector, car.entity.position.y} local position = {car.entity.position.x + x_vector, car.entity.position.y}
local surface_position = surface.find_non_colliding_position('character', position, 128, 0.5) local surface_position = surface.find_non_colliding_position('character', position, 128, 0.5)
if car.entity.type == 'car' then if car.entity.type == 'car' or car.entity.name == 'spidertron' then
player.teleport(surface_position, surface) player.teleport(surface_position, surface)
player_data.state = 2 player_data.state = 2
player.driving = true player.driving = true
+4 -4
View File
@@ -16,7 +16,7 @@ local function on_entity_died(event)
local ic = IC.get() local ic = IC.get()
if entity.type == 'car' then if entity.type == 'car' or entity.name == 'spidertron'then
Functions.kill_car(ic, entity) Functions.kill_car(ic, entity)
end end
@@ -33,7 +33,7 @@ local function on_player_mined_entity(event)
local ic = IC.get() local ic = IC.get()
if entity.type == 'car' then if entity.type == 'car' or entity.name == 'spidertron'then
Functions.save_car(ic, event) Functions.save_car(ic, event)
end end
@@ -50,7 +50,7 @@ local function on_robot_mined_entity(event)
end end
local ic = IC.get() local ic = IC.get()
if entity.type == 'car' then if entity.type == 'car' or entity.name == 'spidertron'then
Functions.kill_car(ic, entity) Functions.kill_car(ic, entity)
end end
@@ -65,7 +65,7 @@ local function on_built_entity(event)
if not ce or not ce.valid then if not ce or not ce.valid then
return return
end end
if not ce.type == 'car' then if not ce.type == 'car' or not ce.name == 'spidertron' then
return return
end end
+4 -2
View File
@@ -32,12 +32,14 @@ function Public.reset()
this.infinity_scrap_enabled = true this.infinity_scrap_enabled = true
this.entity_type = { this.entity_type = {
['car'] = true, ['car'] = true,
['tank'] = true ['tank'] = true,
['spidertron'] = true
} }
this.car_areas = { this.car_areas = {
['car'] = {left_top = {x = -20, y = 0}, right_bottom = {x = 20, y = 20}}, ['car'] = {left_top = {x = -20, y = 0}, right_bottom = {x = 20, y = 20}},
['tank'] = {left_top = {x = -30, y = 0}, right_bottom = {x = 30, y = 40}} ['tank'] = {left_top = {x = -30, y = 0}, right_bottom = {x = 30, y = 40}},
['spidertron'] = {left_top = {x = -30, y = 0}, right_bottom = {x = 30, y = 40}}
} }
end end
+1 -1
View File
@@ -653,7 +653,7 @@ function Public.locomotive_mining(icw, event)
name = 'flying-text', name = 'flying-text',
position = entity.position, position = entity.position,
text = '+' .. count .. ' [img=item/' .. name .. ']', text = '+' .. count .. ' [img=item/' .. name .. ']',
color = {r = 0, g = 127, b = 33} color = {r = 188, g = 201, b = 63}
} }
) )
end end
+2 -2
View File
@@ -146,7 +146,7 @@ function Public.add_player_to_permission_group(player, group, forced)
end end
local function property_boost(data) local function property_boost(data)
local xp_floating_text_color = {r = 0, g = 127, b = 33} local xp_floating_text_color = {r = 188, g = 201, b = 63}
local visuals_delay = 1800 local visuals_delay = 1800
local this = data.this local this = data.this
local locomotive_surface = data.locomotive_surface local locomotive_surface = data.locomotive_surface
@@ -1374,7 +1374,7 @@ local function add_random_loot_to_main_market(rarity)
tooltip = types[v.offer.item].localised_name, tooltip = types[v.offer.item].localised_name,
upgrade = false upgrade = false
} }
if ticker >= 25 then if ticker >= 27 then
return return
end end
end end
+37 -32
View File
@@ -323,6 +323,7 @@ function Public.reset_map()
AntiGrief.log_tree_harvest(true) AntiGrief.log_tree_harvest(true)
AntiGrief.whitelist_types('tree', true) AntiGrief.whitelist_types('tree', true)
AntiGrief.enable_capsule_warning(true) AntiGrief.enable_capsule_warning(true)
AntiGrief.enable_damage_warning(false)
AntiGrief.enable_capsule_cursor_warning(false) AntiGrief.enable_capsule_cursor_warning(false)
AntiGrief.enable_jail(true) AntiGrief.enable_jail(true)
AntiGrief.damage_entity_threshold(20) AntiGrief.damage_entity_threshold(20)
@@ -737,56 +738,60 @@ local boost_difficulty = function()
force_mining_speed.speed = game.forces.player.manual_mining_speed_modifier force_mining_speed.speed = game.forces.player.manual_mining_speed_modifier
game.forces.player.character_running_speed_modifier = 0.2 game.forces.player.character_running_speed_modifier = 0.2
game.forces.player.manual_crafting_speed_modifier = 0.3 game.forces.player.manual_crafting_speed_modifier = 0.3
WPT.get().coin_amount = 2 WPT.set().coin_amount = 2
WPT.get('upgrades').flame_turret.limit = 25 WPT.set('upgrades').flame_turret.limit = 25
WPT.get('upgrades').landmine.limit = 100 WPT.set('upgrades').landmine.limit = 100
WPT.get().locomotive_health = 20000 WPT.set().locomotive_health = 20000
WPT.get().locomotive_max_health = 20000 WPT.set().locomotive_max_health = 20000
WPT.get().bonus_xp_on_join = 700 WPT.set().bonus_xp_on_join = 700
WD.set().next_wave = game.tick + 3600 * 20 WD.set().next_wave = game.tick + 3600 * 20
WPT.get().difficulty_set = true WPT.set().spidertron_unlocked_at_wave = 11
WPT.set().difficulty_set = true
elseif name == 'Normal' then elseif name == 'Normal' then
rpg_extra.difficulty = 0.5 rpg_extra.difficulty = 0.5
game.forces.player.manual_mining_speed_modifier = 0.5 game.forces.player.manual_mining_speed_modifier = 0.5
force_mining_speed.speed = game.forces.player.manual_mining_speed_modifier force_mining_speed.speed = game.forces.player.manual_mining_speed_modifier
game.forces.player.character_running_speed_modifier = 0.1 game.forces.player.character_running_speed_modifier = 0.1
game.forces.player.manual_crafting_speed_modifier = 0.1 game.forces.player.manual_crafting_speed_modifier = 0.1
WPT.get().coin_amount = 1 WPT.set().coin_amount = 1
WPT.get('upgrades').flame_turret.limit = 10 WPT.set('upgrades').flame_turret.limit = 10
WPT.get('upgrades').landmine.limit = 50 WPT.set('upgrades').landmine.limit = 50
WPT.get().locomotive_health = 10000 WPT.set().locomotive_health = 10000
WPT.get().locomotive_max_health = 10000 WPT.set().locomotive_max_health = 10000
WPT.get().bonus_xp_on_join = 300 WPT.set().bonus_xp_on_join = 300
WD.set().next_wave = game.tick + 3600 * 15 WD.set().next_wave = game.tick + 3600 * 15
WPT.get().difficulty_set = true WPT.set().spidertron_unlocked_at_wave = 16
WPT.set().difficulty_set = true
elseif name == 'Hard' then elseif name == 'Hard' then
rpg_extra.difficulty = 0 rpg_extra.difficulty = 0
game.forces.player.manual_mining_speed_modifier = 0 game.forces.player.manual_mining_speed_modifier = 0
force_mining_speed.speed = game.forces.player.manual_mining_speed_modifier force_mining_speed.speed = game.forces.player.manual_mining_speed_modifier
game.forces.player.character_running_speed_modifier = 0 game.forces.player.character_running_speed_modifier = 0
game.forces.player.manual_crafting_speed_modifier = 0 game.forces.player.manual_crafting_speed_modifier = 0
WPT.get().coin_amount = 1 WPT.set().coin_amount = 1
WPT.get('upgrades').flame_turret.limit = 3 WPT.set('upgrades').flame_turret.limit = 3
WPT.get('upgrades').landmine.limit = 10 WPT.set('upgrades').landmine.limit = 10
WPT.get().locomotive_health = 5000 WPT.set().locomotive_health = 5000
WPT.get().locomotive_max_health = 5000 WPT.set().locomotive_max_health = 5000
WPT.get().bonus_xp_on_join = 50 WPT.set().bonus_xp_on_join = 50
WD.set().next_wave = game.tick + 3600 * 10 WD.set().next_wave = game.tick + 3600 * 10
WPT.get().difficulty_set = true WPT.set().spidertron_unlocked_at_wave = 21
WPT.set().difficulty_set = true
elseif name == 'Insane' then elseif name == 'Insane' then
rpg_extra.difficulty = 0 rpg_extra.difficulty = 0
game.forces.player.manual_mining_speed_modifier = 0 game.forces.player.manual_mining_speed_modifier = 0
force_mining_speed.speed = game.forces.player.manual_mining_speed_modifier force_mining_speed.speed = game.forces.player.manual_mining_speed_modifier
game.forces.player.character_running_speed_modifier = 0 game.forces.player.character_running_speed_modifier = 0
game.forces.player.manual_crafting_speed_modifier = 0 game.forces.player.manual_crafting_speed_modifier = 0
WPT.get().coin_amount = 1 WPT.set().coin_amount = 1
WPT.get('upgrades').flame_turret.limit = 0 WPT.set('upgrades').flame_turret.limit = 0
WPT.get('upgrades').landmine.limit = 0 WPT.set('upgrades').landmine.limit = 0
WPT.get().locomotive_health = 1000 WPT.set().locomotive_health = 1000
WPT.get().locomotive_max_health = 1000 WPT.set().locomotive_max_health = 1000
WPT.get().bonus_xp_on_join = 0 WPT.set().bonus_xp_on_join = 0
WD.set().next_wave = game.tick + 3600 * 5 WD.set().next_wave = game.tick + 3600 * 5
WPT.get().difficulty_set = true WPT.set().spidertron_unlocked_at_wave = 26
WPT.set().difficulty_set = true
end end
end end
@@ -907,10 +912,10 @@ local on_init = function()
} }
local tooltip = { local tooltip = {
[1] = 'Wave Defense is based on amount of players.\nXP Extra reward points = 1.\nMining speed boosted = 1.5.\nRunning speed boosted = 0.2.\nCrafting speed boosted = 0.4.\nCoin amount per harvest = 2.\nFlame Turret limit = 25.\nLandmine limit = 100.\nLocomotive health = 20000.\nHidden Treasure has higher chance to spawn.\nGrace period: 20 minutes', [1] = 'Wave Defense is based on amount of players.\nXP Extra reward points = 1.\nMining speed boosted = 1.5.\nRunning speed boosted = 0.2.\nCrafting speed boosted = 0.4.\nCoin amount per harvest = 2.\nFlame Turret limit = 25.\nLandmine limit = 100.\nLocomotive health = 20000.\nHidden Treasure has higher chance to spawn.\nGrace period: 20 minutes\nSpidertrons unlocks at zone 10.',
[2] = 'Wave Defense is based on amount of players.\nXP Extra reward points = 0.5.\nMining speed boosted = 1.\nRunning speed boosted = 0.1.\nCrafting speed boosted = 0.2.\nCoin amount per harvest = 1.\nFlame Turret limit = 10.\nLandmine limit = 50.\nLocomotive health = 10000.\nHidden Treasure has normal chance to spawn.\nGrace period: 15 minutes', [2] = 'Wave Defense is based on amount of players.\nXP Extra reward points = 0.5.\nMining speed boosted = 1.\nRunning speed boosted = 0.1.\nCrafting speed boosted = 0.2.\nCoin amount per harvest = 1.\nFlame Turret limit = 10.\nLandmine limit = 50.\nLocomotive health = 10000.\nHidden Treasure has normal chance to spawn.\nGrace period: 15 minutes\nSpidertrons unlocks at zone 15.',
[3] = 'Wave Defense is based on amount of players.\nXP Extra reward points = 0.\nMining speed boosted = 0.\nRunning speed boosted = 0.\nCrafting speed boosted = 0.\nCoin amount per harvest = 1.\nFlame Turret limit = 3.\nLandmine limit = 10.\nLocomotive health = 5000.\nHidden Treasure has lower chance to spawn.\nGrace period: 10 minutes', [3] = 'Wave Defense is based on amount of players.\nXP Extra reward points = 0.\nMining speed boosted = 0.\nRunning speed boosted = 0.\nCrafting speed boosted = 0.\nCoin amount per harvest = 1.\nFlame Turret limit = 3.\nLandmine limit = 10.\nLocomotive health = 5000.\nHidden Treasure has lower chance to spawn.\nGrace period: 10 minutes\nSpidertrons unlocks at zone 20.',
[4] = 'Wave Defense is based on amount of players.\nXP Extra reward points = 0.\nMining speed boosted = 0.\nRunning speed boosted = 0.\nCrafting speed boosted = 0.\nCoin amount per harvest = 1.\nFlame Turret limit = 0.\nLandmine limit = 0.\nLocomotive health = 1000.\nHidden Treasure has lower chance to spawn.\nGrace period: 5 minutes\nBiters are way more aggressive.\nCollapse starts after difficulty poll has ended.\nCollapse is much faster.' [4] = 'Wave Defense is based on amount of players.\nXP Extra reward points = 0.\nMining speed boosted = 0.\nRunning speed boosted = 0.\nCrafting speed boosted = 0.\nCoin amount per harvest = 1.\nFlame Turret limit = 0.\nLandmine limit = 0.\nLocomotive health = 1000.\nHidden Treasure has lower chance to spawn.\nGrace period: 5 minutes\nBiters are way more aggressive.\nCollapse starts after difficulty poll has ended.\nCollapse is much faster.\nSpidertrons unlocks at zone 25.'
} }
Difficulty.set_difficulties(difficulties) Difficulty.set_difficulties(difficulties)
+6 -6
View File
@@ -70,11 +70,11 @@ end
local function mining_chances_ores() local function mining_chances_ores()
local data = { local data = {
{name = 'iron-ore', chance = 545}, {name = 'iron-ore', chance = 25},
{name = 'copper-ore', chance = 540}, {name = 'copper-ore', chance = 17},
{name = 'coal', chance = 545}, {name = 'coal', chance = 15},
{name = 'stone', chance = 545}, {name = 'stone', chance = 13},
{name = 'uranium-ore', chance = 45} {name = 'uranium-ore', chance = 2}
} }
return data return data
end end
@@ -178,7 +178,7 @@ local function randomness(data)
name = 'flying-text', name = 'flying-text',
position = position, position = position,
text = '+' .. harvest_amount .. ' [img=item/' .. harvest .. ']', text = '+' .. harvest_amount .. ' [img=item/' .. harvest .. ']',
color = {r = 0, g = 127, b = 33} color = {r = 188, g = 201, b = 63}
} }
) )
+1
View File
@@ -100,6 +100,7 @@ function Public.reset_table()
this.collapse_grace = true this.collapse_grace = true
this.locomotive_biter = nil this.locomotive_biter = nil
this.disconnect_wagon = false this.disconnect_wagon = false
this.spidertron_unlocked_at_wave = 11
end end
function Public.get(key) function Public.get(key)
+3 -1
View File
@@ -314,11 +314,13 @@ local function regen_mana_player(players)
if player and player.valid and not player.in_combat then if player and player.valid and not player.in_combat then
if player.character and player.character.valid then if player.character and player.character.valid then
if rpg_t[player.index].mana < 0 then
rpg_t[player.index].mana = 0
end
if rpg_t[player.index].mana >= rpg_t[player.index].mana_max then if rpg_t[player.index].mana >= rpg_t[player.index].mana_max then
goto continue goto continue
end end
rpg_t[player.index].mana = rpg_t[player.index].mana + mana_per_tick rpg_t[player.index].mana = rpg_t[player.index].mana + mana_per_tick
if rpg_t[player.index].mana >= rpg_t[player.index].mana_max then if rpg_t[player.index].mana >= rpg_t[player.index].mana_max then
rpg_t[player.index].mana = rpg_t[player.index].mana_max rpg_t[player.index].mana = rpg_t[player.index].mana_max
end end