Factorio: add Atomic Cliff Remover Trap (#4282)
This commit is contained in:
parent
9eaca95277
commit
d6da3bc899
|
@ -272,6 +272,12 @@ class AtomicRocketTrapCount(TrapCount):
|
|||
display_name = "Atomic Rocket Traps"
|
||||
|
||||
|
||||
class AtomicCliffRemoverTrapCount(TrapCount):
|
||||
"""Trap items that when received trigger an atomic rocket explosion on a random cliff.
|
||||
Warning: there is no warning. The launch is instantaneous."""
|
||||
display_name = "Atomic Cliff Remover Traps"
|
||||
|
||||
|
||||
class EvolutionTrapCount(TrapCount):
|
||||
"""Trap items that when received increase the enemy evolution."""
|
||||
display_name = "Evolution Traps"
|
||||
|
@ -467,6 +473,7 @@ class FactorioOptions(PerGameCommonOptions):
|
|||
cluster_grenade_traps: ClusterGrenadeTrapCount
|
||||
artillery_traps: ArtilleryTrapCount
|
||||
atomic_rocket_traps: AtomicRocketTrapCount
|
||||
atomic_cliff_remover_traps: AtomicCliffRemoverTrapCount
|
||||
attack_traps: AttackTrapCount
|
||||
evolution_traps: EvolutionTrapCount
|
||||
evolution_trap_increase: EvolutionTrapIncrease
|
||||
|
@ -500,6 +507,7 @@ option_groups: list[OptionGroup] = [
|
|||
ClusterGrenadeTrapCount,
|
||||
ArtilleryTrapCount,
|
||||
AtomicRocketTrapCount,
|
||||
AtomicCliffRemoverTrapCount,
|
||||
],
|
||||
start_collapsed=True
|
||||
),
|
||||
|
|
|
@ -77,6 +77,7 @@ all_items["Grenade Trap"] = factorio_base_id - 4
|
|||
all_items["Cluster Grenade Trap"] = factorio_base_id - 5
|
||||
all_items["Artillery Trap"] = factorio_base_id - 6
|
||||
all_items["Atomic Rocket Trap"] = factorio_base_id - 7
|
||||
all_items["Atomic Cliff Remover Trap"] = factorio_base_id - 8
|
||||
|
||||
|
||||
class Factorio(World):
|
||||
|
@ -142,6 +143,7 @@ class Factorio(World):
|
|||
self.options.grenade_traps + \
|
||||
self.options.cluster_grenade_traps + \
|
||||
self.options.atomic_rocket_traps + \
|
||||
self.options.atomic_cliff_remover_traps + \
|
||||
self.options.artillery_traps
|
||||
|
||||
location_pool = []
|
||||
|
@ -194,7 +196,8 @@ class Factorio(World):
|
|||
def create_items(self) -> None:
|
||||
self.custom_technologies = self.set_custom_technologies()
|
||||
self.set_custom_recipes()
|
||||
traps = ("Evolution", "Attack", "Teleport", "Grenade", "Cluster Grenade", "Artillery", "Atomic Rocket")
|
||||
traps = ("Evolution", "Attack", "Teleport", "Grenade", "Cluster Grenade", "Artillery", "Atomic Rocket",
|
||||
"Atomic Cliff Remover")
|
||||
for trap_name in traps:
|
||||
self.multiworld.itempool.extend(self.create_item(f"{trap_name} Trap") for _ in
|
||||
range(getattr(self.options,
|
||||
|
|
|
@ -28,12 +28,23 @@ function random_offset_position(position, offset)
|
|||
end
|
||||
|
||||
function fire_entity_at_players(entity_name, speed)
|
||||
local entities = {}
|
||||
for _, player in ipairs(game.forces["player"].players) do
|
||||
current_character = player.character
|
||||
if current_character ~= nil then
|
||||
current_character.surface.create_entity{name=entity_name,
|
||||
position=random_offset_position(current_character.position, 128),
|
||||
target=current_character, speed=speed}
|
||||
if player.character ~= nil then
|
||||
table.insert(entities, player.character)
|
||||
end
|
||||
end
|
||||
return fire_entity_at_entities(entity_name, entities, speed)
|
||||
end
|
||||
|
||||
function fire_entity_at_entities(entity_name, entities, speed)
|
||||
for _, current_entity in ipairs(entities) do
|
||||
local target = current_entity
|
||||
if target.health == nil then
|
||||
target = target.position
|
||||
end
|
||||
current_entity.surface.create_entity{name=entity_name,
|
||||
position=random_offset_position(current_entity.position, 128),
|
||||
target=target, speed=speed}
|
||||
end
|
||||
end
|
||||
|
|
|
@ -737,6 +737,13 @@ end,
|
|||
["Atomic Rocket Trap"] = function ()
|
||||
fire_entity_at_players("atomic-rocket", 0.1)
|
||||
end,
|
||||
["Atomic Cliff Remover Trap"] = function ()
|
||||
local cliffs = game.surfaces["nauvis"].find_entities_filtered{type = "cliff"}
|
||||
|
||||
if #cliffs > 0 then
|
||||
fire_entity_at_entities("atomic-rocket", {cliffs[math.random(#cliffs)]}, 0.1)
|
||||
end
|
||||
end,
|
||||
}
|
||||
|
||||
commands.add_command("ap-get-technology", "Grant a technology, used by the Archipelago Client.", function(call)
|
||||
|
|
Loading…
Reference in New Issue