Skip to content

Commit

Permalink
Mergorama.
Browse files Browse the repository at this point in the history
Conflicts:
	bionics.cpp
  • Loading branch information
kevingranade committed Jun 27, 2013
10 parents 5dc2f67 + b8f57d9 + b6beaa3 + 42dcb1b + 8531e11 + fc8b817 + a510ada + 8f439ac + bb25beb + c63088f commit 4fc91e9
Show file tree
Hide file tree
Showing 32 changed files with 855 additions and 351 deletions.
106 changes: 106 additions & 0 deletions MODDING.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,106 @@
MODDING

Certain features of the game can be modified without rebuilding the game from
source code; you should be able to just modify the pertinent files and run the
game to see your changes. This attempts to document these features.

1.1 Adding a profession.

The data on professions is contained in data/raw/professions.json
The format of the file follows:
[
{
"ident" : "example", <-- This is a unique string that identifies the
profession; it is used internally by the game as
opposed to in the user interface.
"name": "Example Profession", <-- This is the name that will be displayed
on the user interface; this is
what you actually "see" in-game.
"description": "An example profession.", <-- This field contains the
description of the profession
that will be displayed in the
character creation screen.

"points" : 0, <-- This value describes the point cost of the profession;
note that negative numbers are accecptable. A positive
value will deduct points from the players total whereas
a negative one will give the player creation points.
"items": ["jeans", "tshirt", "sneakers"], <-- This list contains the items
a character will start with
if they choose this
profession.
"addictions" : [ <-- This is the OPTIONAL list of starting addictions.
{
"type": "nicotine", <-- The identifier of the addiction.
"intensity" : 10, <-- The intensity of the addiction.
}
],
"skills" : [ <-- This list is also OPTIONAL; it contains the starting
skills and their modified levels.
{
"name": "melee", <-- The identifier of the skill that will be modified.
"level" : 1 <-- The value that the skill will be modified; note that
this is NOT the starting level of the skill. It is
the value that the player's starting level will be
modified by. In other words, if the player puts 1
point into melee to give themselves level 2 melee,
taking this profession would add one additional level
resulting in level 3.
},
{
"name" : "dodge",
"level" : 1
}, <-- It is possible to list multiple skills for a single profession;
it's an unused feature in the current game.

]

},
]
1.2 Example of adding a profession.

Let's say we want to add a survivalist profession; this profession represents a
character who was already living off the land before the disaster struck. We'll
say this profession starts with archery, survival, traps, beef jerky
and a few survival items. We'll set the starting cost at 3 points since
it modifies skills and items. We could do that with the
following entries:
{
"ident" : "survivalist"
"name": "Wilderness Survivalist",
"description": "You live off the wild and wander the world; you've never
had\na place to live or items other than what you can
scavenge off the land. People called you crazy; now,
after the disaster, you're the sane one."

"points" : 3,
"items": ["pants_cargo", "boots", "beltrig", "selfbow", "jerky", "arrow_field_point"],

"skills" : [
{
"name": "archery",
"level" : 1
},
{
"name" : "survival",
"level" : 1
},
{
"name" : "traps",
"level" : 1
}
]
},

After adding this to the professions.json file, we should see the new profession
show up in the character creation screen.

