Skip to content

Commit

Permalink
Merge pull request #6 from daftfad/master
Browse files Browse the repository at this point in the history
Mops can cleanup liquids
  • Loading branch information
TheDarklingWolf committed Jan 15, 2013
2 parents 8d5be56 + fc5d784 commit cd4f2b7
Show file tree
Hide file tree
Showing 6 changed files with 51 additions and 8 deletions.
4 changes: 2 additions & 2 deletions itype.h
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ itm_wrapper, itm_syringe, itm_rag, itm_fur, itm_leather, itm_superglue,
itm_rope_6, itm_rope_30, itm_chain, itm_processor, itm_RAM, itm_power_supply,
itm_amplifier, itm_transponder, itm_receiver, itm_antenna, itm_steel_chunk,
itm_steel_lump, itm_scrap, itm_hose, itm_glass_sheet, itm_manhole_cover, itm_rock,
itm_stick, itm_broom, itm_mop,
itm_stick, itm_broom,
itm_hammer_sledge, itm_hatchet, itm_nailboard, itm_nailbat,
itm_xacto, itm_scalpel, itm_pot, itm_pan, itm_knife_butter, itm_2x4, itm_muffler,
itm_pipe, itm_bat, itm_bat_metal,
Expand Down Expand Up @@ -201,7 +201,7 @@ itm_lighter, itm_sewing_kit, itm_scissors, itm_hammer, itm_extinguisher,
itm_knife_butcher, itm_knife_combat, itm_saw, itm_ax, itm_hacksaw,
itm_tent_kit, itm_torch, itm_torch_lit, itm_candle, itm_candle_lit,
itm_brazier, itm_puller, itm_press, itm_screwdriver, itm_wrench,
itm_boltcutters,
itm_boltcutters, itm_mop,
// Bionics containers
itm_bionics_battery, itm_bionics_power, itm_bionics_tools,
itm_bionics_neuro, itm_bionics_sensory, itm_bionics_aquatic,
Expand Down
10 changes: 5 additions & 5 deletions itypedef.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -796,11 +796,6 @@ MELEE("broom", 30, 24, '/', c_blue, PLASTIC,MNULL,
A long-handled broom. Makes a terrible weapon unless you're chasing cats.");
TECH( mfb(TEC_WBLOCK_1) );

MELEE("mop", 20, 28, '/', c_ltblue, PLASTIC,MNULL,
11, 12, 5, 0, -2, 0, "\
An unwieldy mop. Essentially useless.");
TECH( mfb(TEC_WBLOCK_1) );

MELEE("sledge hammer", 6, 120,'/', c_brown, WOOD, IRON,
18, 38, 40, 0, 0, 0, "\
A large, heavy hammer. Makes a good melee weapon for the very strong, but is\n\
Expand Down Expand Up @@ -3390,6 +3385,11 @@ TOOL("radio (on)", 0, 420,';', c_yellow, PLASTIC, IRON,
This radio is turned on, and continually draining its batteries. It is\n\
playing the broadcast being sent from any nearby radio towers.");

TOOL("mop", 30, 24, '/', c_blue, PLASTIC, MNULL,
10, 8, 6, 0, 1, 0, 0, 0, 0, AT_NULL, itm_null, &iuse::mop, 0, "\
An unwieldy mop. Good for cleaning up spills.");
TECH( mfb(TEC_WBLOCK_1) );

TOOL("crowbar", 18, 130,';', c_ltblue, IRON, MNULL,
4, 9, 16, 3, 2, 0, 0, 0, 0, AT_NULL, itm_null, &iuse::crowbar, 0,"\
A prying tool. Use it to open locked doors without destroying them, or to\n\
Expand Down
22 changes: 21 additions & 1 deletion iuse.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1578,6 +1578,7 @@ void iuse::can_goo(game *g, player *p, item *it, bool t)
}
}


void iuse::pipebomb(game *g, player *p, item *it, bool t)
{
if (!p->has_charges(itm_lighter, 1)) {
Expand Down Expand Up @@ -2823,7 +2824,26 @@ void iuse::boltcutters(game *g, player *p, item *it, bool t)
}
}


void iuse::mop(game *g, player *p, item *it, bool t)
{
int dirx, diry;
g->draw();
mvprintw(0, 0, "Mop where?");
get_direction(g, dirx, diry, input());
if (dirx == -2) {
g->add_msg_if_player(p,"Invalid direction.");
return;
}
p->moves -= 15;
dirx += p->posx;
diry += p->posy;
if (g->m.moppable_items_at(dirx, diry)) {
g->m.mop_spills(dirx, diry);
} else {
g->add_msg_if_player(p,"There's nothing to mop there.");
}
}


/* MACGUFFIN FUNCTIONS
* These functions should refer to it->associated_mission for the particulars
Expand Down
1 change: 1 addition & 0 deletions iuse.h
Original file line number Diff line number Diff line change
Expand Up @@ -117,6 +117,7 @@ class iuse
void screwdriver (game *g, player *p, item *it, bool t);
void wrench (game *g, player *p, item *it, bool t);
void boltcutters (game *g, player *p, item *it, bool t);
void mop (game *g, player *p, item *it, bool t);
// MACGUFFINS
void mcg_note (game *g, player *p, item *it, bool t);
// ARTIFACTS
Expand Down
20 changes: 20 additions & 0 deletions map.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -790,6 +790,16 @@ bool map::flammable_items_at(int x, int y)
return false;
}

bool map::moppable_items_at(int x, int y)
{
for (int i = 0; i < i_at(x, y).size(); i++) {
item *it = &(i_at(x, y)[i]);
if (it->made_of(LIQUID))
return true;
}
return false;
}

point map::random_outdoor_tile()
{
std::vector<point> options;
Expand Down Expand Up @@ -820,6 +830,16 @@ bool map::has_adjacent_furniture(int x, int y)
return false;
}

void map::mop_spills(int x, int y) {
for (int i = 0; i < i_at(x, y).size(); i++) {
item *it = &(i_at(x, y)[i]);
if (it->made_of(LIQUID)) {
i_rem(x, y, i);
i--;
}
}
}

bool map::bash(int x, int y, int str, std::string &sound, int *res)
{
sound = "";
Expand Down
2 changes: 2 additions & 0 deletions map.h
Original file line number Diff line number Diff line change
Expand Up @@ -111,6 +111,7 @@ class map
bool is_destructable_ter_only(int x, int y); // only checks terrain
bool is_outside(int x, int y);
bool flammable_items_at(int x, int y);
bool moppable_items_at(int x, int y);
point random_outdoor_tile();

void translate(ter_id from, ter_id to); // Change all instances of $from->$to
Expand All @@ -123,6 +124,7 @@ class map
bool hit_with_acid(game *g, int x, int y);
void marlossify(int x, int y);
bool has_adjacent_furniture(int x, int y);
void mop_spills(int x, int y);

// Radiation
int& radiation(int x, int y); // Amount of radiation at (x, y);
Expand Down

0 comments on commit cd4f2b7

Please sign in to comment.