-
Notifications
You must be signed in to change notification settings - Fork 80
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
DO: Silo Defense scenario #1403
Open
RedRafe
wants to merge
2
commits into
Refactorio:develop
Choose a base branch
from
RedRafe:do/silo-defense
base: develop
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
Show all changes
2 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
local Event = require 'utils.event' | ||
|
||
local relations = { | ||
['logistic-science-pack'] = 10, | ||
['military-science-pack'] = 20, | ||
['chemical-science-pack'] = 40, | ||
['production-science-pack'] = 50, | ||
['utility-science-pack'] = 90, | ||
} | ||
|
||
Event.on_nth_tick(103, function() | ||
local max = 0 | ||
local tech = game.forces.player.technologies | ||
for name, evo in pairs(relations) do | ||
if tech[name] and tech[name].researched then | ||
max = math.max(max, evo) | ||
end | ||
end | ||
if game.forces.enemy.evolution_factor > 10 and max > 2 then | ||
game.forces.enemy.evolution_factor = math.min(game.forces.enemy.evolution_factor, max - 1) | ||
end | ||
end) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
44 changes: 44 additions & 0 deletions
44
map_gen/maps/danger_ores/modules/memory_storage_control.lua
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,44 @@ | ||
local Event = require 'utils.event' | ||
local RS = require 'map_gen.shared.redmew_surface' | ||
|
||
if not script.active_mods['deep-storage-unit'] then | ||
return | ||
end | ||
|
||
-- Disable MU tech & drop 4 of them at spawn | ||
Event.on_init(function() | ||
game.forces.player.technologies['memory-unit'].enabled = false | ||
|
||
local chest = RS.get_surface().create_entity{ | ||
name = 'iron-chest', | ||
position = {0, 0}, | ||
force = 'player', | ||
create_build_effect_smoke = true, | ||
move_stuck_players = true | ||
} | ||
|
||
chest.insert({ count = 4, name = 'memory-unit'}) | ||
end) | ||
|
||
-- If a player disconnects with any Memory Storage in its inventory, spill all of it immediately | ||
Event.add(defines.events.on_pre_player_left_game, function(event) | ||
local player = game.get_player(event.player_index) | ||
if not (player and player.valid) then | ||
return | ||
end | ||
|
||
for _, inv_type in pairs({defines.inventory.character_main, defines.inventory.character_trash}) do | ||
local inv = player.get_inventory(inv_type) | ||
local count = inv.get_item_count | ||
|
||
if count('memory-unit') + count('memory-unit-with-tags') > 0 then | ||
local spill_stack = player.surface and player.surface.spill_item_stack | ||
local position = player.position | ||
|
||
for i=1, #inv do | ||
spill_stack(position, inv[i], true, nil, false) | ||
inv[i].clear() | ||
end | ||
end | ||
end | ||
end) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm not sure if spilling items is the best idea here. Isn't this punishing the other players who now have to clean up the mess.
What if we spawned a player corpse instead. You can set the corpse to inactive to prevent it from despairing. You can look at
dump_offline_inventories.lua
for inspiration.Also I wonder if only dumping the memory storage items instead of the whole inventory would make more sense? Logging off with a memory storage item might be accidently rather than deliberate/griefing.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Honestly, I made it harsh on purpose since there are only 4 of the in game, & you can't get others, so it would act both as anti-grief & punishment if you log off with one of them in your inventory, since you're not supposed to have any
(Memory Storages have a scripted inventory so when picking up one Memory Storage, it appends a tag with the stored quantity to the item. So you can have 1000, 1M, 100Billions items stored in 1 inventory slot of yours)
But this may be indeed too harsh, I can tone it down by spilling just the MUs