Someone please make this happen. This is as far as I could get in the JSONs and ripping off stuff that I wanted to mimick:
comestibles.json
{
“type” : “COMESTIBLE”,
“id” : “tooth_paste”,
“name” : “tooth paste”,
“weight” : 1,
“color” : “green”,
“addiction_type” : “none”,
“spoils_in” : 0,
“use_action” : “brush_teeth”,
“stim” : 0,
“container” : “null”,
“to_hit” : 0,
“comestible_type” : “MED”,
“symbol” : “!”,
“quench” : 0,
“heal” : 0,
“addiction_potential” : 0,
“nutrition” : 0,
“description” : “Mostly water with an abrasive agent, fluoride, and detergent. This tube advertises it can make your teeth strong enough to eat other teeth.”,
“price” : 170,
“material” : “plastic”,
“tool” : “null”,
“volume” : 1,
“cutting” : 0,
“phase” : “solid”,
“charges” : 50,
“stack_size” : 100,
“bashing” : 0,
“fun” : 10
},
iuse.cpp
int iuse::brush_teeth(game *g, player *p, item *it, bool t) {
// Requires toothbrush and something to brush with.
bool alreadyBrushed = (p->has_disease(“clean_teeth”));
bool hasBrush = (p->has_amount(“brushing_apparatus”, 1));
bool canBrush = (hasBrush || p->has_charges(“tooth_paste”, 1));
if (!canBrush) {
g->add_msg_if_player(p,(“You haven’t got anything to brush with.”));
return 0;
} else if (!hasBrush && p->has_charges(“clean_water”, 1)) {
p->use_charges_if_avail(“tooth_paste”, 1);
}
if (p->use_charges_if_avail(“clean_water”, 1)) {
p->health += 4;
p->thirst += 1;
if (!alreadyBrushed) {
g->add_msg_if_player(p,(“You scrub the gunk off your teeth.”));
} else {
g->add_msg_if_player(p,(“You brush again and make sure to brush away from the gums.”));
}
p->add_disease(“clean_teeth”, 90);
} else {
g->add_msg_if_player(p,(“You need some clean water to rinse with.”));
return 0;
}
return it->type->charges_to_use();
}
player.cpp
int player::amount_of(itype_id it) {
if (it == “toolset” && has_bionic(“bio_tools”)) {
return 1;
}
if (it == “apparatus”) {
if (has_amount(“crackpipe”, 1) ||
has_amount(“can_drink”, 1) ||
has_amount(“pipe_glass”, 1) ||
has_amount(“pipe_tobacco”, 1)) {
return 1;
}
}
}
if (it == “brushing_apparatus”) {
if (has_amount(“tooth_brush”, 1)) {
return 1;
}
}
int quantity = 0;
tools.json
{
“id”: “tooth_brush”,
“type”: “TOOL”,
“symbol”: “;”,
“color”: “dark_gray”,
“name”: “tooth brush”,
“description”: “A plastic handle with nylon bristles bunched up on one end. Your teeth will thank you.”,
“price”: 800,
“material”: [“plastic”],
“weight”: 100,
“volume”: 1,
“bashing”: 1,
“cutting”: 0,
“to_hit”: -4,
“max_charges”: 0,
“initial_charges”: 0,
“charges_per_use”: 0,
“turns_per_charge”: 0,
“ammo”: “NULL”,
“revert_to”: “null”,
“use_action”: “brush_teeth”
},
item groups.json
},{
“type”:“item_group”,
“id”:“softdrugs”,
“items”:[
[“tooth_brush”, 50],
[“tooth_paste”, 50],
[“bandages”, 50],
[“1st_aid”, 35],
[“vitamins”, 75],
[“aspirin”, 85],
[“caffeine”, 25],
[“pills_sleep”, 15],
[“iodine”, 5],
[“dayquil”, 70],
[“nyquil”, 70],
[“disinfectant”, 35],
[“vaccine_shot”, 10],
[“protein_powder”, 15],
[“caff_gum”, 10],
[“nic_gum”, 25]
]
},{
iuse.h
int brush_teeth (game *g, player *p, item *it, bool t);