mirror of
https://github.com/ComfyFactory/ComfyFactorio.git
synced 2025-03-17 20:58:13 +02:00
modules fix and some final changes
This commit is contained in:
parent
c7ecb7220c
commit
8995a1e248
@ -1,4 +1,4 @@
|
||||
-- config tab --
|
||||
-- config tab --
|
||||
|
||||
local Tabs = require 'comfy_panel.main'
|
||||
|
||||
@ -13,22 +13,22 @@ local function spaghett_deny_building(event)
|
||||
if not spaghett.enabled then return end
|
||||
local entity = event.created_entity
|
||||
if not entity.valid then return end
|
||||
if not spaghett_entity_blacklist[event.created_entity.name] then return end
|
||||
|
||||
if not spaghett_entity_blacklist[event.created_entity.name] then return end
|
||||
|
||||
if event.player_index then
|
||||
game.players[event.player_index].insert({name = entity.name, count = 1})
|
||||
else
|
||||
game.players[event.player_index].insert({name = entity.name, count = 1})
|
||||
else
|
||||
local inventory = event.robot.get_inventory(defines.inventory.robot_cargo)
|
||||
inventory.insert({name = entity.name, count = 1})
|
||||
inventory.insert({name = entity.name, count = 1})
|
||||
end
|
||||
|
||||
|
||||
event.created_entity.surface.create_entity({
|
||||
name = "flying-text",
|
||||
position = entity.position,
|
||||
text = "Spaghett Mode Active!",
|
||||
color = {r=0.98, g=0.66, b=0.22}
|
||||
})
|
||||
|
||||
|
||||
entity.destroy()
|
||||
end
|
||||
|
||||
@ -50,19 +50,19 @@ local function spaghett()
|
||||
spaghett.undo[f.index] = nil
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
local functions = {
|
||||
["comfy_panel_spectator_switch"] = function(event)
|
||||
["comfy_panel_spectator_switch"] = function(event)
|
||||
if event.element.switch_state == "left" then
|
||||
game.players[event.player_index].spectator = true
|
||||
else
|
||||
game.players[event.player_index].spectator = false
|
||||
end
|
||||
end,
|
||||
|
||||
["comfy_panel_auto_hotbar_switch"] = function(event)
|
||||
|
||||
["comfy_panel_auto_hotbar_switch"] = function(event)
|
||||
if event.element.switch_state == "left" then
|
||||
global.auto_hotbar_enabled[event.player_index] = true
|
||||
else
|
||||
@ -99,33 +99,33 @@ local function add_switch(element, switch_state, name, description_main, descrip
|
||||
local switch = t.add({type = "switch", name = name})
|
||||
switch.switch_state = switch_state
|
||||
switch.style.padding = 0
|
||||
switch.style.margin = 0
|
||||
switch.style.margin = 0
|
||||
local label = t.add({type = "label", caption = "OFF"})
|
||||
label.style.padding = 0
|
||||
label.style.font_color = {0.70, 0.70, 0.70}
|
||||
|
||||
|
||||
local label = t.add({type = "label", caption = description_main})
|
||||
label.style.padding = 2
|
||||
label.style.left_padding= 10
|
||||
label.style.minimal_width = 120
|
||||
label.style.font = "heading-2"
|
||||
label.style.font_color = {0.88, 0.88, 0.99}
|
||||
|
||||
|
||||
local label = t.add({type = "label", caption = description})
|
||||
label.style.padding = 2
|
||||
label.style.left_padding= 10
|
||||
label.style.single_line = false
|
||||
label.style.font = "heading-3"
|
||||
label.style.font_color = {0.85, 0.85, 0.85}
|
||||
|
||||
|
||||
return switch
|
||||
end
|
||||
|
||||
local build_config_gui = (function (player, frame)
|
||||
local build_config_gui = (function (player, frame)
|
||||
frame.clear()
|
||||
|
||||
|
||||
local admin = player.admin
|
||||
|
||||
|
||||
local label = frame.add({type = "label", caption = "Player Settings"})
|
||||
label.style.font = "default-bold"
|
||||
label.style.padding = 0
|
||||
@ -133,15 +133,15 @@ local build_config_gui = (function (player, frame)
|
||||
label.style.horizontal_align = "left"
|
||||
label.style.vertical_align = "bottom"
|
||||
label.style.font_color = {0.55, 0.55, 0.99}
|
||||
|
||||
|
||||
frame.add({type = "line"})
|
||||
|
||||
|
||||
local switch_state = "right"
|
||||
if player.spectator then switch_state = "left" end
|
||||
add_switch(frame, switch_state, "comfy_panel_spectator_switch", "SpectatorMode", "Toggles zoom-to-world view noise effect.\nEnvironmental sounds will be based on map view.")
|
||||
|
||||
|
||||
frame.add({type = "line"})
|
||||
|
||||
|
||||
if global.auto_hotbar_enabled then
|
||||
local switch_state = "right"
|
||||
if global.auto_hotbar_enabled[player.index] then switch_state = "left" end
|
||||
@ -157,23 +157,23 @@ local build_config_gui = (function (player, frame)
|
||||
label.style.horizontal_align = "left"
|
||||
label.style.vertical_align = "bottom"
|
||||
label.style.font_color = {0.77, 0.11, 0.11}
|
||||
|
||||
|
||||
frame.add({type = "line"})
|
||||
|
||||
|
||||
local switch_state = "right"
|
||||
if game.permissions.get_group("Default").allows_action(defines.input_action.import_blueprint) then switch_state = "left" end
|
||||
local switch = add_switch(frame, switch_state, "comfy_panel_blueprint_toggle", "Blueprint Library", "Toggles the usage of blueprint strings and the library.")
|
||||
if not admin then switch.ignored_by_interaction = true end
|
||||
|
||||
|
||||
frame.add({type = "line"})
|
||||
|
||||
|
||||
local switch_state = "right"
|
||||
if global.comfy_panel_config.spaghett.enabled then switch_state = "left" end
|
||||
local switch = add_switch(frame, switch_state, "comfy_panel_spaghett_toggle", "Spaghett Mode", "Disables the Logistic System research.\nRequester, buffer or active-provider containers can not be built.")
|
||||
if not admin then switch.ignored_by_interaction = true end
|
||||
|
||||
|
||||
frame.add({type = "line"})
|
||||
|
||||
|
||||
for _, e in pairs(frame.children) do
|
||||
if e.type == "line" then
|
||||
e.style.padding = 0
|
||||
@ -209,7 +209,7 @@ local function on_init()
|
||||
global.comfy_panel_config.spaghett.undo = {}
|
||||
end
|
||||
|
||||
comfy_panel_tabs["Config"] = build_config_gui
|
||||
comfy_panel_tabs["Config"] = {gui = build_config_gui, admin = false}
|
||||
|
||||
|
||||
local Event = require 'utils.event'
|
||||
|
@ -27,7 +27,7 @@ require "comfy_panel.config"
|
||||
require "modules.autostash"
|
||||
|
||||
---- enable modules here ----
|
||||
require "modules.admins_operate_biters"
|
||||
--require "modules.admins_operate_biters"
|
||||
--require "modules.the_floor_is_lava"
|
||||
--require "modules.biters_landfill_on_death"
|
||||
--require "modules.autodecon_when_depleted"
|
||||
@ -46,7 +46,7 @@ require "modules.admins_operate_biters"
|
||||
--require "modules.fluids_are_explosive"
|
||||
--require "modules.hunger"
|
||||
--require "modules.hunger_games"
|
||||
require "modules.pistol_buffs"
|
||||
--require "modules.pistol_buffs"
|
||||
--require "modules.players_trample_paths"
|
||||
--require "modules.railgun_enhancer"
|
||||
--require "modules.restrictive_fluid_mining"
|
||||
@ -68,7 +68,7 @@ require "modules.pistol_buffs"
|
||||
-----------------------------
|
||||
|
||||
---- enable maps here ---- (maps higher up in the list may be more actually playable)
|
||||
require "maps.chronosphere.main"
|
||||
--require "maps.chronosphere.main"
|
||||
--require "maps.fish_defender.main"
|
||||
--require "maps.biter_battles_v2.main"
|
||||
--require "maps.native_war.main"
|
||||
|
@ -15,6 +15,7 @@ local function on_entity_damaged(event)
|
||||
if not weapon.valid_for_read or not ammo.valid_for_read then return end
|
||||
if weapon.name ~= "pistol" then return end
|
||||
if ammo.name ~= "firearm-magazine" and ammo.name ~= "piercing-rounds-magazine" and ammo.name ~= "uranium-rounds-magazine" then return end
|
||||
if not event.entity.valid then return end
|
||||
event.entity.damage(event.final_damage_amount * 4, player.force, "impact", player)
|
||||
end
|
||||
|
||||
|
@ -56,7 +56,7 @@ local function do_splash_damage_around_entity(source_entity, player)
|
||||
}
|
||||
local entities = source_entity.surface.find_entities_filtered({area = splash_area})
|
||||
for _, entity in pairs(entities) do
|
||||
if entity.health and entity ~= source_entity and entity ~= player then
|
||||
if entity.valid and entity.health and entity ~= source_entity and entity ~= player then
|
||||
if additional_visual_effects then
|
||||
local surface = entity.surface
|
||||
surface.create_entity({name = "railgun-beam", position = source_entity.position, source = source_entity.position, target = entity.position})
|
||||
|
Loading…
x
Reference in New Issue
Block a user