-
Notifications
You must be signed in to change notification settings - Fork 8
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Unstuck car implementation #55
Unstuck car implementation #55
Conversation
Change the entity name used to find a non-colliding position to assembling-machine-1. This moves the car away from close obstacles it could get stuck in due to the non-colliding position algorithm not taking account to the rotation of the car.
Add unstuck command for the Race game which moves the player's car away from nearby obstacles.
Fix the commands part of mini-games not being disabled when the game is over.
--- Respawn the car for a player | ||
local respawn_car | ||
respawn_car = Token.register(function(name) | ||
local player = dead_cars[name].player | ||
local position = surface[1].find_non_colliding_position('car', dead_cars[name].position, 5, 0.5) | ||
local position = surface[1].find_non_colliding_position('assembling-machine-1', dead_cars[name].position, 5, 0.5) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
mabye just use smt like rocket silo so you dont need the command at all
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Rocket silo is 9x9. That would make it fail in narrow sections and is completely unacceptable. And even so, it's still possible to get pretty stuck driving parallel to a straight section of wall so you still need the command anyhow.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The assembling seams like the right choice as its about the same size as a car but without the rotational difference.
Pass the missing car error message to Command.error and let the command system print it to the user.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
might make it a gui latter but this is very nice for now
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Everything looks good, althouh I would suggest some sort of timeout rather than a gui for doing the unstuck. Meaning if you stop moving for X seconds and you are close to a wall then it will unstuck you.
Change to using an assembly machine as the name for the find_non_colliding_possition call. This will make it use a larger bounding box for checking collisions and thereby place the car some distance away from the wall.
Implement /unstuck command as detailed in #51. No GUI since I'm not sure how to do that properly. The command might be a bit abusable as it generally places you some distance away from your current position, so if you collide into an obstacle and use it you get put left or right from your current position and could probably start driving immediately. Same goes for escaping a biter swarm with it.