1
0
mirror of https://github.com/ComfyFactory/ComfyFactorio.git synced 2025-03-17 20:58:13 +02:00

pirates: correct market refund formula

This commit is contained in:
danielmartin0 2024-10-13 22:51:35 +01:00
parent 20d34d3c7c
commit f2e3f04790
3 changed files with 57 additions and 18 deletions

View File

@ -138,7 +138,9 @@ Public.unteleportable_names = {
'steam-turbine',
'pump',
'straight-rail',
'curved-rail',
'half-diagonal-rail',
'curved-rail-a',
'curved-rail-b',
'cargo-wagon',
'artillery-turret',
'electric-energy-interface',

View File

@ -1597,14 +1597,34 @@ function Public.teleport_boat(boat, newsurface_name, newposition, new_floor_tile
if oldsurface_name == newsurface_name then
sorting_f = function(a, b)
if
(a.name == 'straight-rail' or a.name == 'curved-rail')
and not (b.name == 'straight-rail' or b.name == 'curved-rail')
(
a.name == 'straight-rail'
or a.name == 'half-diagonal-rail'
or a.name == 'curved-rail-a'
or a.name == 'curved-rail-b'
)
and not (
b.name == 'straight-rail'
or b.name == 'curved-rail-a'
or b.name == 'curved-rail-b'
or b.name == 'half-diagonal-rail'
)
then
return true
end
if
(b.name == 'straight-rail' or b.name == 'curved-rail')
and not (a.name == 'straight-rail' or a.name == 'curved-rail')
(
b.name == 'straight-rail'
or b.name == 'curved-rail-a'
or b.name == 'curved-rail-b'
or b.name == 'half-diagonal-rail'
)
and not (
a.name == 'straight-rail'
or a.name == 'curved-rail-a'
or a.name == 'curved-rail-b'
or a.name == 'half-diagonal-rail'
)
then
return false
end
@ -1691,7 +1711,7 @@ function Public.teleport_boat(boat, newsurface_name, newposition, new_floor_tile
if
e
and e.valid
and (e.name == 'straight-rail' or e.name == 'curved-rail' or (e.name == 'entity-ghost' and (e.ghost_name == 'straight-rail' or e.ghost_name == 'curved-rail')))
and (e.name == 'straight-rail' or e.name == 'half-diagonal-rail' or e.name == 'curved-rail-a' or e.name == 'curved-rail-b' or (e.name == 'entity-ghost' and (e.ghost_name == 'straight-rail' or e.ghost_name == 'half-diagonal-rail' or e.ghost_name == 'curved-rail-a' or e.ghost_name == 'curved-rail-b')))
and (not Utils.contains(unique_entities_list, e))
then
unique_entities_list[#unique_entities_list + 1] = e
@ -1759,8 +1779,18 @@ function Public.teleport_boat(boat, newsurface_name, newposition, new_floor_tile
and e.valid
and (
e.name == 'straight-rail'
or e.name == 'curved-rail'
or (e.name == 'entity-ghost' and (e.ghost_name == 'straight-rail' or e.ghost_name == 'curved-rail'))
or e.name == 'half-diagonal-rail'
or e.name == 'curved-rail-a'
or e.name == 'curved-rail-b'
or (
e.name == 'entity-ghost'
and (
e.ghost_name == 'straight-rail'
or e.ghost_name == 'half-diagonal-rail'
or e.ghost_name == 'curved-rail-a'
or e.ghost_name == 'curved-rail-b'
)
)
)
then
e.destroy()

View File

@ -9,10 +9,10 @@ local Common = require('maps.pirates.common')
local _inspect = require('utils.inspect').inspect
--
-- local SurfacesCommon = require 'maps.pirates.surfaces.common'
local Raffle = require 'utils.math.raffle'
local ShopCovered = require 'maps.pirates.shop.covered'
local Classes = require 'maps.pirates.roles.classes'
local Loot = require 'maps.pirates.loot'
local Raffle = require('utils.math.raffle')
local ShopCovered = require('maps.pirates.shop.covered')
local Classes = require('maps.pirates.roles.classes')
local Loot = require('maps.pirates.loot')
local Public = {}
Public.Data = require('maps.pirates.structures.quest_structures.market1.data')
@ -371,15 +371,22 @@ function Public.entry_price()
item = Common.get_random_dictionary_entry(Public.entry_price_data_raw, true)
end
local raw_materials = Public.entry_price_data_raw[item].raw_materials
local base_count = Public.entry_price_data_raw[item].base_amount
local factor = (0.9 + 0.2 * Math.random()) * Balance.quest_market_entry_price_scale()
local count = Math.ceil(base_count * factor)
local base_raw_materials = Public.entry_price_data_raw[item].raw_materials
local raw_materials = {}
for _, rm in pairs(base_raw_materials) do
raw_materials[#raw_materials + 1] = { name = rm.name, count = Math.ceil(rm.count * factor) }
end
return {
name = item,
count = Math.ceil(
(0.9 + 0.2 * Math.random())
* Public.entry_price_data_raw[item].base_amount
* Balance.quest_market_entry_price_scale()
),
count = count,
raw_materials = raw_materials,
}
end