Help me tweak grappling hook: retrieve it after climbing up

So yea, the grappling hooks again. The way I understand it, currently they are pretty useless, also the implementation is strange. So I wanted to to make it even stranger :slight_smile:

This is how I was imagining it: you climb up on the deployed grappling hook (which, as I understood, is a “furniture” with the t_rope_up ID), and after that it just “magically” appears in your inventory, or under your feet, if it’s full (or maybe in your hands?). The deployed t_rope_up disappears, of course. There are no additional menus or prompts asking you anything, the annoying “do you want to use your grappling hook?” when you try to climb down is already enough.

But staring at the code for some time made me understand that it will take too much of my time to figure it out, so HELP! Whoever has good understanding of the code, please point me into the right direction. So far I came up with these:

  1. game.cpp: game::vertical_move() at the end of function, before calling cata_event_dispatch::avatar_moves( old_abs_pos, u, m ); maybe check if your old position had a t_rope_up on it, then call here.ter_set(t_none) or something like that, then try adding the item to your inventory. Here is where I gave up, no idea about the inventory.

  2. maybe it is possible to un-deploy the t_rope_up, but IDK if it works across z-levels, then again, it would add another prompt/menu, which I really don’t need. But I could live with that, if it comes to this.

  3. if the feature turns out interesting or useful enough, it could become a PR

oh, it’s actually here.furn_set( pos, f_null );

item itm(m.furn(u.pos()).obj().deployed_item, calendar::turn, 1);
u.i_add_or_drop(itm);

I don’t think it’s possible to get the exact same item back but you can spawn a new one with that. You may need to add null checks. You can also call(or copy the relevant code if you don’t want the query) iexamine::deployed_furniture which is the same as if you had (e)xamined it.

You could just add “climb up” in the grappling hook use menu that would just teleport you up after 1 minute. Ditto for “climb down”. This does not need any messing with furniture.