A wearable towel

For having a reference to Hitchhiker’s Guide to the Galaxy, the towel has remarkably few uses, I decided to make it wearable like a bandana/scarf.
The stats I’ve used are entirely impulsive but I figured I’d post the changes I made to get it to work here if anybody wanted to do a PR for a more realistic version.

I’ve not yet done anything in Github at all and I’ve sort of polluted my personal version with a ton of random changes, so I’ve posted this here for lack of knowing what else to do with it.

EDIT: I’ve changed it so the towel has a menu, you can use it to dry off, wear it on the head, mouth, or torso, the values are still a bit arbitrary at the moment if anybody has some suggestions.
A quick test after compiling it seems to have no issues, but I didn’t really do any rigorous testing.

I’ll look into making it work as improvised bedding and see if I can figure out how to do a PR on github, some advice in that direction would be helpful.

[spoiler=player.cpp]Starting at line 6413 I replaced the code with this:
if(it->type->id == “towel_wet”)
it->make(itypes[“towel”]);
if(it->type->id == “towel_wet_head”)
it->make(itypes[“towel_head”]);
if(it->type->id == “towel_wet_torso”)
it->make(itypes[“towel_torso”]);

Inserted the following into a newline at 8775:
used->type->use == &iuse::towel ||
[/spoiler]

int iuse::towel(player *p, item *it, bool)
{
bool towelUsed = false;
int choice = -1;
int pos = p->get_item_position(it);
item& ait = p->i_at(pos);
choice = menu(true, _(“Do what with the towel?:”), _(“Dry Off”), _(“Wear on Head”), _(“Wear over Mouth”), _(“Wear on Torso”), _(“Use as bedding”), _(“Cancel”), NULL);

if( choice < 0 || choice == 6){
    g->add_msg_if_player(p, _("Never mind."));
    return 0;
}
else if(choice == 1)
    // can't use an already wet towel!
    if( it->has_flag("WET") ) {
        g->add_msg_if_player(p,_("That %s is too wet to soak up any more liquid!"), it->name.c_str());
    }
    // dry off from being wet
    else if( abs(p->has_morale(MORALE_WET)) ){
        p->rem_morale(MORALE_WET);
        g->add_msg_if_player(p,_("You use the %s to dry off, saturating it with water!"), it->name.c_str());
        towelUsed = true;
        it->item_counter = 300;
    }
    // clean off slime
    else if( p->has_disease("slimed") ){
        p->rem_disease("slimed");
        g->add_msg_if_player(p,_("You use the %s to clean yourself off, saturating it with slime!"), it->name.c_str());
        towelUsed = true;
        it->item_counter = 450; // slime takes a bit longer to dry
    }
    // default message
    else {
        g->add_msg_if_player(p,_("You are already dry, the %s does nothing."), it->name.c_str());
    }
else if(choice == 2){
    if(it->type->id == "towel" || "towel_torso"){
        it->make(itypes["towel_head"]);
        p->inv.assign_empty_invlet(ait,true);
        if(!(p->is_wearing("towel_head"))){
            p->wear(pos);
        }
        towelUsed = true;
    }
    else if(it->type->id == "towel_wet" || "towel_torso_wet"){
        it->make(itypes["towel_head_wet"]);
        p->inv.assign_empty_invlet(ait,true);
        if(!(p->is_wearing("towel_head"))){
            p->wear(pos);
        }
        towelUsed = true;
    }
    else if(it->type->id == "towel_head" || "towel_wet_head"){
        p->inv.assign_empty_invlet(ait,true);
        if(!(p->is_wearing("towel_head") || p->is_wearing("towel_wet_head"))){
            p->wear(pos);
        }
        towelUsed = true;
    }
    else
        return 0;
}
else if(choice == 3){
    if(it->type->id == "towel_head" || "towel_torso"){
        it->make(itypes["towel"]);
        p->inv.assign_empty_invlet(ait,true);
        if(!(p->is_wearing("towel"))){
            p->wear(pos);
        }
        towelUsed = true;
    }
    else if(it->type->id == "towel_wet_head" || "towel_wet_torso"){
        it->make(itypes["towel_wet"]);
        p->inv.assign_empty_invlet(ait,true);
        if(!(p->is_wearing("towel_wet"))){
            p->wear(pos);
        }
        towelUsed = true;
    }
    else if(it->type->id == "towel" || "towel_wet"){
        p->inv.assign_empty_invlet(ait,true);
        if(!(p->is_wearing("towel") || p->is_wearing("towel_wet"))){
            p->wear(pos);
        }
        towelUsed = true;
    }
    else
        return 0;
}
else if(choice == 4){
    if(it->type->id == "towel" || "towel_head"){
        it->make(itypes["towel_torso"]);
        p->inv.assign_empty_invlet(ait,true);
        if(!(p->is_wearing("towel_torso"))){
            p->wear(pos);
        }
        towelUsed = true;
    }
    else if(it->type->id == "towel_wet" || "towel_wet_head"){
        it->make(itypes["towel_wet_torso"]);
        p->inv.assign_empty_invlet(ait,true);
        if(!(p->is_wearing("towel_torso") || p->is_wearing("towel_wet_torso"))){
            p->wear(pos);
        }
        towelUsed = true;
    }
    else if(it->type->id == "towel_torso" || "towel_wet_torso"){
        p->inv.assign_empty_invlet(ait,true);
        if(!(p->is_wearing("towel_torso"))){
            p->wear(pos);
        }
        towelUsed = true;
    }
    else
        return 0;
}
else if(choice == 5){
    g->add_msg_if_player(p,_("Not Yet Available"));
    return 0;
}
else
    g->add_msg_if_player(p,_("What have you done??"));

// towel was used
if(towelUsed)
{
    p->moves -= 50;
    // change "towel" to a "towel_wet" (different flavor text/color)
    if(it->type->id == "towel")
        it->make(itypes["towel_wet"]);
    else if(it->type->id == "towel_head")
        it->make(itypes["towel_wet_head"]);
    else if(it->type->id == "towel_torso")
        it->make(itypes["towel_wet_torso"]);
    // WET, active items have their timer decremented every turn
    it->item_tags.erase("ABSORBENT");
    it->item_tags.insert("WET");
    it->active = true;
}
return it->type->charges_to_use();

}

In data/json/items/, I removed the towel from tools.json and added the following to tool_armor.json:
{
“type” : “ARMOR”,
“id” : “towel”,
“name” : “towel”,
“weight” : 370,
“volume” : 2,
“price” : 4500,
“symbol” : “,”,
“color” : “cyan”,
“description” : “This is a fluffy and large towel. It could be used to dry yourself. Any person that can travel the length and breadth of the apocalypse, rough it, slum it, struggle against terrible odds, win through and still know where their towel is, is clearly a force to be reckoned with.”,
“to_hit” : -1,
“storage” : 0,
“material” : “cotton”,
“covers” : [“MOUTH”],
“coverage” : 95,
“enviromental_protection” : 2,
“cutting” : 0,
“bashing” : 0,
“warmth” : 10,
“phase” : “solid”,
“encumbrance” : 1,
“material_thickness” : 1,
“flags” : [“ABSORBENT”],
“max_charge” : 0,
“charges_per_use” : 0,
“turns_per_charge” : 5,
“ammo” : “NULL”,
“revert_to” : “NULL”,
“use_action” : “TOWEL”
},
{
“type” : “ARMOR”,
“id” : “towel_head”,
“name” : “towel”,
“weight” : 370,
“volume” : 2,
“price” : 4500,
“symbol” : “,”,
“color” : “cyan”,
“description” : “This is a fluffy and large towel. It could be used to dry yourself. Any person that can travel the length and breadth of the apocalypse, rough it, slum it, struggle against terrible odds, win through and still know where their towel is, is clearly a force to be reckoned with.”,
“to_hit” : -1,
“storage” : 0,
“material” : “cotton”,
“covers” : [“HEAD”],
“coverage” : 80,
“enviromental_protection” : 0,
“cutting” : 0,
“bashing” : 0,
“warmth” : 10,
“phase” : “solid”,
“encumbrance” : 1,
“material_thickness” : 1,
“flags” : [“ABSORBENT”],
“max_charge” : 0,
“charges_per_use” : 0,
“turns_per_charge” : 5,
“ammo” : “NULL”,
“revert_to” : “NULL”,
“use_action” : “TOWEL”
},
{
“type” : “ARMOR”,
“id” : “towel_torso”,
“name” : “towel”,
“weight” : 370,
“volume” : 2,
“price” : 4500,
“symbol” : “,”,
“color” : “cyan”,
“description” : “This is a fluffy and large towel. It could be used to dry yourself. Any person that can travel the length and breadth of the apocalypse, rough it, slum it, struggle against terrible odds, win through and still know where their towel is, is clearly a force to be reckoned with.”,
“to_hit” : -1,
“storage” : 0,
“material” : “cotton”,
“covers” : [“TORSO”],
“coverage” : 55,
“enviromental_protection” : 0,
“cutting” : 0,
“bashing” : 0,
“warmth” : 10,
“phase” : “solid”,
“encumbrance” : 1,
“material_thickness” : 1,
“flags” : [“ABSORBENT”],
“max_charge” : 0,
“charges_per_use” : 0,
“turns_per_charge” : 5,
“ammo” : “NULL”,
“revert_to” : “NULL”,
“use_action” : “TOWEL”
},
{
“type” : “ARMOR”,
“id” : “towel_wet”,
“name” : “towel”,
“weight” : 400,
“volume” : 2,
“price” : 4500,
“symbol” : “,”,
“color” : “blue”,
“description” : “This is a large, sopping wet towel. If you wait a little bit, it should dry out. Don’t panic.”,
“to_hit” : 1,
“storage” : 0,
“material” : “cotton”,
“covers” : [“MOUTH”],
“coverage” : 95,
“enviromental_protection” : 0,
“cutting” : 0,
“bashing” : 0,
“warmth” : 0,
“phase” : “solid”,
“encumbrance” : 1,
“material_thickness” : 1,
“flags” : [“WET”],
“max_charge” : 0,
“charges_per_use” : 0,
“turns_per_charge” : 5,
“ammo” : “NULL”,
“revert_to” : “NULL”,
“use_action” : “TOWEL”
},
{
“type” : “ARMOR”,
“id” : “towel_wet_head”,
“name” : “towel”,
“weight” : 400,
“volume” : 2,
“price” : 4500,
“symbol” : “,”,
“color” : “blue”,
“description” : “This is a large, sopping wet towel. If you wait a little bit, it should dry out. Don’t panic.”,
“to_hit” : 1,
“storage” : 0,
“material” : “cotton”,
“covers” : [“HEAD”],
“coverage” : 80,
“enviromental_protection” : 0,
“cutting” : 0,
“bashing” : 0,
“warmth” : 0,
“phase” : “solid”,
“encumbrance” : 1,
“material_thickness” : 1,
“flags” : [“WET”],
“max_charge” : 0,
“charges_per_use” : 0,
“turns_per_charge” : 5,
“ammo” : “NULL”,
“revert_to” : “NULL”,
“use_action” : “TOWEL”
},
{
“type” : “ARMOR”,
“id” : “towel_wet_torso”,
“name” : “towel”,
“weight” : 400,
“volume” : 2,
“price” : 4500,
“symbol” : “,”,
“color” : “blue”,
“description” : “This is a large, sopping wet towel. If you wait a little bit, it should dry out. Don’t panic.”,
“to_hit” : 1,
“storage” : 0,
“material” : “cotton”,
“covers” : [“TORSO”],
“coverage” : 55,
“enviromental_protection” : 0,
“cutting” : 0,
“bashing” : 0,
“warmth” : 0,
“phase” : “solid”,
“encumbrance” : 1,
“material_thickness” : 1,
“flags” : [“WET”],
“max_charge” : 0,
“charges_per_use” : 0,
“turns_per_charge” : 5,
“ammo” : “NULL”,
“revert_to” : “NULL”,
“use_action” : “TOWEL”
},

You would probably want to move it into the tool_armor class as well then, instead of the armor one.

You’re probably right, I used the weapon-sheathing equipment as a guideline, and those are all in the armor.json for some reason.

Would it be possible to combine knife multiple 'a’pplication code and rollmat moving bed code to be able to wear it, dry off with it, and use it as a really really cruddy bed?

A good idea, but I figured it would be the kind of thing you’d wrap around your torso (give the shower victim profession SOME survivability :-P) and might be worth it in a tight spot for the warmth

It might take a bit of time, I figure you should be able to wear it as a hat or toga as well as over the mouth, using it as a bed might take a bit more work as I haven’t done anything with traps yet.

In the meanwhile, what else could a towel be used for?

towel fighting style for towels?

I’ve updated the original post with the first set of changes, I’ll work on how to get it to work as improvised bedding some other time, anybody have a link to a tutorial on how to use github or should I just start flailing about the internet on my own?

Github has a startup walkthrough on github.com. It’s OK but feel free to ask on the IRC if you’ve specific questions.

The DDA starter page has some specific guidance. In particular, we really do use that “upstream” thing, and jump back to your master and make a new branch for each set of changes. (In general, if you want to do a lot of things that all hit the same file, do them in the same PR. That way we don’t have to manually reconcile your work with itself.)

Because watching the show arrow, and random ninjas descending on ropes. I suggest that towels should also double as “Long ropes” for falling down pits.

Anyone else wear their towel like a cape after you’re drying off from a shower and pretend you’re a ninja? No? Okay…]
But perhaps make a towel-cape from 1 towel and a nail to hold it together. Because you can superhero.

Nowhere near 30 feet long. Nope.

As for towel capes, why? You can make an actual cloak in-game! :smiley:

Someone said Ninja?

Yeah, making towels a less-effective rollmat is also a good call.
[hr]

[size=24pt]!

KA101 makes a radio call

The Ninja! He’s here! Send reinforcements!

Towel-equipped capture teams flood the room…

TOWEL ROPE!

Love the idea!

actually, if the towel was wet, perhaps it could have a negative bonus to heat retention, making you feel cooler.
Equip it while dry and you stay a little warm.
Equip it while wet, and you feel a little cooler while in the god-awful heat of the summer.

Doesn’t putting clothes on the floor already do this?

[size=24pt]!

KA101 makes a radio call

The Ninja! He’s here! Send reinforcements!

Towel-equipped capture teams flood the room…[/quote]

Teleports away laughing

Nowhere near 30 feet long. Nope.

As for towel capes, why? You can make an actual cloak in-game! :-D[/quote]

Although it isn’t the most intelligent of ideas; it would save time resources. However, you would look like a complete prat, and it wouldn’t be as good as a proper cloak (obviously.) I’m just all for adding more crude styled early game items into the game. Screw it, I might just learn how to make mods x)

Also, I’m all for towel fighting styles. Because SWEET MOTHER OF PEARL it hurts when someone whips you with a towel correctly. Who knows, we could have the next Indiana Jones with his towel-cape, towel-rope and trusty towel-whip. F**k it lets make everything with towels.