mirror of
https://github.com/PHIDIAS0303/ExpCluster.git
synced 2025-12-27 11:35:22 +09:00
Research (#293)
* Update research.lua * Update research.lua * Update commands.cfg * Update commands.cfg * Update commands.cfg * Update research.lua * Update research.lua * Hot patch for luacheckrc with new event --------- Co-authored-by: Cooldude2606 <25043174+Cooldude2606@users.noreply.github.com>
This commit is contained in:
@@ -1080,8 +1080,10 @@ do -- Factorio Defines STDs--
|
|||||||
'on_robot_built_entity',
|
'on_robot_built_entity',
|
||||||
'on_robot_pre_mined',
|
'on_robot_pre_mined',
|
||||||
'on_robot_mined',
|
'on_robot_mined',
|
||||||
'on_research_started',
|
'on_research_cancelled',
|
||||||
'on_research_finished',
|
'on_research_finished',
|
||||||
|
'on_research_reversed',
|
||||||
|
'on_research_started',
|
||||||
'on_player_rotated_entity',
|
'on_player_rotated_entity',
|
||||||
'on_player_set_quickbar_slot',
|
'on_player_set_quickbar_slot',
|
||||||
'on_marked_for_deconstruction',
|
'on_marked_for_deconstruction',
|
||||||
|
|||||||
@@ -135,6 +135,7 @@ ff=Friendly fire is set to __1__
|
|||||||
res=Auto Research is set to __1__
|
res=Auto Research is set to __1__
|
||||||
msg=[color=255, 255, 255] Research Completed at __1__ - [technology=__2__][/color]
|
msg=[color=255, 255, 255] Research Completed at __1__ - [technology=__2__][/color]
|
||||||
inf=[color=255, 255, 255] Research Completed at __1__ - [technology=__2__] - __3__[/color]
|
inf=[color=255, 255, 255] Research Completed at __1__ - [technology=__2__] - __3__[/color]
|
||||||
|
inf-q=[color=255, 255, 255] Research Added to Queue - [technology=__1__] - __2__[/color]
|
||||||
main-tooltip=Research GUI
|
main-tooltip=Research GUI
|
||||||
|
|
||||||
[expcom-waterfill]
|
[expcom-waterfill]
|
||||||
|
|||||||
@@ -135,6 +135,7 @@ ff=Friendly fire is set to __1__
|
|||||||
res=Auto Research is set to __1__
|
res=Auto Research is set to __1__
|
||||||
msg=[color=255, 255, 255] Research Completed at __1__ - [technology=__2__][/color]
|
msg=[color=255, 255, 255] Research Completed at __1__ - [technology=__2__][/color]
|
||||||
inf=[color=255, 255, 255] Research Completed at __1__ - [technology=__2__] - __3__[/color]
|
inf=[color=255, 255, 255] Research Completed at __1__ - [technology=__2__] - __3__[/color]
|
||||||
|
inf-q=[color=255, 255, 255] Research Added to Queue - [technology=__1__] - __2__[/color]
|
||||||
main-tooltip=Research GUI
|
main-tooltip=Research GUI
|
||||||
|
|
||||||
[expcom-waterfill]
|
[expcom-waterfill]
|
||||||
|
|||||||
@@ -135,6 +135,7 @@ ff=Friendly fire is set to __1__
|
|||||||
res=Auto Research is set to __1__
|
res=Auto Research is set to __1__
|
||||||
msg=[color=255, 255, 255] Research Completed at __1__ - [technology=__2__][/color]
|
msg=[color=255, 255, 255] Research Completed at __1__ - [technology=__2__][/color]
|
||||||
inf=[color=255, 255, 255] Research Completed at __1__ - [technology=__2__] - __3__[/color]
|
inf=[color=255, 255, 255] Research Completed at __1__ - [technology=__2__] - __3__[/color]
|
||||||
|
inf-q=[color=255, 255, 255] Research Added to Queue - [technology=__1__] - __2__[/color]
|
||||||
main-tooltip=Research GUI
|
main-tooltip=Research GUI
|
||||||
|
|
||||||
[expcom-waterfill]
|
[expcom-waterfill]
|
||||||
|
|||||||
@@ -36,6 +36,7 @@ local function research_notification(event)
|
|||||||
if (event.research.force.mining_drill_productivity_bonus * 10) <= (config.bonus_inventory.limit / config.bonus_inventory.rate) then
|
if (event.research.force.mining_drill_productivity_bonus * 10) <= (config.bonus_inventory.limit / config.bonus_inventory.rate) then
|
||||||
if event.research.force.technologies['toolbelt'].researched then
|
if event.research.force.technologies['toolbelt'].researched then
|
||||||
event.research.force[config.bonus_inventory.name] = (math.floor(event.research.force.mining_drill_productivity_bonus * 10) * config.bonus_inventory.rate) + 10
|
event.research.force[config.bonus_inventory.name] = (math.floor(event.research.force.mining_drill_productivity_bonus * 10) * config.bonus_inventory.rate) + 10
|
||||||
|
|
||||||
else
|
else
|
||||||
event.research.force[config.bonus_inventory.name] = math.floor(event.research.force.mining_drill_productivity_bonus * 10) * config.bonus_inventory.rate
|
event.research.force[config.bonus_inventory.name] = math.floor(event.research.force.mining_drill_productivity_bonus * 10) * config.bonus_inventory.rate
|
||||||
end
|
end
|
||||||
@@ -56,6 +57,7 @@ local function research_notification(event)
|
|||||||
if not (event.by_script) then
|
if not (event.by_script) then
|
||||||
game.print{'expcom-res.inf', format_time(game.tick, research_time_format), event.research.name, event.research.level - 1}
|
game.print{'expcom-res.inf', format_time(game.tick, research_time_format), event.research.name, event.research.level - 1}
|
||||||
end
|
end
|
||||||
|
|
||||||
else
|
else
|
||||||
if not (event.by_script) then
|
if not (event.by_script) then
|
||||||
game.print{'expcom-res.msg', format_time(game.tick, research_time_format), event.research.name}
|
game.print{'expcom-res.msg', format_time(game.tick, research_time_format), event.research.name}
|
||||||
@@ -63,27 +65,34 @@ local function research_notification(event)
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
local function res_queue(force)
|
local function res_queue(event)
|
||||||
if force.rockets_launched == 0 or force.technologies['mining-productivity-4'].level <= 4 then
|
if event.research.force.rockets_launched == 0 or event.research.force.technologies['mining-productivity-4'].level <= 4 then
|
||||||
return
|
return
|
||||||
end
|
end
|
||||||
|
|
||||||
local res_q = force.research_queue
|
local res_q = event.research.research_queue
|
||||||
|
|
||||||
if #res_q < config.queue_amount then
|
if #res_q < config.queue_amount then
|
||||||
for i=1, config.queue_amount - #res_q do
|
for i=1, config.queue_amount - #res_q do
|
||||||
force.add_research(force.technologies['mining-productivity-4'])
|
event.research.force.add_research(event.research.force.technologies['mining-productivity-4'])
|
||||||
|
|
||||||
|
if not (event.by_script) then
|
||||||
|
game.print{'expcom-res.inf-q', event.research.name, event.research.level + i}
|
||||||
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
Event.add(defines.events.on_research_finished, function(event)
|
local function research_queue_logic(event)
|
||||||
research_notification(event)
|
research_notification(event)
|
||||||
|
|
||||||
if research.res_queue_enable then
|
if research.res_queue_enable then
|
||||||
res_queue(event.research.force)
|
res_queue(event)
|
||||||
end
|
end
|
||||||
end)
|
end
|
||||||
|
|
||||||
|
Event.add(defines.events.on_research_finished, research_queue_logic)
|
||||||
|
Event.add(defines.events.on_research_cancelled, research_queue_logic)
|
||||||
|
|
||||||
Commands.new_command('auto-research', 'Automatically queue up research')
|
Commands.new_command('auto-research', 'Automatically queue up research')
|
||||||
:add_alias('ares')
|
:add_alias('ares')
|
||||||
@@ -94,5 +103,5 @@ Commands.new_command('auto-research', 'Automatically queue up research')
|
|||||||
res_queue(player.force)
|
res_queue(player.force)
|
||||||
end
|
end
|
||||||
|
|
||||||
return Commands.success{'expcom-res.res', research.res_queue_enable}
|
return game.print{'expcom-res.res', research.res_queue_enable}
|
||||||
end)
|
end)
|
||||||
|
|||||||
Reference in New Issue
Block a user