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

vehicle mounted pet carriers #24391

Merged
merged 2 commits into from
Jul 23, 2018
Merged

Conversation

mlangsdorf
Copy link
Contributor

@mlangsdorf mlangsdorf commented Jul 20, 2018

adds the infrastructure to support vehicle mounted pet carriers, and creates a new part, the livestock
carrier, that can be installed on a vehicle as a livestock stall and used as a vehicle mounted pet carrier.

create a new iuse, capture_monster_veh, which acts like capture_monster_act
but only for vehicle mounted items.

add the code to pickup.cpp and vehicle.cpp to recognize vehicle parts with
the CAPTURE_MONSTER_VEH flag and provide menu options to use them that
then invoke capture_monster_veh.
add a new vehicle part, the livestock carrier, that can be installed as a
livestock stall. livestock stalls can be used to capture creatures up to
LARGE size.
@mlangsdorf
Copy link
Contributor Author

mlangsdorf commented Jul 20, 2018

Still to do (possibly in another PR):

  1. Add weight of carried animal to vehicle/remove it when removed.
  2. Remove cargo capacity when an animal is in the stall.
  3. Make loading or unloading an animal into a long action taking 5-10 minutes.
  4. Add support for transporting large robots.

@tinukedaya
Copy link
Contributor

I like this! But I would not say it fixes #11381

It's very good and realistic approach for transport of large animals. But cats and dogs should be able to just be with you inside the car, without the need to put them to the stall (just like NPCs). For the small ones it still feels like a workaround, same as using Pet Carrier. Personally I just don't get any dogs anymore, even tho' I'd like to, they always ended up closed in the carrier, because it's just too much hassle to work with.

BTW: I know this is a long stretch, but any chance this could be adapted to transport small vehicles? Bike rack, anyone? Or fork-lifter plugged at the back of my truck?
Or maybe just one tile "garage" for the shopping cart, pallet lifter, or portable generator. I hate to always build the pallet lifter when I need to reinstall some storage batteries.

@mlangsdorf
Copy link
Contributor Author

mlangsdorf commented Jul 20, 2018

okay, it doesn't fix #11381. Fair enough. I am not currently up to untangling the NPC code that lets them ride in a vehicle enough to apply it to friendly monsters, though, so this is the work-around for now.

Repurposing this for vehicle racks: haha - wait, that might almost work.

So the monster capture routine works, in part, by grabbing the json description of the monster being captured and stashing it in the pet carrier, and then using that description to spawn a new monster with the exact same statistics when the pet carrier is emptied.

vehicles are described by json, there's no reason in principle that you couldn't do the same. Handling collisions would be challenging, but not impossible.

I want to do a rework of how actions are handled for vehicle parts in general, but it's possible that a vehicle rack could come out of that. Beyond the scope of this PR, though.

By the way, pallet lifters and telescopic cantilevers/telescoping cranes are foldable, you can build them on a folding frame with a unicycle wheel or castors and fold them up when not in use. The existing engine crane vehicle is exactly that design. So you don't need to rebuild a pallet lifter every time you want to scavenge a storage battery.

Still, it would be great to be able to transport ATVs on trucks and such.

@ZhilkinSerg ZhilkinSerg self-assigned this Jul 20, 2018
@ZhilkinSerg
Copy link
Contributor

Cannot capture friendly chicken

image

@ZhilkinSerg ZhilkinSerg removed their assignment Jul 20, 2018
@ZhilkinSerg ZhilkinSerg added [JSON] Changes (can be) made in JSON Vehicles Vehicles, parts, mechanics & interactions [C++] Changes (can be) made in C++. Previously named `Code` Items / Item Actions / Item Qualities Items and how they work and interact labels Jul 20, 2018
@mlangsdorf
Copy link
Contributor Author

You're selecting the tile with the chicken in it? Because you're clearly within the iuse::capture_monster_act code, so you're failing the check:

if( const monster *const mon_ptr = g->critter_at<monster>( target ) ) {

which means you're aiming it at nothing.

I'll look at it more on Monday, but that's a weird failure mode because it's failing within the part of the code that I didn't change.

@mlangsdorf
Copy link
Contributor Author

Okay, I summoned a chicken and fed it birdfood to make it friendly.
chicken1
I examined the tile on my vehicle with the livestock stall
chicken2
then I selected the tile to the east. Didn't capture the chicken. Repeated the process, but selected the tile to the NE. Captured the chicken, and can see I have a chicken in the livestock stall.
chicken3a
chicken3
then I examined the tile again and released the critter.
chicken4

So I really can't reproduce your failure and I suspect you selected the wrong tile in your test.

@AMurkin
Copy link
Contributor

AMurkin commented Jul 23, 2018

Suggestion: add option to transfer pet from/to regular pet carrier.

@ZhilkinSerg
Copy link
Contributor

So I really can't reproduce your failure and I suspect you selected the wrong tile in your test.

I guess I know what was wrong in my test - I've pressed key to select tile relative to vehicle part position instead of player position. Will try to test again tonight.

@mlangsdorf
Copy link
Contributor Author

Yes, it's position relative to the player. Thanks for the retest.

@ZhilkinSerg ZhilkinSerg self-assigned this Jul 23, 2018
@ZhilkinSerg ZhilkinSerg merged commit ce32af5 into CleverRaven:master Jul 23, 2018
@ZhilkinSerg ZhilkinSerg removed their assignment Jul 23, 2018
parts[part].set_base( base );
/* captured animals take up all the cargo space */
/*
if( base.has_var( "contained_name" ) ) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I guess this commented text should be deleted.

@@ -467,6 +467,7 @@ These branches are also the valid entries for the categories of `dreams` in `dre
- ```BOARDABLE``` The player can safely move over or stand on this part while the vehicle is moving.
- ```CAMERA```
- ```CAMERA_CONTROL```
- ```CAPTURE_MOSNTER_VEH``` Can be used to capture monsters when mounted on a vehicle.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Typo.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What's the typo? I'm not seeing it.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

MOSNTER

@mlangsdorf mlangsdorf deleted the veh_pet_carrier branch July 24, 2018 11:51
@mlangsdorf
Copy link
Contributor Author

@ZhilkinSerg #24462 expands the description of the livestock stall to make it clear you select the animal relative to the PC, not to the vehicle part.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
[C++] Changes (can be) made in C++. Previously named `Code` Items / Item Actions / Item Qualities Items and how they work and interact [JSON] Changes (can be) made in JSON Vehicles Vehicles, parts, mechanics & interactions
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants