Inter-force interactions

Post your ideas and suggestions how to improve the game.

Moderator: ickputzdirwech

User avatar
Siapran
Inserter
Inserter
Posts: 22
Joined: Fri Aug 21, 2015 7:43 am
Contact:

Inter-force interactions

Post by Siapran »

Right now, with the lua api, we can allow a ceasefire between two forces:

Code: Select all

my_force.set_cease_fire(their_force, true)
Now, there is still one problem, in that a force should allow another to access containers and open doors.
Something like:

Code: Select all

my_force.set_interaction_permission(their_force, true)
This could solve a number of problems when making PvP multiplayer games, such as trains crashing through doors, impossibility of efficient trading, and neutral doors not letting any players through.

Right now, I'm using a small workaround for trading:

Code: Select all

-- some entities are always neutral to allow for inter-faction trading
always_neutral = {
	"wooden-chest",
	"cargo-wagon",
	-- "diesel-locomotive",
	"straight-rail",
	"curved-rail",
}
script.on_event(defines.events.on_built_entity, function (event)
	local entity = event.created_entity
	for _,neutral_entity in ipairs(always_neutral) do
		if (entity.name == neutral_entity) then
			entity.force = "neutral"
			return
		end
	end
end)
But such behavior should be achievable much more easily.
Post Reply

Return to “Ideas and Suggestions”