1
0
mirror of https://github.com/ComfyFactory/ComfyFactorio.git synced 2025-01-24 03:47:58 +02:00
This commit is contained in:
danielmartin0 2022-05-22 23:11:52 +01:00
parent 8fd3c7ff67
commit 24c98c2b87
4 changed files with 13 additions and 12 deletions

View File

@ -1,6 +1,6 @@
require 'utils.data_stages' require 'utils.data_stages'
_LIFECYCLE = _STAGE.control -- Control stage _LIFECYCLE = _STAGE.control -- Control stage
_DEBUG = false _DEBUG = true
_DUMP_ENV = false _DUMP_ENV = false
require 'utils.server' require 'utils.server'

View File

@ -738,6 +738,7 @@ end
function Public.entity_damage_healthbar(entity, damage, location_override) function Public.entity_damage_healthbar(entity, damage, location_override)
location_override = location_override or Memory.get_crew_memory() location_override = location_override or Memory.get_crew_memory()
local unit_number = entity.unit_number local unit_number = entity.unit_number
if not (location_override.healthbars) then return end
local healthbar = location_override.healthbars[unit_number] local healthbar = location_override.healthbars[unit_number]
if not healthbar then return 0 end if not healthbar then return 0 end

View File

@ -246,7 +246,7 @@ function Public.generate_overworld_destination(p)
local base_cost_4 = { local base_cost_4 = {
['electronic-circuit'] = Math.ceil(((macro_p.x-2)^(2/3))*100), ['electronic-circuit'] = Math.ceil(((macro_p.x-2)^(2/3))*100),
['advanced-circuit'] = Math.ceil(((macro_p.x-14)^(2/3))*18), ['advanced-circuit'] = Math.ceil(((macro_p.x-14)^(2/3))*18),
['flying-robot-frame'] = Math.ceil(((macro_p.x-18)^(2/3))*10), ['flying-robot-frame'] = Math.ceil(((macro_p.x-18)^(2/3))*15),
['launch_rocket'] = true, ['launch_rocket'] = true,
} }
local base_cost_5 = { local base_cost_5 = {

View File

@ -23,11 +23,11 @@ Public.Minimarket = require 'maps.pirates.shop.dock'
function Public.print_transaction(player, offer, price) function Public.print_transaction(player, offer_itename, offer_itemcount, price)
local s1 = ' traded away ' local s1 = ' traded away '
local s2 = '' local s2 = ''
local s3 = offer.count .. ' ' .. offer.item local s3 = offer_itemcount .. ' ' .. offer_itename
if offer.item == 'coin' then s1 = ' sold ' end if offer_itename == 'coin' then s1 = ' sold ' end
for i, p in pairs(price) do for i, p in pairs(price) do
local p2 = {name = p.name, amount = p.amount} local p2 = {name = p.name, amount = p.amount}
if p2.name == 'raw-fish' then p2.name = 'fish' end if p2.name == 'raw-fish' then p2.name = 'fish' end
@ -253,7 +253,7 @@ function Public.event_on_market_item_purchased(event)
refunds = refunds + 1 refunds = refunds + 1
end end
else else
Common.notify_force_light(player.force, player.name .. ' bought ' .. thisPurchaseData.this_offer.offer.count .. ' ' .. thisPurchaseData.this_offer.offer.item .. ' for ' .. thisPurchaseData.price[1].amount .. ' ' .. thisPurchaseData.price[1].name .. '.') Common.notify_force_light(player.force, player.name .. ' bought ' .. thisPurchaseData.offer_giveitem_count .. ' ' .. thisPurchaseData.offer_giveitem_name .. ' for ' .. thisPurchaseData.price[1].amount .. ' ' .. thisPurchaseData.price[1].name .. '.')
market.remove_market_item(offer_index) market.remove_market_item(offer_index)
end end
@ -280,7 +280,7 @@ function Public.event_on_market_item_purchased(event)
local price_name = thisPurchaseData.price[1].name local price_name = thisPurchaseData.price[1].name
Common.notify_force_light(player.force, player.name .. ' bought extra time at sea for ' .. thisPurchaseData.price[1].amount .. ' ' .. price_name .. '.') Common.notify_force_light(player.force, player.name .. ' bought extra time at sea for ' .. thisPurchaseData.price[1].amount .. ' ' .. price_name .. '.')
else else
Public.print_transaction(player, thisPurchaseData.this_offer.offer, thisPurchaseData.price) Public.print_transaction(player, thisPurchaseData.offer_giveitem_name, thisPurchaseData.offer_giveitem_count, thisPurchaseData.price)
end end
end end
end end
@ -302,7 +302,7 @@ function Public.event_on_market_item_purchased(event)
if thisPurchaseData.decay_type == 'static' then if thisPurchaseData.decay_type == 'static' then
if not inv then return end if not inv then return end
local flying_text_color = {r = 255, g = 255, b = 255} local flying_text_color = {r = 255, g = 255, b = 255}
local text1 = '[color=1,1,1]+' .. thisPurchaseData.this_offer.offer.count .. '[/color] [item=' .. thisPurchaseData.alloffers[offer_index].offer.item .. ']' local text1 = '[color=1,1,1]+' .. thisPurchaseData.offer_giveitem_count .. '[/color] [item=' .. thisPurchaseData.alloffers[offer_index].offer.item .. ']'
local text2 = '[color=' .. flying_text_color.r .. ',' .. flying_text_color.g .. ',' .. flying_text_color.b .. '](' .. inv.get_item_count(thisPurchaseData.alloffers[offer_index].offer.item) .. ')[/color]' local text2 = '[color=' .. flying_text_color.r .. ',' .. flying_text_color.g .. ',' .. flying_text_color.b .. '](' .. inv.get_item_count(thisPurchaseData.alloffers[offer_index].offer.item) .. ')[/color]'
Common.flying_text(player.surface, player.position, text1 .. ' [font=count-font]' .. text2 .. '[/font]') Common.flying_text(player.surface, player.position, text1 .. ' [font=count-font]' .. text2 .. '[/font]')
@ -312,8 +312,8 @@ function Public.event_on_market_item_purchased(event)
if not inv then return end if not inv then return end
local flying_text_color = {r = 255, g = 255, b = 255} local flying_text_color = {r = 255, g = 255, b = 255}
local text1 = '[color=1,1,1]+' .. thisPurchaseData.this_offer.offer.count .. '[/color] [item=' .. thisPurchaseData.alloffers[offer_index].offer.item .. ']' local text1 = '[color=1,1,1]+' .. thisPurchaseData.offer_giveitem_count .. '[/color] [item=' .. thisPurchaseData.alloffers[offer_index].offer.item .. ']'
local text2 = '[color=' .. flying_text_color.r .. ',' .. flying_text_color.g .. ',' .. flying_text_color.b .. '](' .. inv.get_item_count(thisPurchaseData.this_offer.offer.item) .. ')[/color]' local text2 = '[color=' .. flying_text_color.r .. ',' .. flying_text_color.g .. ',' .. flying_text_color.b .. '](' .. inv.get_item_count(thisPurchaseData.offer_giveitem_name) .. ')[/color]'
Common.flying_text(player.surface, player.position, text1 .. ' [font=count-font]' .. text2 .. '[/font]') Common.flying_text(player.surface, player.position, text1 .. ' [font=count-font]' .. text2 .. '[/font]')
@ -329,8 +329,8 @@ function Public.event_on_market_item_purchased(event)
end end
end end
if thisPurchaseData.this_offer.offer.item == 'coin' and refunds < trade_count then if thisPurchaseData.offer_giveitem_name and thisPurchaseData.offer_giveitem_name == 'coin' and refunds < trade_count then
memory.playtesting_stats.coins_gained_by_markets = memory.playtesting_stats.coins_gained_by_markets + thisPurchaseData.this_offer.offer.count memory.playtesting_stats.coins_gained_by_markets = memory.playtesting_stats.coins_gained_by_markets + thisPurchaseData.offer_giveitem_count
end end
end end