1
0
mirror of https://github.com/ComfyFactory/ComfyFactorio.git synced 2025-04-11 11:21:54 +02:00

various tweaks

This commit is contained in:
Gerkiz 2021-07-02 10:52:27 +02:00
parent 35f7a25ce8
commit d3880c78a6
6 changed files with 45 additions and 42 deletions

View File

@ -79,7 +79,7 @@ spell_gui_setup=Spells MiniGui Setup
spell_gui_tooltip=Set your 3 spells for useful Spell Switcher. Opened or closed by this fish button.\n
save_changes=Save changes
discard_changes=Discard changes
not_trusted=Not trusted.\nChecked: true\nUnchecked: false
not_trusted=Not trusted.
low_level=Level requirement: __1__
used_up=All used up!
no_mana=Not enough mana!
@ -105,6 +105,8 @@ explosive_bullets_label=Enable explosive bullets?
explosive_bullets_tooltip=Hurts the biters a bit extra
magic_label=Enable spawning with raw-fish?
toggle_cast_spell_label=Toggles the ability to cast spells.
cast_spell_enabled_label=Casting spells with fish has been enabled!
cast_spell_disabled_label=Casting spells with fish has been disabled!
magic_tooltip=When simply constructing items is not enough.\nNOTE! Use Raw-fish to cast spells.
magic_spell=Select what entity to spawn
magic_item_requirement=__1__ [item=__2__] requires __3__ mana to cast. Level: __4__\n

View File

@ -169,6 +169,7 @@ function Public.reset_map()
end
JailData.set_valid_surface(tostring(surface.name))
JailData.reset_vote_table()
Explosives.set_surface_whitelist({[surface.name] = true})

View File

@ -2,6 +2,7 @@ local ComfyGui = require 'comfy_panel.main'
local Session = require 'utils.datastore.session_data'
local P = require 'player_modifiers'
local Gui = require 'utils.gui'
local Color = require 'utils.color_presets'
--RPG Modules
local Public = require 'modules.rpg.table'
@ -739,18 +740,19 @@ Gui.on_click(
return
end
log(serpent.block(Session.get_trusted_player(player.name)))
if not Session.get_trusted_player(player) then
player.print({'rpg_settings.not_trusted'}, Color.fail)
return player.play_sound({path = 'utility/cannot_build', volume_modifier = 0.75})
end
if frame and frame.valid then
local rpg_t = Public.get_value_from_player(player.index)
if not rpg_t.enable_entity_spawn then
player.print({'rpg_settings.cast_spell_enabled_label'}, Color.success)
player.play_sound({path = 'utility/armor_insert', volume_modifier = 0.75})
rpg_t.enable_entity_spawn = true
else
player.print({'rpg_settings.cast_spell_disabled_label'}, Color.warning)
player.play_sound({path = 'utility/cannot_build', volume_modifier = 0.75})
rpg_t.enable_entity_spawn = false
end

View File

@ -9,23 +9,6 @@ local try_get_data = Server.try_get_data
local Public = {}
local color_table = {
default = {},
red = {},
green = {},
blue = {},
orange = {},
yellow = {},
pink = {},
purple = {},
white = {},
black = {},
gray = {},
brown = {},
cyan = {},
acid = {}
}
local fetch =
Token.register(
function(data)
@ -62,20 +45,15 @@ Event.add(
if not player then
return
end
fetcher(player.name)
end
)
Event.add(
defines.events.on_console_command,
function(event)
local player_index = event.player_index
if not player_index or event.command ~= 'color' then
return
end
local player = game.get_player(player_index)
commands.add_command(
'save-color',
'Save your personal color preset so it´s always the same whenever you join.',
function()
local player = game.player
if not player or not player.valid then
return
end
@ -85,19 +63,30 @@ Event.add(
return
end
local param = event.parameters
local color = player.color
local chat = player.chat_color
param = string.lower(param)
if param then
for word in param:gmatch('%S+') do
if color_table[word] then
set_data(color_data_set, player.name, {color = {color}, chat = {chat}})
player.print('Your color has been saved.', Color.success)
return true
end
end
set_data(color_data_set, player.name, {color = {color}, chat = {chat}})
player.print('Your personal color has been saved to the datastore.', Color.success)
end
)
commands.add_command(
'remove-color',
'Removes your saved color from the datastore.',
function()
local player = game.player
if not player or not player.valid then
return
end
local secs = Server.get_current_time()
if not secs then
return
end
set_data(color_data_set, player.name, nil)
player.print('Your personal color has been removed from the datastore.', Color.success)
end
)

View File

@ -686,6 +686,15 @@ function Public.required_playtime_for_vote(value)
return settings.playtime_for_vote
end
function Public.reset_vote_table()
for k, _ in pairs(votejail) do
votejail[k] = nil
end
for k, _ in pairs(votefree) do
votefree[k] = nil
end
end
Event.on_init(get_gulag_permission_group)
return Public

View File

@ -938,8 +938,8 @@ local function command_handler(callback, ...)
end
end
--- The command 'cc' is only used by the server so it can communicate through the webpanel api to the instances that it starts.
-- Doing this, enables achivements and the webpanel can communicate without any interruptions.
--- The command 'cc' is only used by the server so it can communicate through the web-panel api to the instances that it starts.
-- Doing this, enables achievements and the web-panel can communicate without any interruptions.
commands.add_command(
'cc',
'Evaluate command',