Portals (CJ1 Fork)


Adds combustible lemons, a portal gun and portals. Each player has their own set of portals that can be used by all players.

Content
6 months ago
1.1
178
Transportation
Owner:
Cyberjock
Source:
N/A
Homepage:
N/A
License:
MIT
Created:
7 months ago
Latest Version:
0.7.1453 (6 months ago)
Factorio version:
1.1
Downloaded by:
178 users

Fork of Portals mod by Bilka. All credits go to Bilka on this one. I only changed the recipe and tech unlock requirements to better fit our server playthrough. The aim of this fork is to make the portal gun more of a prize in the endgame.

Thanks to Bilka for making the license MIT!

IN THIS FORK:
Tech unlock prerequisites changed to:
Space Science Pack, Military 3

Cost to research changed to:
Time=30 x 500
Automation Science Pack 1
Logistic Science Pack 1
Military Science Pack 1
Chemical Science Pack 1
Production Science Pack 1
Utility Science Pack 1
Space Science Pack 1

Recipe of Portal Gun changed to:
Space Science Pack 1000
Satellite 1
Combat Shotgun 1
Battery 1000

Copied from the description of Portals by Bilka:
Adds portals that can teleport players (and only players!). Build the portals using the portal gun: Left click for the orange portal, SHIFT+ Left click (ghost build) for the blue portal. Every player can have one set of portals which can be distinguished using the number next to the portal. Adds combustible lemons that work similiar to cluster grenades, just with fire. This mod can also be found on the forums.

Custom events
on_player_teleported_event:
- When a player teleports using a portal.
- Contains:
- player_index = Index of the player that is teleporting
- entrance_portal = LuaEntity, the portal the player is teleporting from
- target_portal = LuaEntity, the portal the player is teleporting to

on_player_placed_portal_event:
- When a player places a portal using the portal gun.
- Contains:
- portal = LuaEntity, the portal that was placed
- player_index = Index of the player that placed the portal, which is the player the portal belongs to

Example usage
script.on_load(function()
script.on_event(remote.call("portals", "get_on_player_teleported_event"), function(event)
game.print("Woosh!")
game.print(game.players[event.player_index].name .. " teleported from " .. serpent.line(event.entrance_portal.position) .. " to " .. serpent.line(event.target_portal.position))
end)

script.on_event(remote.call("portals", "get_on_player_placed_portal_event"), function(event)
    game.print(game.players[event.player_index].name .. " created " .. event.portal.name .. " at " .. serpent.line(event.portal.position))
end)

end)

script.on_init(function()
script.on_event(remote.call("portals", "get_on_player_teleported_event"), function(event)
game.print("Woosh!")
game.print(game.players[event.player_index].name .. " teleported from " .. serpent.line(event.entrance_portal.position) .. " to " .. serpent.line(event.target_portal.position))
end)

script.on_event(remote.call("portals", "get_on_player_placed_portal_event"), function(event)
    game.print(game.players[event.player_index].name .. " created " .. event.portal.name .. " at " .. serpent.line(event.portal.position))
end)

end)
Remote functions
build_portal_a: function(player, surface, position)
- Build an orange portal.
- Parameters:
- position: Position of the new portal
- surface: LuaSurface, the surface of the new portal
- player: LuaPlayer that the portal belongs to. This player can't have more than one pair, build_portal will delete any excess portals

build_portal_b: function(player, surface, position)
- Build a blue portal.
- Parameters:
- position: Position of the new portal
- surface: LuaSurface, the surface of the new portal
- player: LuaPlayer that the portal belongs to. This player can't have more than one pair, build_portal will delete any excess portals

destroy_portal: function(entity)
- Destroy the given entity if it is a portal (also destroys label + animation).
- Parameter:
- entity: LuaEntity, the portal to destroy

disable_long_distance_placing: function(bool)
- Change whether the blue portal can be placed from a long distance.
- Parameter:
- bool: Boolean, if this is true the player can never place from a long distance, if it is false, the player can place from a long distance depending on the mod option

Example usage in the console
/c remote.call("portals", "build_portal_b", game.player, game.player.surface, game.player.position) --place at current player position
/c remote.call("portals", "destroy_portal", game.player.selected) --destroy currently selected portal
/c remote.call("portals", "disable_long_distance_placing", true) --disable long distance placing