Skip to content

Commit

Permalink
Merge pull request #1 from CleverRaven/master
Browse files Browse the repository at this point in the history
PR to update my branch
  • Loading branch information
Zaweri committed Nov 25, 2013
2 parents f8dd64b + 457dadc commit 2e8efc3
Show file tree
Hide file tree
Showing 14 changed files with 326 additions and 78 deletions.
12 changes: 10 additions & 2 deletions data/json/item_groups.json
Original file line number Diff line number Diff line change
Expand Up @@ -516,6 +516,8 @@
["binoculars", 20],
["duct_tape", 70],
["lawnmower", 25],
["floodlight", 10],
["minifridge", 5],
["char_smoker", 25],
["lawn_dart", 10],
["dehydrator", 15],
Expand Down Expand Up @@ -730,7 +732,7 @@
["smrifle_primer", 10],
["lgrifle_primer", 10],
["lead", 10],
["solder", 10],
["solder_wire", 10],
["tin", 10],
["bismuth", 10],
["puller", 5],
Expand Down Expand Up @@ -1286,6 +1288,8 @@
["duct_tape", 60],
["jerrycan", 10],
["lawnmower", 25],
["floodlight", 20],
["minifridge", 10],
["char_smoker", 25],
["dehydrator", 15],
["foot_crank", 10],
Expand Down Expand Up @@ -1387,7 +1391,9 @@
["mag_fabrication", 12],
["duct_tape", 60],
["lawnmower", 25],
["boltcutters", 5],
["floodlight", 10],
["minifridge", 5],
["boltcutters", 8],
["foot_crank", 10],
["cable", 60],
["textbook_mechanics", 12],
Expand Down Expand Up @@ -3105,6 +3111,8 @@
["tent_kit", 17],
["bat_metal", 60],
["lawnmower", 25],
["floodlight", 20],
["minifridge", 20],
["char_smoker", 25],
["lawn_dart", 10],
["dehydrator", 15],
Expand Down
2 changes: 1 addition & 1 deletion data/json/items/melee.json
Original file line number Diff line number Diff line change
Expand Up @@ -1745,7 +1745,7 @@
"name" : "pipe",
"description" : "A steel pipe, makes a good melee weapon. Useful in a few crafting recipes.",
"weight" : 1262,
"to_hit" : 3,
"to_hit" : 1,
"color" : "dark_gray",
"symbol" : "/",
"material" : ["steel", "null"],
Expand Down
8 changes: 4 additions & 4 deletions data/json/items/ranged.json
Original file line number Diff line number Diff line change
Expand Up @@ -2865,7 +2865,7 @@
"durability": 6,
"burst": 0,
"clip_size": 1,
"reload": 450
"reload": 1000
},
{
"id": "pistol_flint",
Expand All @@ -2885,11 +2885,11 @@
"to_hit": -1,
"ranged_damage": -2,
"range": 3,
"dispersion": 14,
"recoil": 5,
"dispersion": 21,
"recoil": 8,
"durability": 6,
"burst": 0,
"clip_size": 1,
"reload": 350
"reload": 800
}
]
17 changes: 16 additions & 1 deletion data/json/items/vehicle_parts.json
Original file line number Diff line number Diff line change
Expand Up @@ -260,7 +260,7 @@
"type": "GENERIC",
"id": "minifridge",
"name": "minifridge",
"description": "A very small fridge for keeping food cool, but without electricity it's just a very heavy box with shelves inside.",
"description": "A very small fridge for keeping food cool.",
"weight": 31752,
"to_hit": -8,
"color": "light_blue",
Expand Down Expand Up @@ -466,5 +466,20 @@
"bashing": 1,
"cutting": 0,
"price": 400
},
{
"type":"GENERIC",
"id": "floodlight",
"name": "floodlight",
"description": "A large and heavy light designed to illuminate wide areas.",
"weight": 2500,
"to_hit": 1,
"color": "white",
"symbol": ";",
"material": ["iron", "plastic"],
"volume": 8,
"bashing": 5,
"cutting": 0,
"price": 900
}
]
45 changes: 42 additions & 3 deletions data/json/recipes/recipes.json
Original file line number Diff line number Diff line change
Expand Up @@ -7791,7 +7791,7 @@
"tools": [
[
[ "hotplate", 8],
[ "char_smoke", 1],
[ "char_smoker", 1],
[ "toolset", 1],
[ "fire", -1]
],
Expand Down Expand Up @@ -9957,6 +9957,29 @@
[ "cable", 10 ]
]
]
},{
"type" : "recipe",
"result": "floodlight",
"category": "CC_ELECTRONIC",
"skill_used": "mechanics",
"skills_required": [ "electronics", 1 ],
"difficulty": 2,
"time": 15000,
"reversible": true,
"decomp_learn": 0,
"autolearn": true,
"components": [
[
[ "amplifier", 4 ]
],
[
[ "steel_chunk", 2 ],
[ "scrap", 6 ]
],
[
[ "cable", 10 ]
]
]
},{
"type" : "recipe",
"result": "soldering_iron",
Expand Down Expand Up @@ -21950,6 +21973,9 @@
"time": 20000,
"reversible": false,
"autolearn": true,
"qualities":[
{"id":"CUT","level":1,"amount":1}
],
"tools": [
[
[ "press", -1 ]
Expand All @@ -21975,7 +22001,8 @@
[
[ "money_bundle", 1 ],
[ "wrapper", 1],
[ "bag_plastic", 1 ]
[ "bag_plastic", 1 ],
[ "paper", 25 ]
]
]
},{
Expand All @@ -21988,6 +22015,9 @@
"time": 12000,
"reversible": true,
"autolearn": true,
"qualities":[
{"id":"CUT","level":1,"amount":1}
],
"tools": [
[
[ "hacksaw", -1 ],
Expand All @@ -22003,7 +22033,10 @@
[ "pipe", 1 ]
],
[
[ "2x4", 1 ]
[ "2x4", 2 ]
],
[
[ "rag", 1 ]
],
[
[ "scrap", 1 ]
Expand All @@ -22020,6 +22053,9 @@
"time": 12000,
"reversible": true,
"autolearn": true,
"qualities":[
{"id":"CUT","level":1,"amount":1}
],
"tools": [
[
[ "hacksaw", -1 ],
Expand All @@ -22037,6 +22073,9 @@
[
[ "2x4", 1 ]
],
[
[ "rag", 1 ]
],
[
[ "scrap", 1 ]
]
Expand Down
25 changes: 23 additions & 2 deletions data/json/vehicle_parts.json
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@
"durability": 20,
"item": "veh_tracker",
"difficulty": 3,
"power": 6,
"power": 1,
"flags": [
"TRACK", "UNMOUNT_ON_DAMAGE"
],
Expand Down Expand Up @@ -1241,11 +1241,12 @@
"broken_color" : "light_blue",
"damage_modifier" : 80,
"durability" : 100,
"power" : 4,
"size" : 400,
"item" : "minifridge",
"difficulty" : 3,
"location" : "center",
"flags" : ["CARGO", "OBSTACLE"],
"flags" : ["CARGO", "OBSTACLE", "FRIDGE"],
"breaks_into" : [
{"item": "steel_lump", "min": 8, "max": 13},
{"item": "steel_chunk", "min": 8, "max": 13},
Expand Down Expand Up @@ -1880,5 +1881,25 @@
{"item": "steel_chunk", "min": 0, "max": 1},
{"item": "scrap", "min": 1, "max": 1}
]
},{
"type" : "vehicle_part",
"id" : "floodlight",
"name" : "floodlight",
"symbol" : "*",
"color" : "white",
"broken_symbol" : "-",
"broken_color" : "dark_blue",
"damage_modifier" : 10,
"durability" : 20,
"power" : 3,
"bonus" : 600,
"item" : "floodlight",
"difficulty" : 1,
"location" : "on_roof",
"flags" : ["CIRCLE_LIGHT"],
"breaks_into" : [
{"item": "steel_chunk", "min": 0, "max": 2},
{"item": "scrap", "min": 1, "max": 2}
]
}
]
18 changes: 16 additions & 2 deletions src/item.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -180,6 +180,7 @@ void item::init() {
mission_id = -1;
player_id = -1;
light = nolight;
fridge = 0;
}

void item::make(itype* it)
Expand Down Expand Up @@ -872,7 +873,7 @@ std::string item::tname(game *g)
if (food != NULL && g != NULL && food->has_flag("HOT"))
ret << _(" (hot)");
if (food != NULL && g != NULL && food_type->spoils != 0 &&
int(g->turn) - (int)(food->bday) > food_type->spoils * 600)
rotten(g))
ret << _(" (rotten)");

if (has_flag("FIT")) {
Expand Down Expand Up @@ -1143,10 +1144,23 @@ int item::has_gunmod(itype_id mod_type)

bool item::rotten(game *g)
{
int expiry;
if (!is_food() || g == NULL)
return false;
it_comest* food = dynamic_cast<it_comest*>(type);
return (food->spoils != 0 && int(g->turn) - (int)bday > food->spoils * 600);
if (food->spoils != 0) {
it_comest* food = dynamic_cast<it_comest*>(type);
if (fridge > 0) {
// Add the number of turns we should get from refrigeration
bday += ((int)g->turn - fridge) * 0.8;
fridge = 0;
}
expiry = (int)g->turn - bday;
return (expiry > food->spoils * 600);
}
else {
return false;
}
}

bool item::ready_to_revive(game *g)
Expand Down
7 changes: 4 additions & 3 deletions src/item.h
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ struct iteminfo{
std::string sPlus; //number +
bool bNewLine; //New line at the end
bool bLowerIsBetter; //Lower values are better (red <-> green)

//Inputs are: ItemType, main text, text between main text and value, value, if the value should be an int instead of a double, text after number, if there should be a newline after this item, if lower values are better
iteminfo(std::string sIn0, std::string sIn1, std::string sIn2 = "", double dIn0 = -999, bool bIn0 = true, std::string sIn3 = "", bool bIn1 = true, bool bIn2 = false) {
sType = sIn0;
Expand All @@ -56,7 +56,7 @@ struct iteminfo{
}
};

enum LIQUID_FILL_ERROR {L_ERR_NONE, L_ERR_NO_MIX, L_ERR_NOT_CONTAINER, L_ERR_NOT_WATERTIGHT,
enum LIQUID_FILL_ERROR {L_ERR_NONE, L_ERR_NO_MIX, L_ERR_NOT_CONTAINER, L_ERR_NOT_WATERTIGHT,
L_ERR_NOT_SEALED, L_ERR_FULL};

class item : public JsonSerializer, public JsonDeserializer
Expand Down Expand Up @@ -190,7 +190,7 @@ class item : public JsonSerializer, public JsonDeserializer
bool is_container() const;
bool is_watertight_container() const;
int is_funnel_container(int bigger_than) const;

bool is_tool() const;
bool is_software() const;
bool is_macguffin() const;
Expand All @@ -214,6 +214,7 @@ class item : public JsonSerializer, public JsonDeserializer
char invlet; // Inventory letter
int charges;
bool active; // If true, it has active effects to be processed
int fridge; // The turn we entered a fridge.
signed char damage; // How much damage it's sustained; generally, max is 5
int burnt; // How badly we're burnt
int bday; // The turn on which it was created
Expand Down
11 changes: 10 additions & 1 deletion src/map.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -417,6 +417,7 @@ void map::vehmove(game *g)
vehicle* veh = vehs[v].v;
veh->gain_moves (abs (veh->velocity));
veh->power_parts();
veh->idle();
}
}

Expand Down Expand Up @@ -2410,6 +2411,7 @@ void map::process_active_items_in_submap(game *g, const int nonant)

void map::process_active_items_in_vehicles(game *g, const int nonant)
{
item *it;
std::vector<vehicle*> *vehicles = &(grid[nonant]->vehicles);
for (int v = vehicles->size() - 1; v >= 0; v--) {
vehicle *next_vehicle = (*vehicles)[v];
Expand All @@ -2420,7 +2422,14 @@ void map::process_active_items_in_vehicles(game *g, const int nonant)
int mapx = next_vehicle->posx + next_vehicle->parts[*part_index].precalc_dx[0];
int mapy = next_vehicle->posy + next_vehicle->parts[*part_index].precalc_dy[0];
for(int n = items_in_part->size() - 1; n >= 0; n--) {
if(process_active_item(g, &((*items_in_part)[n]), nonant, mapx, mapy)) {
it = &((*items_in_part)[n]);
// Check if it's in a fridge and is food.
if (it->is_food() && next_vehicle->part_flag(*part_index, "FRIDGE") &&
next_vehicle->fridge_on && it->fridge == 0) {
it->fridge = (int)g->turn;
it->item_counter -= 10;
}
if(process_active_item(g, it, nonant, mapx, mapy)) {
next_vehicle->remove_item(*part_index, n);
}
}
Expand Down
2 changes: 1 addition & 1 deletion src/player.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -7049,7 +7049,7 @@ bool player::wear_item(game *g, item *to_wear, bool interactive)
}
return false;
}

if (armor->covers & mfb(bp_head) && has_trait("HORNS_CURLED"))
{
if(interactive)
Expand Down
Loading

0 comments on commit 2e8efc3

Please sign in to comment.