Your color is your force
Your color is your force
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.
- bobingabout
- Smart Inserter
- Posts: 7352
- Joined: Fri May 09, 2014 1:01 pm
- Contact:
Re: Your color is your force
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.
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.
- eradicator
- Smart Inserter
- Posts: 5206
- Joined: Tue Jul 12, 2016 9:03 am
- Contact:
Re: Your color is your force
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?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.
Evil hack: force.name = serpent.line(color) -- ;pbobingabout 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.
Cleaner solutoin: raise a custom on_player_changed_color event from an on_tick handler.
Author of: Belt Planner, Hand Crank Generator, Screenshot Maker, /sudo and more.
Mod support languages: 日本語, Deutsch, English
My code in the post above is dedicated to the public domain under CC0.
Mod support languages: 日本語, Deutsch, English
My code in the post above is dedicated to the public domain under CC0.
Re: Your color is your force
It's not mod helping forum, just I have this idea some years, but I don't know is this idea good or not.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?
- bobingabout
- Smart Inserter
- Posts: 7352
- Joined: Fri May 09, 2014 1:01 pm
- Contact:
Re: Your color is your force
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.
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.
- eradicator
- Smart Inserter
- Posts: 5206
- Joined: Tue Jul 12, 2016 9:03 am
- Contact:
Re: Your color is your force
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.
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)
Author of: Belt Planner, Hand Crank Generator, Screenshot Maker, /sudo and more.
Mod support languages: 日本語, Deutsch, English
My code in the post above is dedicated to the public domain under CC0.
Mod support languages: 日本語, Deutsch, English
My code in the post above is dedicated to the public domain under CC0.