mirror of
https://github.com/Refactorio/RedMew.git
synced 2024-12-12 10:04:40 +02:00
Updated as per grilledham's comments.
This commit is contained in:
parent
e303430dc1
commit
329dfb346b
@ -10,6 +10,7 @@ local RS = require 'map_gen.shared.redmew_surface'
|
||||
local market_items = require 'resources.market_items'
|
||||
local fish_market_bonus_message = require 'resources.fish_messages'
|
||||
local ScoreTracker = require 'utils.score_tracker'
|
||||
local Color = require 'resources.color_presets'
|
||||
local change_for_player = ScoreTracker.change_for_player
|
||||
local get_for_player = ScoreTracker.get_for_player
|
||||
local coins_earned_name = 'coins-earned'
|
||||
@ -123,7 +124,7 @@ local function fish_earned(event, amount)
|
||||
|
||||
local stack = {name = currency, count = amount}
|
||||
local inserted = player.insert(stack)
|
||||
player.surface.create_entity{name="flying-text", position = {player.position.x - 1, player.position.y}, text = "+" .. amount .. " [img=item.coin]", color = {1, 0.8, 0, 0.5}, render_player_index = player.index}
|
||||
player.surface.create_entity{name="flying-text", position = {player.position.x - 1, player.position.y}, text = "+" .. amount .. " [img=item.coin]", color = Color.gold, render_player_index = player.index}
|
||||
|
||||
local diff = amount - inserted
|
||||
if diff > 0 then
|
||||
|
@ -146,15 +146,17 @@ local function picked_up_item(event)
|
||||
end
|
||||
|
||||
local function pre_player_mined_item(event)
|
||||
if event.entity.type == 'simple-entity' then -- Cheap check for rock, may have other side effects
|
||||
local entity = event.entity
|
||||
if entity.type == 'simple-entity' then -- Cheap check for rock, may have other side effects
|
||||
change_for_global(rocks_smashed_name, 1)
|
||||
return
|
||||
end
|
||||
if event.entity.type == 'tree' then
|
||||
if entity.type == 'tree' then
|
||||
change_for_global(trees_cut_down_name, 1)
|
||||
return
|
||||
end
|
||||
if event.entity.type == 'container' and event.entity.operable == false then-- We have to do it here because we can't check the entity from player_mined_item
|
||||
local inv = event.entity.get_inventory(defines.inventory.chest)
|
||||
if entity.type == 'container' and entity.operable == false then -- We check the container is not operable as these are used as loot chests in Crash Site and players can't add coins to them.
|
||||
local inv = entity.get_inventory(defines.inventory.chest)
|
||||
local coin_count = inv.get_item_count("coin")
|
||||
if coin_count then
|
||||
change_for_player(event.player_index, coins_earned_name, coin_count)
|
||||
|
Loading…
Reference in New Issue
Block a user