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

Vehicles now spawn in more interesting ways. #2889

Merged

Conversation

Projects
None yet
3 participants
@ianestrachan
Copy link
Contributor

commented Sep 7, 2013

A number of fixes/improvements to how vehicles are spawned:

  • Vehicles don't spawn in water (Fixes #1801)
  • Shopping carts no longer spawn inside walls, display racks, etc (Fixes #2707)
  • Vehicles CAN now spawn inside other vehicles - fusing both into a single "Wreckage" vehicle, which will be extremely damaged. Creates the appearance of nasty collisions.
  • Vehicles CAN spawn in walls - causing extreme masonry demolition in the process and heavily damaging the vehicle. (With current spawn locations, however, this is highly unlikely)
  • The debug menu vehicle spawn doesn't try to board a vehicle if one wasn't created.

For maximum amusement, someone should follow this up with a PR to make vehicles occasionally spawn along the walls of House squares, making it look like someone swerved into a wall.

EDIT: Whoops, I accidentally included a fix identical to #2867 that I put in while debugging. Fortunately since it's the exact same fix, it shouldn't cause any conflicts.

mapgen.cpp Outdated
} else if(move_cost(px, py) == 0) {

//There's an obstacle here; destroy the surroundings with a small explosion...
g->explosion(px, py, 20, 0, false);

This comment has been minimized.

Copy link
@kevingranade

kevingranade Sep 7, 2013

Member

Two problems, the explosion causes noise (sometimes deafening the player, despite the distance), and causes a delay due to the animation. Actually considering how common it is, I think smash() might be triggering an explosion.

This comment has been minimized.

Copy link
@ianestrachan

ianestrachan Sep 7, 2013

Author Contributor

Well, explosion() mostly goes around calling bash() on the terrain; would doing that directly be a better solution?

EDIT: Actually, even better, calling map.destroy(x, y) directly would ensure the wall is demolished.

mapgen.cpp Outdated
//There's a vehicle here; smash them both up lots to look like a collision
other_veh->smash();
veh->smash();
smashed = true;

This comment has been minimized.

Copy link
@kevingranade

kevingranade Sep 7, 2013

Member

This still leaves overlapping vehicles, which the system doesn't handle gracefully. Ideally it would fully remove components until none overlap.

This comment has been minimized.

Copy link
@ianestrachan

ianestrachan Sep 7, 2013

Author Contributor

Removing components from the car being placed would work, but might result in oddly-shaped, rules-violating holes in the vehicle blueprints.

Other possible alternatives:

  • Adjust the vehicle positions so they are next to each other without overlapping
  • Fuse the two vehicles into a single vehicle and rename it "Car wreck" or similar

This comment has been minimized.

Copy link
@kevingranade

kevingranade Sep 7, 2013

Member

I'm worried about secondary collisions for option 1.
I LOVE option 2.

@KA101

This comment has been minimized.

Copy link
Contributor

commented Sep 8, 2013

Support "car wreck".

@ianestrachan

This comment has been minimized.

Copy link
Contributor Author

commented Sep 8, 2013

Still working on it. Trying to convert from local to global to local coordinates and something is getting a bit messed up along the way. Other than that, fusing two cars together works, so this should be done soon.

I've tagged this PR with [WIP] for now.

@ianestrachan

This comment has been minimized.

Copy link
Contributor Author

commented Sep 8, 2013

More or less good to go, though there are some problems I ran into that are separate issues:

  • Directional parts (frames, for instance) get rotated and flipped around. I know this is because install_part is a bit ass-backwards; when I was JSONizing vehicles, all the parts assumed up was north, but install_part assumed north was thattaway -->. That is a separate issue entirely that should be fixed if these two parts are made consistent.
  • The resulting blueprint can, due to its size, go off the edges of the vehicle examining window. This should probably be fixed by making it possible to scroll that viewport by moving the cursor to its edges.
@ianestrachan

This comment has been minimized.

Copy link
Contributor Author

commented Sep 8, 2013

Fun fact: The vehicle merging can apply multiple times successfully. I had a test world generate a four-car pileup.

@KA101

This comment has been minimized.

Copy link
Contributor

commented Sep 8, 2013

Sounds good.

@kevingranade kevingranade merged commit d42e57d into CleverRaven:master Sep 9, 2013

1 check passed

default Merged build finished.
Details

@ianestrachan ianestrachan deleted the ianestrachan:improved-vehicle-spawning branch Sep 9, 2013

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.