Skip to content

Commit

Permalink
Changes to Web Rope, Web Diver mutations and new Web Bridge mutation …
Browse files Browse the repository at this point in the history
…with supporting suspension mechanics. (cataclysmbnteam#1234)

* Changes to Web Rope and Web Diver mutations

changes to web rope and web diver to allow for more unique benefits for become a spoder.

* Added WEB BRIDGE MECHANICS and fixed some linting problems

Added a new mutation called Arachnitect, which lets you spin cool web bridges between ledges
Included a suspension mechanic to let you 'hang' tiles between other tiles, and get destroyed if they lose a logical support system.

linting changes.

* Double entry in the header file, whoops

* Removing the doubled function from the previous double header entry whoops

* Installed AStyle plugin, made changes to all the cpp files to match standard

* Never will the formatting changes end

* I guess we use two spaces after periods in json files.

* Update src/trapfunc.cpp

Co-authored-by: Olanti <[email protected]>

* Update src/iexamine.cpp

Co-authored-by: Olanti <[email protected]>

* Update map.cpp

* Review feedback changes.

* Un removing the things I just removed, because they broke my build when I removed them

* Added generic mutation usage functions,  switch rope climb to >, optimized t_web_bridge listings.

* switched ropes to no longer be grabbable, juggled mutation tree for Spiders to give them some more thematic negatives

* arachnitect point change

* increased kcal cost to reflect now defunct nutrition cost

* Review feedback

* Added a global suspension check just before floor cache is built.

* minor change to fix compile error

* minor style changes

* Added suspension checking on sublevel load, some other stuff

* Found hanging debug comment, and updated AStyle changes/

* Added killer drive as a possible mutation for Lupine, because that was failing for some reason.

* Removing unused code, updating function call in activate_mutation to use _warn

* Moved collapse check to a more optimal location

* removing unused var

* This shit is really just too picky

* Updating a stupid syntax problem for this needy clang tidy check

* Various bugfixes resulting from refactors

* Changing line spacing for STYLE

* Last changes at last :')

Co-authored-by: Olanti <[email protected]>
  • Loading branch information
acssimpson and olanti-p authored Jan 22, 2022
1 parent 785f2a9 commit d99ad58
Show file tree
Hide file tree
Showing 14 changed files with 308 additions and 56 deletions.
23 changes: 22 additions & 1 deletion data/json/furniture_and_terrain/furniture-tools.json
Original file line number Diff line number Diff line change
Expand Up @@ -1130,7 +1130,7 @@
"symbol": "<",
"color": "white",
"move_cost_mod": 1,
"required_str": 10,
"required_str": -1,
"flags": [ "LADDER", "TRANSPARENT", "SEEN_FROM_ABOVE" ],
"examine_action": "deployed_furniture",
"deployed_item": "grapnel",
Expand All @@ -1141,5 +1141,26 @@
"sound_fail": "whump.",
"items": [ { "item": "grip_hook", "count": [ 4, 4 ] }, { "item": "rope_30", "count": [ 1, 1 ] } ]
}
},
{
"type": "furniture",
"id": "f_rope_up_web",
"name": "web rope leading up",
"looks_like": "t_rope_up",
"description": "A web rope. You could climb it up.",
"symbol": "<",
"color": "white",
"move_cost_mod": 1,
"required_str": -1,
"flags": [ "LADDER", "TRANSPARENT", "SEEN_FROM_ABOVE" ],
"examine_action": "deployed_furniture",
"deployed_item": "rope_30",
"bash": {
"str_min": 3,
"str_max": 40,
"sound": "smash!",
"sound_fail": "whump.",
"items": [ { "item": "rope_30", "count": [ 1, 1 ] } ]
}
}
]
21 changes: 21 additions & 0 deletions data/json/furniture_and_terrain/terrain-roofs.json
Original file line number Diff line number Diff line change
Expand Up @@ -354,5 +354,26 @@
"ter_set": "t_open_air",
"bash_below": true
}
},
{
"type": "terrain",
"id": "t_web_bridge",
"name": "web bridge",
"description": "A hammock like bridge spun from spider silk.",
"symbol": "w",
"looks_like": "fd_web",
"color": "white",
"move_cost": 2,
"flags": [ "TRANSPARENT", "FLAT", "FLAMMABLE", "SUSPENDED", "COLLAPSES" ],
"bash": {
"str_min": 1,
"str_max": 6,
"sound": "rrrrip!",
"sound_fail": "slap!",
"sound_vol": 8,
"sound_fail_vol": 4,
"ter_set": "t_open_air",
"bash_below": true
}
}
]
27 changes: 20 additions & 7 deletions data/json/mutations/mutations.json
Original file line number Diff line number Diff line change
Expand Up @@ -559,6 +559,7 @@
"valid": false,
"social_modifiers": { "intimidate": 10 },
"prereqs": [ "PSYCHOPATH" ],
"category": [ "LUPINE" ],
"cancels": [ "PACIFIST" ],
"flags": [ "CANNIBAL" ]
},
Expand Down Expand Up @@ -3613,7 +3614,7 @@
"id": "WEB_RAPPEL",
"name": { "str": "Web Diver" },
"points": 1,
"description": "Your webbing is easily strong enough to support your weight. You'll use it to descend down any sheer drops you may encounter.",
"description": "Your webbing is easily strong enough to support your weight. You'll use it to descend down any sheer drops you may encounter, and to catch yourself should you fall.",
"prereqs": [ "WEB_WEAVER" ],
"threshreq": [ "THRESH_SPIDER" ],
"category": [ "SPIDER" ]
Expand All @@ -3623,7 +3624,7 @@
"id": "WEB_ROPE",
"name": { "str": "Rope Webs" },
"points": 2,
"description": "With spinnerets like THESE, who needs rope?! Activate to produce rope.",
"description": "With spinnerets like THESE, who needs rope?! Activate to sling a web rope that you can climb, and can be disassembled into rope.",
"prereqs": [ "WEB_WEAVER" ],
"threshreq": [ "THRESH_SPIDER" ],
"category": [ "SPIDER" ],
Expand All @@ -3633,6 +3634,19 @@
"thirst": true,
"spawn_item": { "type": "rope_30", "message": "You spin a rope from your silk." }
},
{
"type": "mutation",
"id": "WEB_BRIDGE",
"name": { "str": "Arachnitect" },
"points": 2,
"description": "The pinnacle of silk spinning. Spin suspended walkways between ledges to span small gaps.",
"prereqs": [ "WEB_ROPE" ],
"threshreq": [ "THRESH_SPIDER" ],
"category": [ "SPIDER" ],
"cost": 60,
"hunger": true,
"thirst": true
},
{
"type": "mutation",
"id": "WHISKERS",
Expand Down Expand Up @@ -4243,7 +4257,7 @@
"cancels": [ "PRETTY", "BEAUTIFUL", "BEAUTIFUL2", "BEAUTIFUL3" ],
"prereqs": [ "UGLY" ],
"changes_to": [ "DEFORMED2" ],
"category": [ "FISH", "CATTLE", "INSECT", "CEPHALOPOD", "FELINE", "LUPINE" ]
"category": [ "FISH", "CATTLE", "INSECT", "CEPHALOPOD", "FELINE", "LUPINE", "SPIDER" ]
},
{
"type": "mutation",
Expand Down Expand Up @@ -5168,7 +5182,7 @@
"description": "Your muscle response is dependent on ambient temperatures. You lose 1% of your speed for every 5 (2.8) degrees below 65 F (18.3 C). This sluggishness helps you conserve energy, however.",
"changes_to": [ "COLDBLOOD2" ],
"types": [ "METABOLISM" ],
"category": [ "FISH", "CEPHALOPOD", "SPIDER" ],
"category": [ "FISH", "CEPHALOPOD" ],
"temperature_speed_modifier": 0.2,
"metabolism_modifier": -0.333
},
Expand All @@ -5182,7 +5196,7 @@
"prereqs": [ "COLDBLOOD" ],
"changes_to": [ "COLDBLOOD3" ],
"types": [ "METABOLISM" ],
"category": [ "RAPTOR", "PLANT" ],
"category": [ "RAPTOR", "PLANT", "SPIDER" ],
"temperature_speed_modifier": 0.333,
"metabolism_modifier": -0.5
},
Expand Down Expand Up @@ -5244,7 +5258,7 @@
"mixed_effect": true,
"points": -1,
"description": "You hiss when speaking. Persuading NPCs will be more difficult, but threatening them will be easier.",
"category": [ "LIZARD", "RAPTOR" ],
"category": [ "LIZARD", "RAPTOR", "SPIDER" ],
"social_modifiers": { "persuade": -20, "lie": -10, "intimidate": 10 }
},
{
Expand Down Expand Up @@ -5306,7 +5320,6 @@
"types": [ "HANDS" ],
"changes_to": [ "INSECT_ARMS_OK", "ARACHNID_ARMS" ],
"prereqs": [ "CHITIN", "CHITIN2", "CHITIN3", "CHITIN_FUR2", "CHITIN_FUR3" ],
"prereqs2": [ "ANTENNAE" ],
"threshreq": [ "THRESH_INSECT", "THRESH_SPIDER" ],
"category": [ "INSECT", "SPIDER" ],
"restricts_gear": [ "torso" ],
Expand Down
3 changes: 3 additions & 0 deletions src/character.h
Original file line number Diff line number Diff line change
Expand Up @@ -760,6 +760,9 @@ class Character : public Creature, public visitable<Character>
void activate_mutation( const trait_id &mutation );
void deactivate_mutation( const trait_id &mut );

/** Removes the appropriate costs (NOTE: will reapply mods & recalc sightlines in case of newly activated mutation). */
void mutation_spend_resources( const trait_id &mut );

/** Converts a body_part to an hp_part */
static hp_part bp_to_hp( body_part bp );
/** Converts an hp_part to a body_part */
Expand Down
38 changes: 32 additions & 6 deletions src/game.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -113,6 +113,7 @@
#include "monstergenerator.h"
#include "morale_types.h"
#include "mtype.h"
#include "mutation.h"
#include "npc.h"
#include "npc_class.h"
#include "omdata.h"
Expand Down Expand Up @@ -246,6 +247,7 @@ static const trait_id trait_PARKOUR( "PARKOUR" );
static const trait_id trait_VINES2( "VINES2" );
static const trait_id trait_VINES3( "VINES3" );
static const trait_id trait_THICKSKIN( "THICKSKIN" );
static const trait_id trait_WEB_ROPE( "WEB_ROPE" );
static const trait_id trait_WAYFARER( "WAYFARER" );

static const trap_str_id tr_unfinished_construction( "tr_unfinished_construction" );
Expand Down Expand Up @@ -10399,12 +10401,6 @@ void game::vertical_move( int movez, bool force, bool peeking )
return;
}

