1
0
mirror of https://github.com/ComfyFactory/ComfyFactorio.git synced 2025-03-25 21:29:06 +02:00

fix bugs; remove chests; remove captain inventory slots

This commit is contained in:
danielmartin0 2022-07-30 14:55:03 +01:00
parent 9e9c063295
commit 3b84445d34
4 changed files with 73 additions and 64 deletions

View File

@ -511,33 +511,7 @@ function Public.captain_tax(captain_index)
end
function Public.add_player_to_permission_group(player, group_override)
-- local jailed = Jailed.get_jailed_table()
-- local enable_permission_group_disconnect = WPT.get('disconnect_wagon')
local session = Session.get_session_table()
local AG = Antigrief.get()
local gulag = game.permissions.get_group('gulag')
local tbl = gulag and gulag.players
for i = 1, #tbl do
if tbl[i].index == player.index then
return
end
end
-- if player.admin then
-- return
-- end
local playtime = player.online_time
if session and session[player.name] then
playtime = player.online_time + session[player.name]
end
-- if jailed[player.name] then
-- return
-- end
function Public.try_create_permissions_groups()
if not game.permissions.get_group('restricted_area') then
local group = game.permissions.create_group('restricted_area')
@ -571,8 +545,6 @@ function Public.add_player_to_permission_group(player, group_override)
end
group.set_allows_action(defines.input_action.fast_entity_transfer, false)
group.set_allows_action(defines.input_action.fast_entity_split, false)
group.set_allows_action(defines.input_action.open_gui, true)
end
if not game.permissions.get_group('super_restricted_area') then
@ -697,6 +669,38 @@ function Public.add_player_to_permission_group(player, group_override)
not_trusted.set_allows_action(defines.input_action.import_blueprint, false)
end
end
end
function Public.add_player_to_permission_group(player, group_override)
-- local jailed = Jailed.get_jailed_table()
-- local enable_permission_group_disconnect = WPT.get('disconnect_wagon')
local session = Session.get_session_table()
local AG = Antigrief.get()
local gulag = game.permissions.get_group('gulag')
local tbl = gulag and gulag.players
for i = 1, #tbl do
if tbl[i].index == player.index then
return
end
end
-- if player.admin then
-- return
-- end
local playtime = player.online_time
if session and session[player.name] then
playtime = player.online_time + session[player.name]
end
-- if jailed[player.name] then
-- return
-- end
Public.try_create_permissions_groups()
local group
if group_override then
@ -712,6 +716,8 @@ function Public.add_player_to_permission_group(player, group_override)
end
function Public.update_privileges(player)
Public.try_create_permissions_groups()
if not Common.validate_player_and_character(player) then
return
end

View File

@ -207,15 +207,16 @@ function Public.update_character_properties(tickinterval)
-- end
character.character_health_bonus = health_boost
if Common.is_captain(player) then
if player.character and player.character.valid then
player.character_inventory_slots_bonus = 20
end
else
if player.character and player.character.valid then
player.character_inventory_slots_bonus = 0
end
end
-- == DO NOT DO THIS!: Removing inventory slots is evil. The player can spill inventory
-- if Common.is_captain(player) then
-- if player.character and player.character.valid then
-- player.character_inventory_slots_bonus = 20
-- end
-- else
-- if player.character and player.character.valid then
-- player.character_inventory_slots_bonus = 0
-- end
-- end
local speed_boost = Balance.base_extra_character_speed

View File

