mirror of
https://github.com/PHIDIAS0303/ExpCluster.git
synced 2026-11-18 23:03:13 +09:00
Move the virtual layer into exp_scenario (#463)
The virtual layer was a legacy control module and a legacy gui built on the legacy event system. The control module moves to exp_scenario/module/control/vlayer.lua in the event_handler shape, with the data typed and the allowed item table built locally rather than by rewriting the config. The gui moves to exp_scenario/module/gui/vlayer.lua in the shape of the other scenario guis: statistics as label and bar defines refreshed from display data computed once, and the interface controls as a define which owns its dropdowns. Api changes while moving: interfaces are removed by entity rather than by searching a position, the dead circuit wiring parameter is gone since connect_neighbour no longer exists, and remove_item now takes only the unallocated amount out of storage and counts that production back out of the total, which the legacy module got wrong. The locale moves to [exp-gui_vlayer] in en, zh-CN and zh-TW and the legacy [vlayer] sections, modules and file loader entries are removed. Co-authored-by: Cooldude2606 <25043174+Cooldude2606@users.noreply.github.com>
This commit is contained in:
1 parent
a2ce3ded81
commit
862fe49b60
14 files changed
+1310
-1484
No files matched your search
@@ -5,7 +5,7 @@ Adds a gui that allows players to apply various bonuses
|
||||
local Gui = require("modules/exp_gui")
|
||||
local Roles = require("modules/exp_roles")
|
||||
local config = require("modules/exp_legacy/config/bonus")
|
||||
local vlayer = require("modules/exp_legacy/modules/control/vlayer")
|
||||
local Vlayer = require("modules/exp_scenario/control/vlayer")
|
||||
local format_number = require("util").format_number
|
||||
|
||||
--- @class ExpGui_PlayerBonus.elements
|
||||
@@ -486,7 +486,7 @@ end
|
||||
--- Apply periodic bonus to a player
|
||||
--- @param player LuaPlayer
|
||||
local function apply_personal_battery_recharge(player)
|
||||
local available_energy = vlayer.get_statistics()["energy_storage"]
|
||||
local available_energy = Vlayer.get_statistics().energy_storage
|
||||
if available_energy <= 0 then
|
||||
return -- No power to give
|
||||
end
|
||||
@@ -508,7 +508,7 @@ local function apply_personal_battery_recharge(player)
|
||||
local energy_to_give = math.min(math.floor(equipment.max_energy - equipment.energy), available_energy, recharge_amount)
|
||||
equipment.energy = equipment.energy + energy_to_give
|
||||
recharge_amount = recharge_amount - energy_to_give
|
||||
available_energy = vlayer.energy_changed(-energy_to_give)
|
||||
available_energy = Vlayer.energy_changed(-energy_to_give)
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
Reference in new issue
Block a user