1.3 IMPORTANT NOTE on JSON FILES:
The following characters: [ { , } ] : "
are *very* important when adding or modifying the JSON files for technical
reasons. This means a single missing , or [ or } can be the difference between
a working file and a hanging game at startup. Many editors have features
that let you track { [ and ] } to see if they're balanced (ie, have a matching
opposite); Notepad++ is a popular, free editor on Windows that contains
this feature. On Linux, there are a plethora of options, and you probably
already have a preferred one :-).
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@
# WARNINGS will spam hundreds of warnings, mostly safe, if turned on
# DEBUG is best turned on if you plan to debug in gdb -- please do!
# PROFILE is for use with gprof or a similar program -- don't bother generally
WARNINGS = -Wall -Wextra -Wno-switch -Wno-sign-compare -Wno-missing-braces -Wno-unused-parameter -Wno-psabi
WARNINGS = -Wall -Wextra -Wno-switch -Wno-sign-compare -Wno-missing-braces -Wno-unused-parameter
# Uncomment below to disable warnings
#WARNINGS = -w
DEBUG = -g
Expand Down
32 changes: 4 additions & 28 deletions bionics.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -221,6 +221,9 @@ void player::activate_bionic(int b, game *g)
pkill = pain;
} else if (bio.id == "bio_nanobots"){
healall(4);
} else if (bio.id == "bio_night"){
if (g->turn % 5)
g->add_msg("Artificial night generator active!");
} else if (bio.id == "bio_resonator"){
g->sound(posx, posy, 30, "VRRRRMP!");
for (int i = posx - 1; i <= posx + 1; i++) {
Expand Down Expand Up @@ -500,35 +503,8 @@ void player::activate_bionic(int b, game *g)
} else
g->add_msg("You can't unlock that %s.", g->m.tername(dirx, diry).c_str());
} else if(bio.id == "bio_flashbang") {
int blind_duration = 0;
int blind_intensity = 0;
int deaf_duration = 0;
int deaf_intensity = 0;
if (disease_level(DI_BLIND))
{
// remember our blind/deaf status
blind_duration = disease_level(DI_BLIND);
blind_intensity = disease_intensity(DI_BLIND);
}
if (disease_level(DI_DEAF))
{
deaf_duration = disease_level(DI_DEAF);
deaf_intensity = disease_intensity(DI_DEAF);
}
g->add_msg("You activate your integrated flashbang generator!");
g->flashbang(posx, posy);
// clear blind/deaf because CBM flashbang shouldn't affect the player
rem_disease(DI_BLIND);
rem_disease(DI_DEAF);
if (blind_duration)
{
//restore our blind/deaf status
add_disease(DI_BLIND, blind_duration, g, blind_intensity, blind_intensity);
}
if (deaf_duration)
{
add_disease(DI_DEAF, deaf_duration, g, deaf_intensity, deaf_intensity);
}
g->flashbang(posx, posy, true);
} else if(bio.id == "bio_shockwave") {
g->shockwave(posx, posy, 3, 4, 2, 8, true);
g->add_msg("You unleash a powerful shockwave!");
Expand Down
28 changes: 22 additions & 6 deletions construction.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -69,12 +69,19 @@ void game::init_construction()
TOOLCONT("primitive_axe");
TOOLCONT("chainsaw_on");

CONSTRUCT("Chop Up Log", 0, &construct::able_log, &construct::done_log);
CONSTRUCT("Chop Tree trunk into logs", 0, &construct::able_trunk, &construct::done_trunk_log);
STAGE(t_dirt, 20);
TOOL("ax");
TOOLCONT("primitive_axe");
TOOLCONT("chainsaw_on");

CONSTRUCT("Chop Tree trunk into planks", 0, &construct::able_trunk, &construct::done_trunk_plank);
STAGE(t_dirt, 23);
TOOL("ax");
TOOLCONT("primitive_axe");
TOOLCONT("chainsaw_on");
TOOLCONT("saw");

CONSTRUCT("Move Furniture", -1, &construct::able_furniture, &construct::done_furniture);
STAGE(t_null, 1);

Expand Down Expand Up @@ -853,9 +860,9 @@ bool construct::able_tree(game *g, point p)
return (g->m.ter(p.x, p.y) == t_tree);
}

bool construct::able_log(game *g, point p)
bool construct::able_trunk(game *g, point p)
{
return (g->m.ter(p.x, p.y) == t_log);
return (g->m.ter(p.x, p.y) == t_trunk);
}

