Page 1 of 1

Your color is your force

Posted: Sat Jan 13, 2018 1:39 pm
by darkfrei
It's possible to make a mod, that's changing all players to forces. If you have /color red, then you going to the force 'red' automatically. By defaults forces are friendly, so it's possible to make two, three etc. fabrics in one place.

Re: Your color is your force

Posted: Mon Jan 15, 2018 9:48 am
by bobingabout
Scripts CAN change a player from one force to another... I'm not sure how to check what colour you are and see if it changed or not.

come to think of it, not sure if a script can set your colour.

EDIT:
http://lua-api.factorio.com/latest/LuaPlayer.html
Yes, you can check a player's colour.


http://lua-api.factorio.com/latest/
no, there is not an event to tell you when it changed.


You could request that this event be added, or just monitor the player.color value for change, and act accordingly.

in on_tick, inside a player iterator (for in pairs loop)
if player.force.name ~= player.color then
--change the force
end

edit2:
okay, can't just compare a force name to a player.color, because the player colour holds a full RGBA array, but you get the idea.

Re: Your color is your force

Posted: Tue Jan 16, 2018 1:03 am
by eradicator
darkfrei wrote:It's possible to make a mod, that's changing all players to forces. If you have /color red, then you going to the force 'red' automatically. By defaults forces are friendly, so it's possible to make two, three etc. fabrics in one place.
That's not a question. Knowing you have written quite a few mods i'm not sure what exactly you're having trouble with implementing with?
bobingabout wrote: okay, can't just compare a force name to a player.color, because the player colour holds a full RGBA array, but you get the idea.
Evil hack: force.name = serpent.line(color) -- ;p
Cleaner solutoin: raise a custom on_player_changed_color event from an on_tick handler.

Re: Your color is your force

Posted: Tue Jan 16, 2018 10:41 am
by darkfrei
eradicator wrote: That's not a question. Knowing you have written quite a few mods i'm not sure what exactly you're having trouble with implementing with?
It's not mod helping forum, just I have this idea some years, but I don't know is this idea good or not.

Re: Your color is your force

Posted: Wed Jan 17, 2018 12:06 am
by bobingabout
you're asking if it's a good idea?

Relation

In Terraria, you have 4 buttons... Yellow, Red, Green and Blue. (There's a 5th button for PvP too.) If you set yourself to one of these colours, you're effectively on that colour's team, and can see where all other players of that team are in relation to yourself.

So in theory, there's no reason why this is a bad idea.

Re: Your color is your force

Posted: Wed Jan 17, 2018 12:43 am
by eradicator
I have no clue if that's a good idea. I don't do PvP. What would you hope to gain from that as compared to normal teams? Easier team joining? Easier telling if a player is in your team?

Btw, the correct way to implement this would be to intercept the /color command.

Code: Select all

/c script.on_event(defines.events.on_console_command,function(e) game.print(serpent.line(e)) end)