Skip to content
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

Merged
merged 4 commits into from
Aug 26, 2020

Conversation

Hornwitser
Copy link

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.

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)
Copy link
Collaborator

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

Copy link
Author

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.

Copy link
Member

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.
Copy link
Collaborator

@tovernaar123 tovernaar123 left a 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

Copy link
Member

@Cooldude2606 Cooldude2606 left a 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.

@Cooldude2606 Cooldude2606 merged commit 8c4d78f into explosivegaming:dev Aug 26, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants