mirror of
https://github.com/ComfyFactory/ComfyFactorio.git
synced 2025-03-25 21:29:06 +02:00
Mtn v3 - minor changes
This commit is contained in:
parent
9b110033e2
commit
70dad1053d
@ -716,7 +716,7 @@ function Public.save_car(event)
|
||||
|
||||
log_err('Owner of this vehicle is: ' .. p.name)
|
||||
save_surface(entity, p)
|
||||
Utils.action_warning(module_tag .. player.name .. ' has looted ' .. p.name .. '´s car.')
|
||||
game.print(module_tag .. player.name .. ' has looted ' .. p.name .. '´s car.')
|
||||
player.print(module_tag .. 'This car was not yours to keep.', Color.warning)
|
||||
local params = {
|
||||
player = player,
|
||||
@ -978,7 +978,9 @@ function Public.validate_owner(player, entity)
|
||||
if car.owner ~= player.index and player.driving then
|
||||
player.driving = false
|
||||
if not player.admin then
|
||||
return p.print(player.name .. ' tried to drive your car.', Color.warning)
|
||||
p.print(player.name .. ' tried to drive your car.', Color.warning)
|
||||
Utils.action_notify_admins(player.name .. ' tried to drive ' .. p.name .. '´s car.')
|
||||
return
|
||||
end
|
||||
end
|
||||
end
|
||||
|
@ -996,33 +996,57 @@ local function update_raw()
|
||||
elseif collection.survive_for and collection.survive_for < 0 then
|
||||
collection.survive_for = 0
|
||||
if collection.game_won and not collection.game_won_notified then
|
||||
game.print('[color=yellow][Mtn v3][/color] Game won!')
|
||||
collection.game_won = true
|
||||
stateful.collection.time_until_attack = 0
|
||||
stateful.collection.time_until_attack_timer = 0
|
||||
stateful.collection.gather_time = 0
|
||||
stateful.collection.gather_time_timer = 0
|
||||
collection.survive_for = 0
|
||||
collection.survive_for_timer = 0
|
||||
refresh_frames()
|
||||
|
||||
local reversed = Public.get_stateful_settings('reversed')
|
||||
if reversed then
|
||||
Public.set_stateful_settings('reversed', false)
|
||||
else
|
||||
Public.set_stateful_settings('reversed', true)
|
||||
end
|
||||
|
||||
collection.game_won_notified = true
|
||||
refresh_boss_frame()
|
||||
play_game_won()
|
||||
WD.disable_spawning_biters(true)
|
||||
Collapse.disable_collapse(true)
|
||||
WD.nuke_wave_gui()
|
||||
Server.to_discord_embed('Game won!')
|
||||
stateful.rounds_survived = stateful.rounds_survived + 1
|
||||
stateful.selected_objectives = nil
|
||||
local buff = Stateful.save_settings()
|
||||
notify_won_to_discord(buff)
|
||||
local locomotive = Public.get('locomotive')
|
||||
if locomotive and locomotive.valid then
|
||||
locomotive.surface.spill_item_stack(locomotive.position, {name = 'coin', count = 512}, false)
|
||||
Public.set('game_reset_tick', 5400)
|
||||
end
|
||||
Public.set('game_reset_tick', 5400)
|
||||
return
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
for objective_index = 1, #stateful.selected_objectives do
|
||||
local objective = stateful.selected_objectives[objective_index]
|
||||
local objective_name = objective.name
|
||||
local callback = Task.get(objective.token)
|
||||
local completed, _, _ = callback()
|
||||
if completed and completed == true and not stateful.objectives_completed[objective_name] then
|
||||
stateful.objectives_completed[objective_name] = true
|
||||
Alert.alert_all_players(10, 'Objective: **' .. objective_name .. '** has been completed!')
|
||||
Server.to_discord_embed('Objective: **' .. objective_name .. '** has been completed!')
|
||||
play_achievement_unlocked()
|
||||
stateful.objectives_completed_count = stateful.objectives_completed_count + 1
|
||||
if stateful.selected_objectives and next(stateful.selected_objectives) then
|
||||
for objective_index = 1, #stateful.selected_objectives do
|
||||
local objective = stateful.selected_objectives[objective_index]
|
||||
local objective_name = objective.name
|
||||
local callback = Task.get(objective.token)
|
||||
local completed, _, _ = callback()
|
||||
if completed and completed == true and not stateful.objectives_completed[objective_name] then
|
||||
stateful.objectives_completed[objective_name] = true
|
||||
Alert.alert_all_players(10, 'Objective: **' .. objective_name .. '** has been completed!')
|
||||
Server.to_discord_embed('Objective: **' .. objective_name .. '** has been completed!')
|
||||
play_achievement_unlocked()
|
||||
stateful.objectives_completed_count = stateful.objectives_completed_count + 1
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
@ -1058,6 +1082,7 @@ local function update_raw()
|
||||
WD.nuke_wave_gui()
|
||||
Server.to_discord_embed('Game won!')
|
||||
stateful.rounds_survived = stateful.rounds_survived + 1
|
||||
stateful.selected_objectives = nil
|
||||
local buff = Stateful.save_settings()
|
||||
notify_won_to_discord(buff)
|
||||
local locomotive = Public.get('locomotive')
|
||||
@ -1070,6 +1095,7 @@ local function update_raw()
|
||||
|
||||
stateful.collection.gather_time = tick + 54000
|
||||
stateful.collection.gather_time_timer = tick + 54000
|
||||
game.forces.enemy.evolution_factor = 1
|
||||
play_achievement_unlocked()
|
||||
WD.disable_spawning_biters(true)
|
||||
Collapse.disable_collapse(true)
|
||||
|
@ -317,6 +317,17 @@ function Public.action_warning(warning_prefixes, msg)
|
||||
Server.to_discord_bold(msg)
|
||||
end
|
||||
|
||||
--- Takes msg and prints it to all admin players
|
||||
-- @param msg <string> The message to print
|
||||
function Public.action_notify_admins(msg)
|
||||
for _, p in pairs(game.connected_players) do
|
||||
if p.admin then
|
||||
p.print(msg, Color.yellow)
|
||||
end
|
||||
end
|
||||
print(msg)
|
||||
end
|
||||
|
||||
--- Takes msg and prints it to all players. Also prints to the log and discord
|
||||
-- @param msg <string> The message to print
|
||||
-- @param warning_prefixes <string> The name of the module/warning
|
||||
|
Loading…
x
Reference in New Issue
Block a user