bool construct::able_furniture(game *g, point p)
Expand Down Expand Up @@ -1015,13 +1022,22 @@ void construct::done_tree(game *g, point p)
std::vector<point> tree = line_to(p.x, p.y, x, y, rng(1, 8));
for (int i = 0; i < tree.size(); i++) {
g->m.destroy(g, tree[i].x, tree[i].y, true);
g->m.ter_set(tree[i].x, tree[i].y, t_log);
g->m.ter_set(tree[i].x, tree[i].y, t_trunk);
}
}

void construct::done_log(game *g, point p)
void construct::done_trunk_log(game *g, point p)
{
g->m.spawn_item(p.x, p.y, "log", int(g->turn), rng(5, 15));
g->m.spawn_item(p.x, p.y, "log", int(g->turn), rng(5, 15));
}

void construct::done_trunk_plank(game *g, point p)
{
int num_logs = rng(5, 15);
for( int i = 0; i < num_logs; ++i ) {
item tmplog(g->itypes["log"], int(g->turn), g->nextinv);
iuse::cut_log_into_planks( g, &(g->u), &tmplog);
}
}


Expand Down
5 changes: 3 additions & 2 deletions construction.h
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ struct construct // Construction functions.
bool able_pit(game *, point); // Able only on pits

bool able_tree(game *, point); // Able on trees
bool able_log(game *, point); // Able on logs
bool able_trunk(game *, point); // Able on tree trunks

bool able_furniture(game *, point); // Able on furniture

Expand All @@ -69,7 +69,8 @@ struct construct // Construction functions.
void done_window_pane(game *, point);
void done_vehicle(game *, point);
void done_tree(game *, point);
void done_log(game *, point);
void done_trunk_log(game *, point);
void done_trunk_plank(game *, point);
void done_furniture(game *, point);
void done_tape(game *, point);
void done_deconstruct(game *, point);
Expand Down
10 changes: 5 additions & 5 deletions crafting.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1122,11 +1122,11 @@ void game::complete_craft()
if (iter == inv_chars.size() || u.volume_carried()+newit.volume() > u.volume_capacity()) {
add_msg("There's no room in your inventory for the %s, so you drop it.",
newit.tname().c_str());
m.add_item(u.posx, u.posy, newit);
m.add_item(u.posx, u.posy, newit, MAX_ITEM_IN_SQUARE);
} else if (u.weight_carried() + newit.volume() > u.weight_capacity()) {
add_msg("The %s is too heavy to carry, so you drop it.",
newit.tname().c_str());
m.add_item(u.posx, u.posy, newit);
m.add_item(u.posx, u.posy, newit, MAX_ITEM_IN_SQUARE);
} else {
newit = u.i_add(newit);
add_msg("%c - %s", newit.invlet, newit.tname().c_str());
Expand Down Expand Up @@ -1505,7 +1505,7 @@ void game::complete_disassemble()
if (ammodrop.made_of(LIQUID))
handle_liquid(ammodrop, false, false);
else
m.add_item(u.posx, u.posy, ammodrop);
m.add_item(u.posx, u.posy, ammodrop, MAX_ITEM_IN_SQUARE);
}
if (dis_item->is_tool() && dis_item->charges > 0 && dis_item->ammo_type() != AT_NULL)
{
Expand All @@ -1515,7 +1515,7 @@ void game::complete_disassemble()
if (ammodrop.made_of(LIQUID))
handle_liquid(ammodrop, false, false);
else
m.add_item(u.posx, u.posy, ammodrop);
m.add_item(u.posx, u.posy, ammodrop, MAX_ITEM_IN_SQUARE);
}
u.i_rem(u.activity.values[0]); // remove the item

