mirror of
https://github.com/PHIDIAS0303/ExpCluster.git
synced 2025-12-27 11:35:22 +09:00
Store bug fixes
This commit is contained in:
12
README.md
12
README.md
@@ -47,15 +47,17 @@ Explosive Gaming (often ExpGaming) is a server hosting community with a strong f
|
|||||||
All are welcome to make pull requests and issues for this scenario, if you are in any doubt please ask someone in our [discord]. If you do not know lua and don't feel like learning you can always make a [feature request]. All our docs can be found [here][docs]. Please keep in mind while making code changes:
|
All are welcome to make pull requests and issues for this scenario, if you are in any doubt please ask someone in our [discord]. If you do not know lua and don't feel like learning you can always make a [feature request]. All our docs can be found [here][docs]. Please keep in mind while making code changes:
|
||||||
|
|
||||||
* New features should have the branch names: `feature/feature-name`
|
* New features should have the branch names: `feature/feature-name`
|
||||||
* New features are merged into `dev` after it has been completed.
|
* New features are merged into `dev` after it has been completed, this can be done through a pull request.
|
||||||
* After a number of features have been added a release branch is made: `release/X.Y.0`; this branch should have no new features and only bug fixes or localization.
|
* After a number of features have been added a release branch is made: `release/X.Y.0`
|
||||||
* A release is merged into `master` on the following friday in time for the the weekly reset.
|
* Bug fixes and localization can be made to the release branch with a pull request rather than into dev.
|
||||||
* Patches may be named `patch/X.Y.Z` and fill be merged into `master` and `dev` when appropriate.
|
* A release is merged into `master` on the following friday after it is considered stable.
|
||||||
|
* Patches may be named `patch/X.Y.Z` and will be merged into `dev` and then `master` when appropriate.
|
||||||
|
|
||||||
## Releases
|
## Releases
|
||||||
|
|
||||||
| Scenario Version* | Version Name | Factorio Version** |
|
| Scenario Version* | Version Name | Factorio Version** |
|
||||||
|---|---|---|
|
|---|---|---|
|
||||||
|
| [v5.10][s5.10] | Data Store Rewrite | [v0.17.71][f0.17.71] |
|
||||||
| [v5.9][s5.9] | Control Modules and Documentation | [v0.17.63][f0.17.63] |
|
| [v5.9][s5.9] | Control Modules and Documentation | [v0.17.63][f0.17.63] |
|
||||||
| [v5.8][s5.8] | Home and Chat Bot | [v0.17.47][f0.17.49] |
|
| [v5.8][s5.8] | Home and Chat Bot | [v0.17.47][f0.17.49] |
|
||||||
| [v5.7][s5.7] | Warp System | [v0.17.47][f0.17.47] |
|
| [v5.7][s5.7] | Warp System | [v0.17.47][f0.17.47] |
|
||||||
@@ -76,6 +78,7 @@ All are welcome to make pull requests and issues for this scenario, if you are i
|
|||||||
|
|
||||||
\*\* Factorio versions show the version they were made for, often the minimum requirement.
|
\*\* Factorio versions show the version they were made for, often the minimum requirement.
|
||||||
|
|
||||||
|
[s5.10]: https://github.com/explosivegaming/scenario/releases/tag/5.10.0
|
||||||
[s5.9]: https://github.com/explosivegaming/scenario/releases/tag/5.9.0
|
[s5.9]: https://github.com/explosivegaming/scenario/releases/tag/5.9.0
|
||||||
[s5.8]: https://github.com/explosivegaming/scenario/releases/tag/5.8.0
|
[s5.8]: https://github.com/explosivegaming/scenario/releases/tag/5.8.0
|
||||||
[s5.7]: https://github.com/explosivegaming/scenario/releases/tag/5.7.0
|
[s5.7]: https://github.com/explosivegaming/scenario/releases/tag/5.7.0
|
||||||
@@ -92,6 +95,7 @@ All are welcome to make pull requests and issues for this scenario, if you are i
|
|||||||
[s1.0]: https://github.com/explosivegaming/scenario/releases/tag/v1.0
|
[s1.0]: https://github.com/explosivegaming/scenario/releases/tag/v1.0
|
||||||
[s0.1]: https://github.com/explosivegaming/scenario/releases/tag/v0.1
|
[s0.1]: https://github.com/explosivegaming/scenario/releases/tag/v0.1
|
||||||
|
|
||||||
|
[f0.17.71]: https://wiki.factorio.com/Version_history/0.17.0#0.17.71
|
||||||
[f0.17.63]: https://wiki.factorio.com/Version_history/0.17.0#0.17.63
|
[f0.17.63]: https://wiki.factorio.com/Version_history/0.17.0#0.17.63
|
||||||
[f0.17.49]: https://wiki.factorio.com/Version_history/0.17.0#0.17.49
|
[f0.17.49]: https://wiki.factorio.com/Version_history/0.17.0#0.17.49
|
||||||
[f0.17.47]: https://wiki.factorio.com/Version_history/0.17.0#0.17.47
|
[f0.17.47]: https://wiki.factorio.com/Version_history/0.17.0#0.17.47
|
||||||
|
|||||||
@@ -277,7 +277,9 @@ function Store.clear(store,key)
|
|||||||
|
|
||||||
-- Check if there is a key being used
|
-- Check if there is a key being used
|
||||||
if key then
|
if key then
|
||||||
|
if type(data_store[store]) == 'table' then
|
||||||
data_store[store][key] = nil
|
data_store[store][key] = nil
|
||||||
|
end
|
||||||
else
|
else
|
||||||
data_store[store] = nil
|
data_store[store] = nil
|
||||||
end
|
end
|
||||||
|
|||||||
@@ -304,14 +304,14 @@ function Warps.add_warp(force_name,surface,position,player_name,warp_name)
|
|||||||
warp_name = warp_name or 'New warp'
|
warp_name = warp_name or 'New warp'
|
||||||
|
|
||||||
-- Get the existing warps for this force
|
-- Get the existing warps for this force
|
||||||
local warps = force_warps[force_name]
|
local warp_ids = force_warps[force_name]
|
||||||
if not warps then
|
if not warp_ids then
|
||||||
force_warps[force_name] = {}
|
warp_ids = {}
|
||||||
warps = force_warps[force_name]
|
force_warps[force_name] = warp_ids
|
||||||
end
|
end
|
||||||
|
|
||||||
-- Insert the warp id into the force warps
|
-- Insert the warp id into the force warps
|
||||||
table.insert(warps,warp_id)
|
table.insert(warp_ids,warp_id)
|
||||||
|
|
||||||
-- Create the editing table
|
-- Create the editing table
|
||||||
local editing = {}
|
local editing = {}
|
||||||
|
|||||||
@@ -326,7 +326,7 @@ Tasks.on_update(function(task,task_id)
|
|||||||
local players
|
local players
|
||||||
if task then
|
if task then
|
||||||
local force = game.forces[task.force_name]
|
local force = game.forces[task.force_name]
|
||||||
players = force.players
|
players = force.connected_players
|
||||||
else
|
else
|
||||||
players = game.connected_players
|
players = game.connected_players
|
||||||
end
|
end
|
||||||
@@ -338,6 +338,9 @@ Tasks.on_update(function(task,task_id)
|
|||||||
end
|
end
|
||||||
end)
|
end)
|
||||||
|
|
||||||
|
--- Update the tasks when the player joins
|
||||||
|
Event.add(defines.events.on_player_joined_game,task_list 'redraw')
|
||||||
|
|
||||||
--- Makes sure the right buttons are present when roles change
|
--- Makes sure the right buttons are present when roles change
|
||||||
Event.add(Roles.events.on_role_assigned,task_list 'redraw')
|
Event.add(Roles.events.on_role_assigned,task_list 'redraw')
|
||||||
Event.add(Roles.events.on_role_unassigned,task_list 'redraw')
|
Event.add(Roles.events.on_role_unassigned,task_list 'redraw')
|
||||||
|
|||||||
@@ -94,7 +94,7 @@ end)
|
|||||||
Warps.teleport_player(warp_id,player)
|
Warps.teleport_player(warp_id,player)
|
||||||
|
|
||||||
-- Reset the warp cooldown if the player does not have unlimited warps
|
-- Reset the warp cooldown if the player does not have unlimited warps
|
||||||
if config.bypass_warp_limits_permision and not Roles.player_allowed(player,config.bypass_warp_limits_permision) then
|
if config.bypass_warp_limits_permission and not Roles.player_allowed(player,config.bypass_warp_limits_permission) then
|
||||||
warp_timer:set_store(player.name,0)
|
warp_timer:set_store(player.name,0)
|
||||||
Store.trigger(player_in_range_store,player)
|
Store.trigger(player_in_range_store,player)
|
||||||
end
|
end
|
||||||
@@ -436,6 +436,11 @@ end)
|
|||||||
--- When the name of a warp is updated this is triggered
|
--- When the name of a warp is updated this is triggered
|
||||||
Warps.on_update(warp_list 'update_all')
|
Warps.on_update(warp_list 'update_all')
|
||||||
|
|
||||||
|
--- Update the warps when the player joins
|
||||||
|
Event.add(defines.events.on_player_joined_game,warp_list 'redraw')
|
||||||
|
Event.add(Roles.events.on_role_assigned,warp_list 'redraw')
|
||||||
|
Event.add(Roles.events.on_role_unassigned,warp_list 'redraw')
|
||||||
|
|
||||||
--- When the player leaves or enters range of a warp this is triggered
|
--- When the player leaves or enters range of a warp this is triggered
|
||||||
Store.watch(player_in_range_store,function(value,player_name)
|
Store.watch(player_in_range_store,function(value,player_name)
|
||||||
local player = game.players[player_name]
|
local player = game.players[player_name]
|
||||||
@@ -459,7 +464,7 @@ Store.watch(player_in_range_store,function(value,player_name)
|
|||||||
if element and element.valid then
|
if element and element.valid then
|
||||||
element.enabled = state
|
element.enabled = state
|
||||||
if state then
|
if state then
|
||||||
local position = Warps.get_details(warp_id).position
|
local position = Warps.get_warp(warp_id).position
|
||||||
element.tooltip = {'warp-list.goto-tooltip',position.x,position.y}
|
element.tooltip = {'warp-list.goto-tooltip',position.x,position.y}
|
||||||
else
|
else
|
||||||
element.tooltip = {'warp-list.goto-disabled'}
|
element.tooltip = {'warp-list.goto-disabled'}
|
||||||
@@ -483,7 +488,7 @@ Event.on_nth_tick(math.floor(60/config.update_smoothing),function()
|
|||||||
local was_in_range = Store.get(player_in_range_store,player)
|
local was_in_range = Store.get(player_in_range_store,player)
|
||||||
|
|
||||||
-- Get the ids of all the warps on the players force
|
-- Get the ids of all the warps on the players force
|
||||||
local force_name = player.force
|
local force_name = player.force.name
|
||||||
local warp_ids = force_warps[force_name]
|
local warp_ids = force_warps[force_name]
|
||||||
if not warp_ids then
|
if not warp_ids then
|
||||||
warp_ids = Warps.get_force_warp_ids(force_name)
|
warp_ids = Warps.get_force_warp_ids(force_name)
|
||||||
@@ -497,11 +502,11 @@ Event.on_nth_tick(math.floor(60/config.update_smoothing),function()
|
|||||||
local px,py = pos.x,pos.y
|
local px,py = pos.x,pos.y
|
||||||
|
|
||||||
-- Loop over each warp
|
-- Loop over each warp
|
||||||
for _,warp_id in pairs(warp_ids) do
|
for _,warp_id in ipairs(warp_ids) do
|
||||||
-- Check if warp id is chached
|
-- Check if warp id is chached
|
||||||
local warp = warps[warp_id]
|
local warp = warps[warp_id]
|
||||||
if not warp then
|
if not warp then
|
||||||
warp = Warps.get(warp_id)
|
warp = Warps.get_warp(warp_id)
|
||||||
warps[warp_id] = warp
|
warps[warp_id] = warp
|
||||||
end
|
end
|
||||||
|
|
||||||
@@ -509,11 +514,12 @@ Event.on_nth_tick(math.floor(60/config.update_smoothing),function()
|
|||||||
local warp_pos = warp.position
|
local warp_pos = warp.position
|
||||||
if warp.surface == surface then
|
if warp.surface == surface then
|
||||||
local dx, dy = px-warp_pos.x, py-warp_pos.y
|
local dx, dy = px-warp_pos.x, py-warp_pos.y
|
||||||
if (dx*dx)+(dy*dy) < rs2 or (dx*dx)+(dy*dy) < r2 then
|
if (warp_id == warp_ids.spawn and (dx*dx)+(dy*dy) < rs2) or (dx*dx)+(dy*dy) < r2 then
|
||||||
-- Set in range to true if the player was preiovusly out of range
|
-- Set in range to true if the player was preiovusly out of range
|
||||||
if not was_in_range then
|
if not was_in_range then
|
||||||
Store.set(player_in_range_store,player,true)
|
Store.set(player_in_range_store,player,true)
|
||||||
end
|
end
|
||||||
|
was_in_range = false -- stops setting back to false below
|
||||||
break
|
break
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|||||||
Reference in New Issue
Block a user