This commit is contained in:
phidias authored and GitHub committed 2026-11-10 00:12:34 +09:00
1 parent 66722c8291
commit 2ab8b0003e
2 files changed
+17 -17

No files matched your search

+16 -16
View File
@@ -20,8 +20,8 @@ local feature, config = Feature.register("vlayer", {
},
})
local update_tick_storage = 60, -- How frequent the storage updates, in tick
local update_tick_energy = 10, -- How frequent the energy updates, in tick
local update_tick_storage = 60 -- How frequent the storage updates, in tick
local update_tick_energy = 10 -- How frequent the energy updates, in tick
local floor = math.floor
local min = math.min
@@ -191,21 +191,21 @@ end
circuit_description = table.concat(circuit_description, "\n")
--- Get every stored item keyed by name, allocated or not
--- @param s_index number
--- @param s_index number surface index
--- @return table<string, number>
function Vlayer.get_items(s_index)
return vlayer_data[s_index].storage.items
end
--- Get the items waiting for surface area keyed by name
--- @param s_index number
--- @param s_index number surface index
--- @return table<string, number>
function Vlayer.get_unallocated_items(s_index)
return vlayer_data[s_index].storage.unallocated
end
--- Get the items which contribute to the properties keyed by name
--- @param s_index number
--- @param s_index number surface index
--- @return table<string, number>
function Vlayer.get_allocated_items(s_index)
local allocated = {}
@@ -220,7 +220,7 @@ function Vlayer.get_allocated_items(s_index)
end
--- Get the interface entities of each type, do not modify
--- @param s_index number
--- @param s_index number surface index
--- @return ExpScenario_Vlayer.Interfaces
function Vlayer.get_interfaces(s_index)
return vlayer_data[s_index].interfaces
@@ -233,7 +233,7 @@ function Vlayer.get_circuits()
end
--- Surface area left once the unallocated items have taken what they need
--- @param s_index number
--- @param s_index number surface index
--- @return number
local function get_remaining_surface_area(s_index)
local properties = vlayer_data[s_index].properties
@@ -247,7 +247,7 @@ local function get_remaining_surface_area(s_index)
end
--- Fraction of solar production available right now, from the darkness of a real surface or the config day cycle
--- @param s_index number
--- @param s_index number surface index
--- @return number
local function get_production_multiplier(s_index)
local surface = game.surfaces[s_index]
@@ -279,7 +279,7 @@ local function get_production_multiplier(s_index)
end
--- Fraction of solar production averaged over a whole day, sunrise and sunset count for half
--- @param s_index number
--- @param s_index number surface index
--- @return number
local function get_sustained_multiplier(s_index)
local surface = game.surfaces[s_index]
@@ -295,7 +295,7 @@ local function get_sustained_multiplier(s_index)
end
--- Apply the properties of an item to the layer, a negative count deallocates
--- @param s_index number
--- @param s_index number surface index
--- @param name string
--- @param count number
--- @param quality_level number
@@ -325,7 +325,7 @@ local function allocate_item(s_index, name, count, quality_level)
end
--- Count the production of items which are stored but not allocated, so the total shows what more surface area would give
--- @param s_index number
--- @param s_index number surface index
--- @param name string
--- @param count number
--- @param quality_level number
@@ -338,7 +338,7 @@ local function count_unallocated_production(s_index, name, count, quality_level)
end
--- Store an item, it is allocated straight away when there is surface area for it
--- @param s_index number
--- @param s_index number surface index
--- @param name string
--- @param count number
--- @param quality_level number
@@ -365,7 +365,7 @@ function Vlayer.insert_item(s_index, name, count, quality_level)
end
--- Take an item out, unallocated items go first and landfill can only go while nothing is using its area
--- @param s_index number
--- @param s_index number surface index
--- @param name string
--- @param count number
--- @param quality_level number
@@ -402,7 +402,7 @@ function Vlayer.remove_item(s_index, name, wanted, quality_level)
end
--- Add or take energy, used by other modules which spend the stored energy
--- @param s_index number
--- @param s_index number surface index
--- @param energy number J, negative to take
--- @return number # J stored afterwards
function Vlayer.energy_changed(s_index, energy)
@@ -412,7 +412,7 @@ function Vlayer.energy_changed(s_index, energy)
end
--- Get the statistics of the layer
--- @param s_index number
--- @param s_index number surface index
--- @return ExpScenario_Vlayer.Statistics
function Vlayer.get_statistics(s_index)
local properties = vlayer_data[s_index].properties
@@ -437,7 +437,7 @@ function Vlayer.get_statistics(s_index)
end
--- Make an entity into an interface which players can not mine or damage
--- @param s_index number
--- @param s_index number surface index
--- @param interface LuaEntity
--- @param interface_type ExpScenario_Vlayer.InterfaceType
--- @param player LuaPlayer?
+1 -1
View File
@@ -516,7 +516,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(player.physical_surface_index).energy_storage
if available_energy <= 0 then
return -- No power to give
end