How to make comfortable furniture/terrain

I’m trying to add a new type of terrain that should be comfortable to sleep on but I can’t find how to do that.
When I look at the definition of f_sofa and f_bed I can’t find what makes them comfortable.

This C++ code in player.cpp:

    if(!plantsleep && (furn_at_pos == f_bed || furn_at_pos == f_makeshift_bed ||
         trap_at_pos.loadid == tr_cot || trap_at_pos.loadid == tr_rollmat ||
         trap_at_pos.loadid == tr_fur_rollmat || furn_at_pos == f_armchair ||
         furn_at_pos == f_sofa || furn_at_pos == f_autodoc_couch ||
         furn_at_pos == f_hay || furn_at_pos == f_straw_bed ||
         ter_at_pos == t_improvised_shelter || (in_shell) || (websleeping) ||
         vp.part_with_feature( "SEAT", true ) ||
         vp.part_with_feature( "BED", true ) ) ) {
        add_msg_if_player(m_good, _("This is a comfortable place to sleep."));

It really needs to get moved to a couple of JSON flags.


So i’d just need to add one || furn_at_pos == id_of_New_furniture to the code ?

EDIT : It’s done, hopefully it works and we’ll soon be able to hide in pillow forts


There are no flags in trap definitions though (and traps are horrible hardcoded instead of using tags/flags).

Any chance a chair could provide comfort instead of making it say we sleep on concrete floor.

So making the comfortable flag into a comfortable quality ?
1 for something flat and not too hard
2 for a normal bed
3 for really comfy stuff ?

Do we have an in between 4th option?

Between 1 and 2 seems room for a “Better than the floor” comfort. I can sit on a wood chair and it seems better than concrete. So I am not especially happy with it. But it isn’t a concrete floor.

It would make sense, but I don’t think that qualities are a thing outside crafting right now anyway.

So have three flags: comfy, comfier, comfiest. :grin:

Problem solved :

Make it so that comfort can be specified by a value in json.

1 Like