mirror of
https://github.com/ComfyFactory/ComfyFactorio.git
synced 2025-03-17 20:58:13 +02:00
scrapyard changes
This commit is contained in:
parent
2c8a3df495
commit
a7a0523462
@ -131,9 +131,9 @@ function Public.get_position()
|
||||
end
|
||||
|
||||
function Public.start_now(status)
|
||||
if status == "start" then
|
||||
if status == true then
|
||||
collapse.start_now = true
|
||||
elseif status == "stop" then
|
||||
elseif status == false then
|
||||
collapse.start_now = false
|
||||
end
|
||||
return collapse.start_now
|
||||
|
@ -307,6 +307,7 @@ local function go_to_some_location()
|
||||
|
||||
if this.comfylatron_greet_player_index then
|
||||
local player = game.players[this.comfylatron_greet_player_index]
|
||||
if player.surface ~= this.comfylatron.surface then return end
|
||||
if not player.character then
|
||||
this.comfylatron_greet_player_index = nil
|
||||
return false
|
||||
@ -359,11 +360,14 @@ end
|
||||
local function spawn_comfylatron(surface)
|
||||
local this = Scrap_table.get_table()
|
||||
if surface == nil then return end
|
||||
if not this.locomotive then return end
|
||||
if not this.locomotive.valid then return end
|
||||
if not this.comfylatron_last_player_visit then this.comfylatron_last_player_visit = 0 end
|
||||
if not this.comfylatron_habitat then
|
||||
local pos = this.locomotive.position
|
||||
this.comfylatron_habitat = {
|
||||
left_top = {x = -512, y = -512},
|
||||
right_bottom = {x = 512, y = 512}
|
||||
left_top = {x = pos.x-256, y = pos.y-256},
|
||||
right_bottom = {x = pos.x+256, y = pos.y+256}
|
||||
}
|
||||
end
|
||||
local players = {}
|
||||
|
@ -75,12 +75,12 @@ local function input_filtered(wagon_inventory, chest, chest_inventory, free_slot
|
||||
local stack = wagon_inventory[i]
|
||||
if stack.valid_for_read then
|
||||
local request_stack = request_stacks[stack.name]
|
||||
if request_stack and request_stack > chest_inventory.get_item_count(stack.name) then
|
||||
if request_stack and request_stack > chest_inventory.get_item_count(stack.name) then
|
||||
chest_inventory.insert(stack)
|
||||
stack.clear()
|
||||
free_slots = free_slots - 1
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
|
@ -3,6 +3,7 @@ local Power = require "maps.scrapyard.power"
|
||||
local ICW = require "maps.scrapyard.icw.main"
|
||||
local WD = require "modules.wave_defense.table"
|
||||
local Scrap_table = require "maps.scrapyard.table"
|
||||
local RPG = require 'maps.scrapyard.rpg'
|
||||
|
||||
local Public = {}
|
||||
|
||||
@ -14,72 +15,6 @@ local desc = {
|
||||
|
||||
local energy_upgrade = 50000000
|
||||
|
||||
function Public.render_train_hp()
|
||||
local this = Scrap_table.get_table()
|
||||
local surface = game.surfaces[this.active_surface_index]
|
||||
this.health_text = rendering.draw_text{
|
||||
text = "HP: " .. this.locomotive_health .. " / " .. this.locomotive_max_health,
|
||||
surface = surface,
|
||||
target = this.locomotive,
|
||||
target_offset = {0, -2.5},
|
||||
color = this.locomotive.color,
|
||||
scale = 1.40,
|
||||
font = "default-game",
|
||||
alignment = "center",
|
||||
scale_with_zoom = false
|
||||
}
|
||||
this.caption = rendering.draw_text{
|
||||
text = "Grandmasters Train",
|
||||
surface = surface,
|
||||
target = this.locomotive,
|
||||
target_offset = {0, -4.25},
|
||||
color = this.locomotive.color,
|
||||
scale = 1.80,
|
||||
font = "default-game",
|
||||
alignment = "center",
|
||||
scale_with_zoom = false
|
||||
}
|
||||
end
|
||||
|
||||
function Public.locomotive_spawn(surface, position)
|
||||
local this = Scrap_table.get_table()
|
||||
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.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.get_inventory(defines.inventory.cargo_wagon).insert({name = "raw-fish", count = 8})
|
||||
|
||||
rendering.draw_light({
|
||||
sprite = "utility/light_medium", scale = 5.5, intensity = 1, minimum_darkness = 0,
|
||||
oriented = true, color = {255,255,255}, target = this.locomotive,
|
||||
surface = surface, visible = true, only_in_alt_mode = false,
|
||||
})
|
||||
|
||||
this.locomotive.color = {0, 255, 0}
|
||||
this.locomotive.minable = false
|
||||
this.locomotive_cargo.minable = false
|
||||
this.locomotive_cargo.operable = true
|
||||
|
||||
ICW.register_wagon(this.locomotive)
|
||||
ICW.register_wagon(this.locomotive_cargo)
|
||||
end
|
||||
|
||||
function Public.inside(pos, area)
|
||||
local lt = area.left_top
|
||||
local rb = area.right_bottom
|
||||
|
||||
return pos.x >= lt.x and pos.y >= lt.y and pos.x <= rb.x and pos.y <= rb.y
|
||||
end
|
||||
function Public.contains_positions(pos, area)
|
||||
if Public.inside(pos, area) then
|
||||
return true
|
||||
end
|
||||
return false
|
||||
end
|
||||
|
||||
local function rebuild_energy_overworld(data)
|
||||
local this = data.this
|
||||
local surface = data.surface
|
||||
@ -309,7 +244,110 @@ local function on_gui_opened(event)
|
||||
if event.entity.name == "market" then refresh_market(data) return end
|
||||
end
|
||||
|
||||
local function property_boost(data)
|
||||
local surface = data.surface
|
||||
local rng = math.random
|
||||
local xp_floating_text_color = {r = rng(0,128), g = 128, b = 0}
|
||||
local visuals_delay = 1800
|
||||
local this = data.this
|
||||
local rpg = data.rpg
|
||||
local loco = this.locomotive.position
|
||||
local area = {
|
||||
left_top = {x = loco.x - 40, y = loco.y - 40},
|
||||
right_bottom = {x = loco.x + 40, y = loco.y + 40}
|
||||
}
|
||||
for _, player in pairs(game.connected_players) do
|
||||
if player.surface ~= surface then return end
|
||||
if Public.contains_positions(player.position, area) then
|
||||
local pos = player.position
|
||||
RPG.gain_xp(player, 0.2)
|
||||
player.create_local_flying_text{text="+" .. "", position={x=pos.x, y=pos.y-2}, color=xp_floating_text_color, time_to_live=120, speed=2}
|
||||
rpg[player.index].xp_since_last_floaty_text = 0
|
||||
rpg[player.index].last_floaty_text = game.tick + visuals_delay
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
function Public.boost_players_around_train()
|
||||
local rpg = RPG.get_table()
|
||||
local this = Scrap_table.get_table()
|
||||
local surface = game.surfaces[this.active_surface_index]
|
||||
if not this.locomotive then return end
|
||||
if not this.locomotive.valid then return end
|
||||
|
||||
local data = {
|
||||
this = this,
|
||||
surface = surface,
|
||||
rpg = rpg
|
||||
}
|
||||
property_boost(data)
|
||||
end
|
||||
|
||||
function Public.render_train_hp()
|
||||
local this = Scrap_table.get_table()
|
||||
local surface = game.surfaces[this.active_surface_index]
|
||||
this.health_text = rendering.draw_text{
|
||||
text = "HP: " .. this.locomotive_health .. " / " .. this.locomotive_max_health,
|
||||
surface = surface,
|
||||
target = this.locomotive,
|
||||
target_offset = {0, -2.5},
|
||||
color = this.locomotive.color,
|
||||
scale = 1.40,
|
||||
font = "default-game",
|
||||
alignment = "center",
|
||||
scale_with_zoom = false
|
||||
}
|
||||
this.caption = rendering.draw_text{
|
||||
text = "Grandmasters Train",
|
||||
surface = surface,
|
||||
target = this.locomotive,
|
||||
target_offset = {0, -4.25},
|
||||
color = this.locomotive.color,
|
||||
scale = 1.80,
|
||||
font = "default-game",
|
||||
alignment = "center",
|
||||
scale_with_zoom = false
|
||||
}
|
||||
end
|
||||
|
||||
function Public.locomotive_spawn(surface, position)
|
||||
local this = Scrap_table.get_table()
|
||||
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.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.get_inventory(defines.inventory.cargo_wagon).insert({name = "raw-fish", count = 8})
|
||||
|
||||
rendering.draw_light({
|
||||
sprite = "utility/light_medium", scale = 5.5, intensity = 1, minimum_darkness = 0,
|
||||
oriented = true, color = {255,255,255}, target = this.locomotive,
|
||||
surface = surface, visible = true, only_in_alt_mode = false,
|
||||
})
|
||||
|
||||
this.locomotive.color = {0, 255, 0}
|
||||
this.locomotive.minable = false
|
||||
this.locomotive_cargo.minable = false
|
||||
this.locomotive_cargo.operable = true
|
||||
|
||||
ICW.register_wagon(this.locomotive)
|
||||
ICW.register_wagon(this.locomotive_cargo)
|
||||
end
|
||||
|
||||
function Public.inside(pos, area)
|
||||
local lt = area.left_top
|
||||
local rb = area.right_bottom
|
||||
|
||||
return pos.x >= lt.x and pos.y >= lt.y and pos.x <= rb.x and pos.y <= rb.y
|
||||
end
|
||||
function Public.contains_positions(pos, area)
|
||||
if Public.inside(pos, area) then
|
||||
return true
|
||||
end
|
||||
return false
|
||||
end
|
||||
|
||||
function Public.place_market()
|
||||
local this = Scrap_table.get_table()
|
||||
@ -401,6 +439,9 @@ local function tick()
|
||||
Public.power_source_overworld()
|
||||
Public.power_source_locomotive()
|
||||
Public.place_market()
|
||||
if game.tick % 90 == 0 then
|
||||
Public.boost_players_around_train()
|
||||
end
|
||||
if game.tick % 30 == 0 then
|
||||
if game.tick % 1800 == 0 then
|
||||
set_player_spawn_and_refill_fish()
|
||||
|
@ -709,7 +709,22 @@ local on_init = function()
|
||||
"We've also noticed that solar eclipse occuring, \n",
|
||||
"we have yet to solve this mystery\n",
|
||||
"\n",
|
||||
"Good luck, over and out!"
|
||||
"Good luck, over and out!",
|
||||
"\n",
|
||||
"\n",
|
||||
"\n",
|
||||
"Fixes:\n",
|
||||
"Collapse activates after reaching first breach wall\n",
|
||||
"Crafting grants more xp\n",
|
||||
"Magic is tweaked\n",
|
||||
"Loot chests are affected by magic\n",
|
||||
"Scrap turrets are boosted in dmg\n",
|
||||
"Disable out-of-map tile placing\n",
|
||||
"RPG levels are now visible in the player list\n",
|
||||
"Moved comfylatron to overworld, 'lil bugger was causing issues\n",
|
||||
"RPG now has a global XP pool\n",
|
||||
"Locomotive has now market upgrades\n",
|
||||
"XP is granted after each breached wall\n"
|
||||
})
|
||||
T.main_caption_color = {r = 150, g = 150, b = 0}
|
||||
T.sub_caption_color = {r = 0, g = 150, b = 0}
|
||||
@ -732,9 +747,10 @@ end
|
||||
|
||||
local function darkness(data)
|
||||
local rnd = math.random
|
||||
local this = data.this
|
||||
local surface = data.surface
|
||||
if rnd(1, 64) == 1 then
|
||||
if surface.freeze_daytime then return end
|
||||
if this.freeze_daytime then return end
|
||||
game.print("[color=blue]Grandmaster:[/color] Darkness has surrounded us!", {r = 1, g = 0.5, b = 0.1})
|
||||
game.print("[color=blue]Grandmaster:[/color] Builds some lamps!", {r = 1, g = 0.5, b = 0.1})
|
||||
surface.min_brightness = 0
|
||||
@ -742,15 +758,17 @@ local function darkness(data)
|
||||
surface.daytime = 0.42
|
||||
surface.freeze_daytime = true
|
||||
surface.solar_power_multiplier = 0
|
||||
this.freeze_daytime = true
|
||||
return
|
||||
elseif rnd(1, 32) == 1 then
|
||||
if not surface.freeze_daytime then return end
|
||||
if not this.freeze_daytime then return end
|
||||
game.print("[color=blue]Grandmaster:[/color] Sunlight, finally!", {r = 1, g = 0.5, b = 0.1})
|
||||
surface.min_brightness = 1
|
||||
surface.brightness_visual_weights = {1, 0, 0, 0}
|
||||
surface.daytime = 0.7
|
||||
surface.freeze_daytime = false
|
||||
surface.solar_power_multiplier = 1
|
||||
this.freeze_daytime = false
|
||||
return
|
||||
end
|
||||
end
|
||||
@ -785,7 +803,7 @@ end
|
||||
|
||||
local tick_minute_functions = {
|
||||
[300 * 2 + 30 * 2] = scrap_randomness,
|
||||
[300 * 3 + 30 * 0] = darkness,
|
||||
[300 * 3 + 30 * 3] = darkness,
|
||||
[300 * 3 + 30 * 1] = transfer_pollution,
|
||||
}
|
||||
|
||||
@ -794,6 +812,7 @@ local on_tick = function()
|
||||
local surface = game.surfaces[this.active_surface_index]
|
||||
local wave_defense_table = WD.get_table()
|
||||
local tick = game.tick
|
||||
local status = Collapse.start_now()
|
||||
local key = tick % 3600
|
||||
local data = {
|
||||
this = this,
|
||||
@ -802,7 +821,7 @@ local on_tick = function()
|
||||
if not this.locomotive.valid then
|
||||
Public.loco_died()
|
||||
end
|
||||
if Collapse.start_now() == true then goto continue end
|
||||
if status == true then goto continue end
|
||||
if this.left_top.y % Terrain.level_depth == 0 and this.left_top.y < 0 and this.left_top.y > Terrain.level_depth * -10 then
|
||||
if not Collapse.start_now() then
|
||||
Collapse.start_now(true)
|
||||
|
@ -247,10 +247,12 @@ local function scrap_randomness(data)
|
||||
player.surface.spill_item_stack(position,{name = scrap, count = scrap_amount}, true)
|
||||
end
|
||||
|
||||
if scrap_amount <= 0 then scrap_amount = math_random(1,10) end
|
||||
|
||||
player.surface.create_entity({
|
||||
name = "flying-text",
|
||||
position = position,
|
||||
text = "+" .. scrap_amount .. " [img=item/" .. scrap .. "]",
|
||||
text = "+" .. scrap_amount .. " [img=item/" .. scrap .. "]",
|
||||
color = {r = 200, g = 160, b = 30}
|
||||
})
|
||||
|
||||
|
@ -22,6 +22,7 @@ local P = require "player_modifiers"
|
||||
local math_floor = math.floor
|
||||
local math_random = math.random
|
||||
local math_sqrt = math.sqrt
|
||||
local math_round = math.round
|
||||
local nth_tick = 18001
|
||||
local visuals_delay = 1800
|
||||
local level_up_floating_text_color = {0, 205, 0}
|
||||
@ -326,17 +327,17 @@ local function draw_gui(player, forced)
|
||||
|
||||
add_gui_description(tt, " ", w0)
|
||||
add_gui_description(tt, "MINING\nSPEED", w1)
|
||||
local value = (player.force.manual_mining_speed_modifier + player.character_mining_speed_modifier + 1) * 100 .. "%"
|
||||
local value = math_round((player.force.manual_mining_speed_modifier + player.character_mining_speed_modifier + 1) * 100) .. "%"
|
||||
add_gui_stat(tt, value, w2)
|
||||
|
||||
add_gui_description(tt, " ", w0)
|
||||
add_gui_description(tt, "SLOT\nBONUS", w1)
|
||||
local value = "+ " .. player.force.character_inventory_slots_bonus + player.character_inventory_slots_bonus
|
||||
local value = "+ " .. math_round(player.force.character_inventory_slots_bonus + player.character_inventory_slots_bonus)
|
||||
add_gui_stat(tt, value, w2)
|
||||
|
||||
add_gui_description(tt, " ", w0)
|
||||
add_gui_description(tt, "MELEE\nDAMAGE", w1)
|
||||
local value = 100 * (1 + get_melee_modifier(player)) .. "%"
|
||||
local value = math_round(100 * (1 + get_melee_modifier(player))) .. "%"
|
||||
local e = add_gui_stat(tt, value, w2)
|
||||
e.tooltip = "Life on-hit: " .. get_life_on_hit(player) .. "\nOne punch chance: " .. get_one_punch_chance(player) .. "%"
|
||||
|
||||
@ -370,12 +371,12 @@ local function draw_gui(player, forced)
|
||||
|
||||
add_gui_description(tt, " ", w0)
|
||||
add_gui_description(tt, "CRAFTING\nSPEED", w1)
|
||||
local value = (player.force.manual_crafting_speed_modifier + player.character_crafting_speed_modifier + 1) * 100 .. "%"
|
||||
local value = math_round((player.force.manual_crafting_speed_modifier + player.character_crafting_speed_modifier + 1) * 100) .. "%"
|
||||
add_gui_stat(tt, value, w2)
|
||||
|
||||
add_gui_description(tt, " ", w0)
|
||||
add_gui_description(tt, "RUNNING\nSPEED", w1)
|
||||
local value = (player.force.character_running_speed_modifier + player.character_running_speed_modifier + 1) * 100 .. "%"
|
||||
local value = math_round((player.force.character_running_speed_modifier + player.character_running_speed_modifier + 1) * 100) .. "%"
|
||||
add_gui_stat(tt, value, w2)
|
||||
|
||||
local e = add_gui_description(tt, "", w0)
|
||||
@ -387,7 +388,7 @@ local function draw_gui(player, forced)
|
||||
|
||||
add_gui_description(tt, " ", w0)
|
||||
add_gui_description(tt, "HEALTH\nBONUS", w1)
|
||||
local value = "+ " .. (player.force.character_health_bonus + player.character_health_bonus)
|
||||
local value = "+ " .. math_round((player.force.character_health_bonus + player.character_health_bonus))
|
||||
add_gui_stat(tt, value, w2)
|
||||
|
||||
add_separator(frame, 400)
|
||||
@ -458,15 +459,15 @@ local function level_up(player)
|
||||
level_up_effects(player)
|
||||
end
|
||||
|
||||
local function gain_xp(player, amount)
|
||||
function Public.gain_xp(player, amount)
|
||||
local fee
|
||||
if rpg_t[player.index].xp > 50 then
|
||||
fee = math.ceil(rpg_t[player.index].xp * 0.01, 0) / 6
|
||||
else
|
||||
fee = 0
|
||||
end
|
||||
amount = math.round(amount, 2) - fee
|
||||
rpg_t.global_pool = rpg_t.global_pool + fee
|
||||
amount = math_round(amount, 2) - fee
|
||||
rpg_t.global_pool = rpg_t.global_pool + math_round(fee)
|
||||
rpg_t[player.index].xp = rpg_t[player.index].xp + amount
|
||||
rpg_t[player.index].xp_since_last_floaty_text = rpg_t[player.index].xp_since_last_floaty_text + amount
|
||||
if player.gui.left.rpg then draw_gui(player, false) end
|
||||
@ -476,7 +477,7 @@ local function gain_xp(player, amount)
|
||||
return
|
||||
end
|
||||
if rpg_t[player.index].last_floaty_text > game.tick then return end
|
||||
player.create_local_flying_text{text="+" .. rpg_t[player.index].xp_since_last_floaty_text .. " xp", position=player.position, color=xp_floating_text_color, time_to_live=120, speed=2}
|
||||
player.create_local_flying_text{text="+" .. math_round(rpg_t[player.index].xp_since_last_floaty_text) .. " xp", position=player.position, color=xp_floating_text_color, time_to_live=120, speed=2}
|
||||
rpg_t[player.index].xp_since_last_floaty_text = 0
|
||||
rpg_t[player.index].last_floaty_text = game.tick + visuals_delay
|
||||
end
|
||||
@ -486,16 +487,19 @@ local function global_pool()
|
||||
if pool <= 5000 then return end
|
||||
local player_count = #game.connected_players
|
||||
local share = pool / player_count
|
||||
if player_count <= 20 then
|
||||
share = share / 3
|
||||
end
|
||||
rpg_t.global_pool = 0
|
||||
for _, p in pairs(game.connected_players) do
|
||||
if rpg_t[p.index].level < 10 and p.online_time < 50000 then
|
||||
local s = share * 2
|
||||
p.create_local_flying_text{text="+" .. s .. " xp", position=p.position, color=xp_floating_text_color, time_to_live=240, speed=1}
|
||||
gain_xp(p, s * 2)
|
||||
Public.gain_xp(p, s * 2)
|
||||
else
|
||||
p.create_local_flying_text{text="+" .. share .. " xp", position=p.position, color=xp_floating_text_color, time_to_live=240, speed=1}
|
||||
rpg_t[p.index].xp_since_last_floaty_text = 0
|
||||
gain_xp(p, share)
|
||||
Public.gain_xp(p, share)
|
||||
end
|
||||
end
|
||||
return
|
||||
@ -666,7 +670,7 @@ local function on_entity_died(event)
|
||||
if event.cause.force.index == event.entity.force.index then return end
|
||||
end
|
||||
end
|
||||
gain_xp(event.entity.last_user, 1)
|
||||
Public.gain_xp(event.entity.last_user, 1)
|
||||
return
|
||||
end
|
||||
end
|
||||
@ -685,9 +689,9 @@ local function on_entity_died(event)
|
||||
if event.entity.type == "unit" then
|
||||
for _, player in pairs(players) do
|
||||
if xp_yield[event.entity.name] then
|
||||
gain_xp(player, xp_yield[event.entity.name] * global.biter_health_boost)
|
||||
Public.gain_xp(player, xp_yield[event.entity.name] * global.biter_health_boost)
|
||||
else
|
||||
gain_xp(player, 0.5 * global.biter_health_boost)
|
||||
Public.gain_xp(player, 0.5 * global.biter_health_boost)
|
||||
end
|
||||
end
|
||||
return
|
||||
@ -697,9 +701,9 @@ local function on_entity_died(event)
|
||||
--Grant normal XP
|
||||
for _, player in pairs(players) do
|
||||
if xp_yield[event.entity.name] then
|
||||
gain_xp(player, xp_yield[event.entity.name])
|
||||
Public.gain_xp(player, xp_yield[event.entity.name])
|
||||
else
|
||||
gain_xp(player, 0.5)
|
||||
Public.gain_xp(player, 0.5)
|
||||
end
|
||||
end
|
||||
end
|
||||
@ -829,7 +833,7 @@ local function on_player_repaired_entity(event)
|
||||
if math_random(1, 4) ~= 1 then return end
|
||||
local player = game.players[event.player_index]
|
||||
if not player.character then return end
|
||||
gain_xp(player, 0.40)
|
||||
Public.gain_xp(player, 0.40)
|
||||
end
|
||||
|
||||
local function on_player_rotated_entity(event)
|
||||
@ -837,7 +841,7 @@ local function on_player_rotated_entity(event)
|
||||
if not player.character then return end
|
||||
if rpg_t[player.index].rotated_entity_delay > game.tick then return end
|
||||
rpg_t[player.index].rotated_entity_delay = game.tick + 20
|
||||
gain_xp(player, 0.20)
|
||||
Public.gain_xp(player, 0.20)
|
||||
end
|
||||
|
||||
local function distance(player)
|
||||
@ -851,7 +855,7 @@ local function distance(player)
|
||||
if min_times and max_times then
|
||||
rpg_t[player.index].bonus = rpg_t[player.index].bonus + 1
|
||||
player.print("[color=blue]Grandmaster:[/color] Survivor! Well done.")
|
||||
gain_xp(player, 300 * rpg_t[player.index].bonus)
|
||||
Public.gain_xp(player, 300 * rpg_t[player.index].bonus)
|
||||
return
|
||||
end
|
||||
end
|
||||
@ -863,7 +867,7 @@ local function on_player_changed_position(event)
|
||||
if math_random(1, 64) ~= 1 then return end
|
||||
if not player.character then return end
|
||||
if player.character.driving then return end
|
||||
gain_xp(player, 1.0)
|
||||
Public.gain_xp(player, 1.0)
|
||||
end
|
||||
|
||||
local building_and_mining_blacklist = {
|
||||
@ -883,12 +887,12 @@ local function on_pre_player_mined_item(event)
|
||||
rpg_t[player.index].last_mined_entity_position.x = entity.position.x
|
||||
rpg_t[player.index].last_mined_entity_position.y = entity.position.y
|
||||
|
||||
if entity.type == "resource" then gain_xp(player, 0.5) return end
|
||||
if entity.type == "resource" then Public.gain_xp(player, 0.5) return end
|
||||
--if entity.force.index == 3 then
|
||||
gain_xp(player, 0.75 + event.entity.prototype.max_health * 0.0013)
|
||||
Public.gain_xp(player, 0.75 + event.entity.prototype.max_health * 0.0013)
|
||||
--return
|
||||
--end
|
||||
--gain_xp(player, 0.1 + event.entity.prototype.max_health * 0.0005)
|
||||
--Public.gain_xp(player, 0.1 + event.entity.prototype.max_health * 0.0005)
|
||||
end
|
||||
|
||||
local function on_player_crafted_item(event)
|
||||
@ -896,7 +900,7 @@ local function on_player_crafted_item(event)
|
||||
local player = game.players[event.player_index]
|
||||
if not player.valid then return end
|
||||
local amount = math_floor(math_random(0.40, 4))
|
||||
gain_xp(player, event.recipe.energy * amount)
|
||||
Public.gain_xp(player, event.recipe.energy * amount)
|
||||
end
|
||||
|
||||
local function on_player_respawned(event)
|
||||
|
@ -54,6 +54,7 @@ function Public.reset_table()
|
||||
}
|
||||
this.train_upgrades = 0
|
||||
this.energy_purchased = false
|
||||
this.freeze_daytime = false
|
||||
end
|
||||
|
||||
function Public.get_table()
|
||||
|
Loading…
x
Reference in New Issue
Block a user