PAC3-Server / notagain

Custom Servercontent for the official PAC3 Server.
GNU General Public License v3.0
13 stars 22 forks source link

Multi-user commands not unlike ULX. #119

Closed NanoAi closed 6 years ago

NanoAi commented 7 years ago

I think being able to target multiple people with a single command, like for example being able to bring multiple people would be really cool and useful. Why bring your friends one by one, when you can bring them all at once?

CapsAdmin commented 7 years ago

This is difficult without rewriting commands in often ugly ways I think. There's a type in aowl that returns an object like all which kinda does this. There's the send command which does this.

aowl.AddCommand("send=players_alter,location", function(ply, line, players, where)
    for k, ent in pairs( players ) do
        ent.aowl_tpprevious = ent:GetPos()
        ent:SetPos( where )
    end
end)

The players table here also behaves like the all metatable in easylua. You can do players:SetPos(where) but in this case I need to store the previous location for all the players as well.

NanoAi commented 7 years ago

Yeah I tried something like that but the problem is that people get stuck in each-other and unstuck doesn't help.

CapsAdmin commented 7 years ago

That's an issue separate from having multi-user commands.

I should have left a comment or something but when I ported the commands to the new aowl I decided to leave out some of the bring code because it was too dependent on something else.

Obviously bringing everyone to the same position will get them stuck. You can try to spread them out but it's not so easy as you need to check if space is available. I'm thinking the easiest way would be if they were all were using the push away collision until they're not colliding anymore, then physics would take care of it.

NanoAi commented 6 years ago

I should remake this issue and name it properly but I guess it's not much of a bother currently.