Expand Down Expand Up @@ -1572,7 +1572,7 @@ void game::complete_disassemble()
} else
{
if (dis->difficulty == 0 || comp_success)
m.add_item(u.posx, u.posy, newit);
m.add_item(u.posx, u.posy, newit, MAX_ITEM_IN_SQUARE);
else
add_msg("You fail to recover a component.");
compcount--;
Expand Down
8 changes: 8 additions & 0 deletions data/raw/bionics.json
Original file line number Diff line number Diff line change
Expand Up @@ -484,6 +484,14 @@
"flags" : ["ACTIVE"],
"description": "Your body is equipped with a chain lightning generator, allowing you to\n emit a blast of lightning at a target, leaving a trail of lightning in\n its wake, jumping to additional targets within 4 tiles of the previous target."
},
{
"id" : "bio_night",
"name" : "Artificial Night Generator",
"cost" : 1,
"time" : 2,
"flags" : ["ACTIVE"],
"description": "Destructive interference eliminates all light within a 15 tile radius."
},
{
"id" : "bio_dis_shock",
"name" : "Electrical Discharge",
Expand Down
73 changes: 60 additions & 13 deletions data/raw/items/tools.json
Original file line number Diff line number Diff line change
Expand Up @@ -2051,27 +2051,74 @@
},

{
"id": "tazer",
"id": "adv_UPS_off",
"type": "TOOL",
"symbol": ";",
"color": "light_red",
"name": "tazer",
"description": "A high-powered stun gun. Use this item to attempt to electrocute an adjacent enemy, damaging and temporarily paralyzing them. Because the shock can actually jump through the air, it is difficult to miss.",
"color": "light_green",
"name": "advanced UPS (off)",
"description": "An advanced version of the unified power supply, or UPS. This device has been significantly redesigned to provide better effeciency as well as to consume plutonium fuel cells rather than batteries.",
"rarity": 3,
"price": 1400,
"material": ["iron", "plastic"],
"weight": 3,
"volume": 1,
"bashing": 6,
"price": 5600,
"material": ["steel", "plastic"],
"weight": 4,
"volume": 8,
"bashing": 10,
"cutting": 0,
"to_hit": -1,
"max_charges": 500,
"max_charges": 2500,
"initial_charges": 0,
"charges_per_use": 100,
"charges_per_use": 0,
"turns_per_charge": 0,
"ammo": "battery",
"ammo": "plutonium",
"revert_to": "null",
"use_action": "TAZER"
"use_action": "adv_UPS_OFF"
},
{
"id" : "adv_UPS_on",
"type" : "TOOL",
"symbol" : ";",
"color" : "light_green",
"name" : "advanced UPS (on)",
"description" : "An advanced version of the unified power supply, or UPS. This device has been significantly redesigned to provide better effeciency as well as to consume plutonium fuel cells rather than batteries.",
"rarity" : 0,
"price" : 5600,
"material" : ["steel", "plastic"],
"weight" : 4,
"volume" : 8,
"bashing" : 10,
"cutting" : 0,
"to_hit" : -1,
"max_charges" : 2500,
"initial_charges" : 0,
"charges_per_use" : 0,
"turns_per_charge" : 50,
"ammo" : "plutonium",
"revert_to" : "adv_UPS_off",
"use_action" : "adv_UPS_ON"
},

{
"id" : "tazer",
"type" : "TOOL",
"symbol" : ";",
"color" : "light_red",
"name" : "tazer",
"description" : "A high-powered stun gun. Use this item to attempt to electrocute an adjacent enemy, damaging and temporarily paralyzing them. Because the shock can actually jump through the air, it is difficult to miss.",
"rarity" : 3,
"price" : 1400,
"material" : ["iron", "plastic"],
"weight" : 3,
"volume" : 1,
"bashing" : 6,
"cutting" : 0,
"to_hit" : -1,
"max_charges" : 500,
"initial_charges" : 0,
"charges_per_use" : 100,
"turns_per_charge" : 0,
"ammo" : "battery",
"revert_to" : "null",
"use_action" : "TAZER"
},

{
Expand Down
Loading

0 comments on commit 4fc91e9

Please sign in to comment.