Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Some factions claim only one OMT #77428

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions data/json/npcs/factions.json
Original file line number Diff line number Diff line change
Expand Up @@ -874,6 +874,7 @@
"likes_u": 30,
"respects_u": 20,
"known_by_u": false,
"limited_area_claim": true,
"size": 1,
"power": 1,
"currency": "fur",
Expand Down
1 change: 1 addition & 0 deletions data/mods/DinoMod/NPC/NC_BO_BARONYX.json
Original file line number Diff line number Diff line change
Expand Up @@ -281,6 +281,7 @@
"likes_u": 30,
"respects_u": 20,
"known_by_u": false,
"limited_area_claim": true,
"size": 25,
"power": 20,
"currency": "icon",
Expand Down
2 changes: 2 additions & 0 deletions data/mods/Magiclysm/npc/factions.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
"likes_u": 0,
"respects_u": 0,
"known_by_u": false,
"limited_area_claim": true,
"size": 5,
"power": 100,
"//": "90 days worth of food for 1 person, at 3000kcal/day and full RDA of iron/calcium/vitC",
Expand Down Expand Up @@ -68,6 +69,7 @@
"likes_u": 10,
"respects_u": 10,
"known_by_u": false,
"limited_area_claim": true,
"size": 50,
"power": 50,
"//": "90 days worth of food for 1 person, at 3000kcal/day and full RDA of iron/calcium/vitC",
Expand Down
2 changes: 2 additions & 0 deletions doc/FACTIONS.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ An NPC faction looks like this:
"fac_food_supply": { "calories": 115200, "vitamins": { "iron": 800, "calcium": 800, "vitC": 600 } },
"consumes_food": true,
"lone_wolf_faction": true,
"limited_area_claim": false,
"wealth": 75000000,
"currency": "FMCNote",
"price_rules": [
Expand Down Expand Up @@ -77,6 +78,7 @@ Field | Meaning
`"relations"` | dictionary, a description of how the faction sees other factions. See below
`"mon_faction"` | string, optional. The monster faction `"name"` of the monster faction that this faction counts as. Defaults to "human" if unspecified.
`"lone_wolf_faction"` | bool, optional. This is a proto/micro faction template that is used to generate 1-person factions for dynamically spawned NPCs, defaults to "false" if unspecified.
`"limited_area_claim"`| bool, optional. Default false. Whether or not camps owned by this faction 'claim' the entire reality bubble and will be angered by hostile player actions in that area. If true, they only claim the specific OMT the camp is located on.
`"description"` | string, optional. The player's description of this faction as seen in the faction menu.
`"epilogues"` | array of objects, optional. Requires these objects: `power_min` - minimal faction power for epilogue to appear, `power_max` - maximum faction power for epilogue to appear, `id` - id of text snippet containing text of epilogue.

Expand Down
3 changes: 3 additions & 0 deletions src/faction.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,7 @@ faction_template::faction_template()
size = 0;
power = 0;
lone_wolf_faction = false;
limited_area_claim = false;
currency = itype_id::NULL_ID();
}

Expand Down Expand Up @@ -142,6 +143,7 @@ faction_template::faction_template( const JsonObject &jsobj )
currency = itype_id::NULL_ID();
}
lone_wolf_faction = jsobj.get_bool( "lone_wolf_faction", false );
limited_area_claim = jsobj.get_bool( "limited_area_claim", false );
load_relations( jsobj );
mon_faction = mfaction_str_id( jsobj.get_string( "mon_faction", "human" ) );
optional( jsobj, false, "epilogues", epilogue_data );
Expand Down Expand Up @@ -558,6 +560,7 @@ faction *faction_manager::get( const faction_id &id, const bool complain )
elem.second.currency = fac_temp.currency;
elem.second.price_rules = fac_temp.price_rules;
elem.second.lone_wolf_faction = fac_temp.lone_wolf_faction;
elem.second.limited_area_claim = fac_temp.limited_area_claim;
elem.second.name = fac_temp.name;
elem.second.desc = fac_temp.desc;
elem.second.mon_faction = fac_temp.mon_faction;
Expand Down
1 change: 1 addition & 0 deletions src/faction.h
Original file line number Diff line number Diff line change
Expand Up @@ -142,6 +142,7 @@ class faction_template
bool consumes_food; //Whether this faction actually draws down the food_supply when eating from it
int wealth; //Total trade currency
bool lone_wolf_faction; // is this a faction for just one person?
bool limited_area_claim;
itype_id currency; // id of the faction currency
std::vector<faction_price_rule> price_rules; // additional pricing rules
std::map<std::string, std::bitset<npc_factions::rel_types>> relations;
Expand Down
4 changes: 4 additions & 0 deletions src/game.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -6092,6 +6092,10 @@ bool game::warn_player_maybe_anger_local_faction( bool really_bad_offense,
return true; // Nobody to piss off
}
basecamp *actual_camp = *bcp;
if( actual_camp->get_owner()->limited_area_claim &&
player_character.global_omt_location() != actual_camp->camp_omt_pos() ) {
return true; // outside of claimed area
}
if( actual_camp->allowed_access_by( player_character, asking_for_public_goods ) ) {
return true; // You're allowed to do this anyway
}
Expand Down
Loading