const int cost = u.climbing_cost( u.pos(), stairs );
if( cost == 0 ) {
add_msg( m_info, _( "You can't climb here - you need walls and/or furniture to brace against." ) );
return;
}

std::vector<tripoint> pts;
for( const auto &pt : m.points_in_radius( stairs, 1 ) ) {
if( m.passable( pt ) &&
Expand All @@ -10413,6 +10409,36 @@ void game::vertical_move( int movez, bool force, bool peeking )
}
}

const int cost = u.climbing_cost( u.pos(), stairs );

if( cost == 0 ) {
if( u.has_trait( trait_WEB_ROPE ) ) {
if( pts.empty() ) {
add_msg( m_info, _( "There is nothing above you that you can attach a web to." ) );
} else if( can_use_mutation_warn( trait_WEB_ROPE, u ) ) {
if( g->m.move_cost( u.pos() ) != 2 && g->m.move_cost( u.pos() ) != 3 ) {
add_msg( m_info, _( "You can't spin a web rope there." ) );
} else if( g->m.has_furn( u.pos() ) ) {
add_msg( m_info, _( "There is already furniture at that location." ) );
} else {
if( query_yn( "Spin a rope and climb?" ) ) {
add_msg( m_good, _( "You spin a rope of web." ) );
g->m.furn_set( u.pos(), furn_str_id( "f_rope_up_web" ) );
u.mod_moves( to_turns<int>( 2_seconds ) );
u.mutation_spend_resources( trait_WEB_ROPE );
vertical_move( movez, force, peeking );
}
}
}

} else {
add_msg( m_info, _( "You can't climb here - you need walls and/or furniture to brace against." ) );

}
return;

}