@ -25,10 +25,10 @@ Public.Minimarket = require 'maps.pirates.shop.dock'
function Public.print_transaction(player, multipler, offer_itemname, offer_itemcount, price)
function Public.print_transaction(player, multiplier, offer_itemname, offer_itemcount, price)
local type = 'traded away'
local s2 = {''}
local s3 = offer_itemcount * multipler .. ' ' .. offer_itemname
local s3 = offer_itemcount * multiplier .. ' ' .. offer_itemname
if offer_itemname == 'coin' then type = 'sold' end
for i, p in pairs(price) do
local p2 = {name = p.name, amount = p.amount}
@ -44,7 +44,7 @@ function Public.print_transaction(player, multipler, offer_itemname, offer_itemc
s2[#s2+1] = {'pirates.separator_1'}
end
end
s2[#s2+1] = p2.amount * multipler
s2[#s2+1] = p2.amount * multiplier
s2[#s2+1] = ' '
s2[#s2+1] = p2.name
end
@ -138,25 +138,27 @@ function Public.refund_items(player, price, price_multiplier, item_purchased_nam
end
if item_purchased_name and item_purchased_count then
local removed = inv.remove{name = item_purchased_name, count = item_purchased_count}.count
local removed = inv.remove{name = item_purchased_name, count = item_purchased_count}
if removed < item_purchased_count then
local nearby_floor_items = player.surface.find_entities_filtered{area = {{player.position.x - 5, player.position.y - 5}, {player.position.x + 5, player.position.y + 5}}, name = 'item-on-ground'}
local nearby_floor_items = player.surface.find_entities_filtered{area = {{player.position.x - 20, player.position.y - 20}, {player.position.x + 20, player.position.y + 20}}, name = 'item-on-ground'}
local whilesafety = 2000
local i = 1
while removed < item_purchased_count and i < #nearby_floor_items and i < whilesafety do
i = i + 1
while removed < item_purchased_count and i <= #nearby_floor_items and i < whilesafety do
if nearby_floor_items[i].stack and nearby_floor_items[i].stack.name and nearby_floor_items[i].stack.count and nearby_floor_items[i].stack.name == item_purchased_name then
local removed_count = nearby_floor_items[i].stack.count
if removed_count > item_purchased_count - removed then
removed_count = item_purchased_count - removed
end
if removed_count == nearby_floor_items[i].stack.count then
nearby_floor_items[i].destroy()
else
nearby_floor_items[i].stack.count = nearby_floor_items[i].stack.count - removed_count
end
removed = removed + removed_count
nearby_floor_items[i].destroy()
removed = removed + 1
-- local removed_count = nearby_floor_items[i].stack.count
-- if removed_count > item_purchased_count - removed then
-- removed_count = item_purchased_count - removed
-- end
-- if removed_count == nearby_floor_items[i].stack.count then
-- nearby_floor_items[i].destroy()
-- else
-- nearby_floor_items[i].stack.count = nearby_floor_items[i].stack.count - removed_count
-- end
-- removed = removed + removed_count
end
i = i + 1
end
if i == whilesafety then log('ERROR: whilesafety reached') end
end

View File

@ -38,7 +38,7 @@ Public.Data.market_position = {x = 4.5, y = 3.5}
Public.Data.static_entities_bp = [[0eNqlmu9u2jAUxd8ln2HK9X/zKlM10RJ1kWiCkrAVVX33hVJtXcuJfcwnhEh+XF+fY8e596W63x+bw9B2U7V5qcZue1hP/fpxaHfn78/VRsKqOlUbZV5XVfvQd2O1+T5f2D522/35kul0aKpN1U7NU7Wquu3T+dvvvt813frhZzNO1fnGbtecWa+r5K3N82FoxnE9HvbtNDXDh9vV692qarqpndrmEsbbl9OP7vh0P1+5kesBrKpDP8439d37mOpv9m1Q8+frOaRPGJWJkWWMzsSoZYzJxOhljM3EmGWMy8TYZYzPxLhlTMjE+GVMzMSEZYzUmZyY4OTqWBJClmwlJ6QsuVqWhJglV82SkLPk6lkSgpZcRUtC0pKraUmIWgK5jCnAiSRHwHJYf1mcp2HbjYd+mNb3zX5hLQKRKaGJJkFUpPUQR5Mcl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IHBAsOMERFFA3ZvXpfY9UHd+RBXKQekwsvai7UTyHiMwVh8GJYLyJm2WvAEmcOPyuUcT8RtN4SE6rfygsiMP1fQXBc8p4uq6kX1+aslSaS670C2MexLT/Y9ZPtmn/xtRPtimYdKhyVnvzvwo+MHJJmI2u261pm1qvm1XyfwG7QKjd]]
-- Public.Data.operable_entities_bp = [[0eNqVkeFqwzAMhN9Fv51Ru8nS+lVKGWkjOkMiG0vZGkrefbZXRhljbX+Jg7vPJ/kCh2HCEB0J2AswdaESX52i67M+gzUrBXMa9aLAHT0x2F0yuhN1Q7bIHBAsOMERFFA3ZvXpfY9UHd+RBXKQekwsvai7UTyHiMwVh8GJYLyJm2WvAEmcOPyuUcT8RtN4SE6rfygsiMP1fQXBc8p4uq6kX1+aslSaS670C2MexLT/Y9ZPtmn/xtRPtimYdKhyVnvzvwo+MHJJmI2u261pm1qvm1XyfwG7QKjd]]
Public.Data.cabin_splitters = {
{x = -7, y = 9.5, direction = defines.direction.north, type = 0},
@ -242,14 +242,14 @@ function Public.create_cabin_surface()
e2.operable = false
end
end
local es2 = Common.build_from_blueprint(Public.Data.operable_entities_bp, surface, {x=5, y=-4}, boat.force_name)
for _, e2 in pairs(es2) do
if e2 and e2.valid then
e2.destructible = false
e2.minable = false
e2.rotatable = false
end
end
-- local es2 = Common.build_from_blueprint(Public.Data.operable_entities_bp, surface, {x=5, y=-4}, boat.force_name)
-- for _, e2 in pairs(es2) do
-- if e2 and e2.valid then
-- e2.destructible = false
-- e2.minable = false
-- e2.rotatable = false
-- end
-- end
e = surface.create_entity({name = 'car', position = Public.Data.car_pos, force = boat.force_name, create_build_effect_smoke = false})
if e and e.valid then
e.get_inventory(defines.inventory.fuel).insert({name = 'wood', count = 16})