if( cost <= 0 || pts.empty() ) {
add_msg( m_info,
_( "You can't climb here - there is no terrain above you that would support your weight." ) );
Expand Down
36 changes: 36 additions & 0 deletions src/iexamine.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,7 @@
#include "mission_companion.h"
#include "monster.h"
#include "mtype.h"
#include "mutation.h"
#include "npc.h"
#include "options.h"
#include "output.h"
Expand Down Expand Up @@ -163,6 +164,7 @@ static const skill_id skill_mechanics( "mechanics" );
static const skill_id skill_survival( "survival" );

static const ter_str_id t_dimensional_portal( "t_dimensional_portal" );
static const ter_str_id t_web_bridge( "t_web_bridge" );

static const trait_id trait_AMORPHOUS( "AMORPHOUS" );
static const trait_id trait_ARACHNID_ARMS_OK( "ARACHNID_ARMS_OK" );
Expand All @@ -181,6 +183,7 @@ static const trait_id trait_PARKOUR( "PARKOUR" );
static const trait_id trait_PROBOSCIS( "PROBOSCIS" );
static const trait_id trait_THRESH_MARLOSS( "THRESH_MARLOSS" );
static const trait_id trait_THRESH_MYCUS( "THRESH_MYCUS" );
static const trait_id trait_WEB_BRDIGE( "WEB_BRIDGE" );

static const quality_id qual_ANESTHESIA( "ANESTHESIA" );
static const quality_id qual_DIG( "DIG" );
Expand Down Expand Up @@ -4342,6 +4345,9 @@ void iexamine::ledge( player &p, const tripoint &examp )
cmenu.text = _( "There is a ledge here. What do you want to do?" );
cmenu.addentry( 1, true, 'j', _( "Jump over." ) );
cmenu.addentry( 2, true, 'c', _( "Climb down." ) );
if( p.has_trait( trait_WEB_BRDIGE ) ) {
cmenu.addentry( 3, true, 'w', _( "Spin Web Bridge." ) );
}

cmenu.query();

Expand Down Expand Up @@ -4426,6 +4432,36 @@ void iexamine::ledge( player &p, const tripoint &examp )
g->m.creature_on_trap( p );
break;
}
case 3: {

if( !can_use_mutation_warn( trait_WEB_BRDIGE, p ) ) {
break;
}
const int range = 6; //this means we could web across a gap of 5.
int success_range = 0;
bool success = false;
for( int i = 2; i <= range; i++ ) {
//break at the first non empty space encountered
if( g->m.ter( tripoint( p.posx() + i * sgn( examp.x - p.posx() ),
p.posy() + i * sgn( examp.y - p.posy() ), p.posz() ) ) != t_open_air ) {
success_range = i;
success = true;
break;
}
}
if( !success ) {
p.add_msg_if_player( _( "There is nothing for your to attach your web to!" ) );
} else {
for( int i = 1; i < success_range; i++ ) {
tripoint dest( p.posx() + i * sgn( examp.x - p.posx() ), p.posy() + i * sgn( examp.y - p.posy() ),
p.posz() );

g->m.ter_set( dest, t_web_bridge );
}
p.mutation_spend_resources( trait_WEB_BRDIGE );
}
break;
}
default:
popup( _( "You decided to step back from the ledge." ) );
break;
Expand Down
Loading

0 comments on commit d99ad58

Please sign in to comment.