Skip to content

Commit 588ea97

Browse files
chaosvoltscarf005
andauthored
The Mech Update (cataclysmbn#2829)
* The Mech Update * Finish the JSON bits * Updates to open and close behavior * Fixes * Update turret.json * Update game.cpp * Update data/json/items/generic.json Co-authored-by: scarf <greenscarf005@gmail.com> * Make the salvaged lasers still at least lighter than the rebuilt ones --------- Co-authored-by: scarf <greenscarf005@gmail.com>
1 parent 15a099f commit 588ea97

File tree

10 files changed

+176
-11
lines changed

10 files changed

+176
-11
lines changed

data/json/items/generic.json

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2666,6 +2666,30 @@
26662666
"volume": "750 ml",
26672667
"category": "spare_parts"
26682668
},
2669+
{
2670+
"id": "gatling_mech_laser_salvaged",
2671+
"copy-from": "cerberus_laser",
2672+
"looks_like": "gatling_mech_laser",
2673+
"type": "GENERIC",
2674+
"color": "blue",
2675+
"name": { "str": "salvaged CMES gatling laser" },
2676+
"description": "A rapid-fire weapon system stripped from a wrecked combat exoskeleton. No longer usable as a weapon in its current condition.",
2677+
"material": [ "superalloy", "plastic" ],
2678+
"weight": "39 kg",
2679+
"volume": "11 L"
2680+
},
2681+
{
2682+
"id": "recon_mech_laser_salvaged",
2683+
"copy-from": "cerberus_laser",
2684+
"looks_like": "recon_mech_laser",
2685+
"type": "GENERIC",
2686+
"color": "blue",
2687+
"name": { "str": "salvaged RMES marksman laser" },
2688+
"description": "A long-range weapon system stripped from a wrecked recon exoskeleton. No longer usable as a weapon in its current condition.",
2689+
"material": [ "superalloy", "plastic" ],
2690+
"weight": "12 kg",
2691+
"volume": "5500 ml"
2692+
},
26692693
{
26702694
"id": "light_bulb",
26712695
"type": "GENERIC",

data/json/items/gun/ups.json

Lines changed: 29 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -44,14 +44,26 @@
4444
"material": [ "superalloy", "plastic" ],
4545
"color": "blue",
4646
"range": 30,
47-
"ranged_damage": { "damage_type": "heat", "amount": 20, "armor_penetration": 4 },
47+
"ranged_damage": { "damage_type": "heat", "amount": 40, "armor_penetration": 5 },
4848
"dispersion": 100,
4949
"loudness": 12,
50-
"ups_charges": 20,
51-
"modes": [ [ "DEFAULT", "3 rd.", 3 ], [ "BURST", "5 rd.", 5 ], [ "AUTO", "high auto", 15 ] ],
50+
"ups_charges": 50,
51+
"modes": [ [ "DEFAULT", "semi", 1 ], [ "BURST", "burst", 5 ], [ "AUTO", "auto", 10 ] ],
5252
"ammo_effects": [ "LASER", "PLASMA_BUBBLE", "INCENDIARY" ],
5353
"extend": { "flags": [ "NO_UNWIELD", "NO_SALVAGE", "NO_REPAIR", "UNBREAKABLE_MELEE" ] }
5454
},
55+
{
56+
"id": "gatling_mech_laser_rebuilt",
57+
"copy-from": "gatling_mech_laser",
58+
"type": "GUN",
59+
"name": { "str": "rebuilt CMES gatling laser" },
60+
"description": "A rapid-fire weapon system stripped from a combat mech, modified for handheld use. While less efficient and too bulky to fire without proper support, its rotating-barrel laser system can still spray death downrange with ease.",
61+
"weight": "40 kg",
62+
"dispersion": 200,
63+
"ups_charges": 80,
64+
"extend": { "flags": [ "MOUNTED_GUN" ] },
65+
"delete": { "flags": [ "NO_UNWIELD", "NO_SALVAGE", "NO_REPAIR", "UNBREAKABLE_MELEE" ] }
66+
},
5567
{
5668
"id": "recon_mech_laser",
5769
"copy-from": "rifle_energy",
@@ -68,13 +80,25 @@
6880
"material": [ "superalloy", "plastic" ],
6981
"color": "blue",
7082
"range": 45,
71-
"ranged_damage": { "damage_type": "heat", "amount": 30, "armor_penetration": 4 },
83+
"ranged_damage": { "damage_type": "heat", "amount": 80, "armor_penetration": 10 },
7284
"dispersion": 15,
7385
"loudness": 1,
74-
"ups_charges": 50,
86+
"ups_charges": 100,
7587
"ammo_effects": [ "LASER", "PLASMA_BUBBLE", "INCENDIARY" ],
7688
"extend": { "flags": [ "NO_UNWIELD", "NO_REPAIR", "NO_SALVAGE", "UNBREAKABLE_MELEE" ] }
7789
},
90+
{
91+
"id": "recon_mech_laser_rebuilt",
92+
"copy-from": "recon_mech_laser",
93+
"type": "GUN",
94+
"name": { "str": "rebuilt RMES marksman laser" },
95+
"description": "A long-range weapon system stripped from a recon mech, modified for handheld use. While less efficient and too bulky to fire without proper support, it's still a quiet and relatively accurate marksman laser rifle.",
96+
"weight": "13 kg",
97+
"dispersion": 30,
98+
"ups_charges": 160,
99+
"extend": { "flags": [ "MOUNTED_GUN" ] },
100+
"delete": { "flags": [ "NO_UNWIELD", "NO_REPAIR", "NO_SALVAGE", "UNBREAKABLE_MELEE" ] }
101+
},
78102
{
79103
"id": "laser_cannon",
80104
"copy-from": "rifle_energy",

data/json/monsters/mechsuits.json

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,7 @@
4343
"NOHEAD",
4444
"NO_BREATHE",
4545
"RIDEABLE_MECH",
46+
"MECH_DEFENSIVE",
4647
"PRIORITIZE_TARGETS",
4748
"PATH_AVOID_DANGER_2"
4849
]
@@ -91,6 +92,7 @@
9192
"NOHEAD",
9293
"NO_BREATHE",
9394
"RIDEABLE_MECH",
95+
"MECH_DEFENSIVE",
9496
"PRIORITIZE_TARGETS",
9597
"PATH_AVOID_DANGER_2",
9698
"LOUDMOVES"

data/json/recipes/weapon/ranged.json

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -738,6 +738,34 @@
738738
"qualities": [ { "id": "SAW_M_FINE", "level": 1 }, { "id": "SCREW_FINE", "level": 1 } ],
739739
"components": [ [ [ "cerberus_laser", 1 ] ], [ [ "battery_ups", 1 ] ], [ [ "cable", 15 ] ] ]
740740
},
741+
{
742+
"type": "recipe",
743+
"result": "gatling_mech_laser_rebuilt",
744+
"category": "CC_WEAPON",
745+
"subcategory": "CSC_WEAPON_RANGED",
746+
"skill_used": "electronics",
747+
"skills_required": [ [ "fabrication", 5 ], [ "gun", 1 ] ],
748+
"difficulty": 7,
749+
"time": "30 m",
750+
"autolearn": true,
751+
"using": [ [ "welding_standard", 5 ], [ "steel_tiny", 2 ] ],
752+
"qualities": [ { "id": "SAW_M_FINE", "level": 1 }, { "id": "SCREW_FINE", "level": 1 } ],
753+
"components": [ [ [ "gatling_mech_laser_salvaged", 1 ] ], [ [ "battery_ups", 1 ] ], [ [ "cable", 25 ] ] ]
754+
},
755+
{
756+
"type": "recipe",
757+
"result": "gatling_mech_laser_rebuilt",
758+
"category": "CC_WEAPON",
759+
"subcategory": "CSC_WEAPON_RANGED",
760+
"skill_used": "electronics",
761+
"skills_required": [ [ "fabrication", 5 ], [ "gun", 1 ] ],
762+
"difficulty": 7,
763+
"time": "30 m",
764+
"autolearn": true,
765+
"using": [ [ "welding_standard", 5 ], [ "steel_tiny", 2 ] ],
766+
"qualities": [ { "id": "SAW_M_FINE", "level": 1 }, { "id": "SCREW_FINE", "level": 1 } ],
767+
"components": [ [ [ "gatling_mech_laser_salvaged", 1 ] ], [ [ "battery_ups", 1 ] ], [ [ "cable", 25 ] ] ]
768+
},
741769
{
742770
"type": "recipe",
743771
"result": "m2browning_sawn",

data/json/uncraft/generic.json

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1016,6 +1016,7 @@
10161016
"using": [ [ "soldering_standard", 30 ], [ "welding_standard", 20 ] ],
10171017
"qualities": [ { "id": "SCREW", "level": 1 }, { "id": "WRENCH", "level": 1 }, { "id": "SAW_M", "level": 1 } ],
10181018
"components": [
1019+
[ [ "recon_mech_laser_salvaged", 1 ] ],
10191020
[ [ "ai_module", 1 ] ],
10201021
[ [ "sensor_module", 1 ] ],
10211022
[ [ "memory_module", 1 ] ],
@@ -1025,7 +1026,8 @@
10251026
[ [ "power_supply", 20 ] ],
10261027
[ [ "storage_battery", 2 ] ],
10271028
[ [ "plut_cell", 4 ] ],
1028-
[ [ "mil_plate", 15 ] ]
1029+
[ [ "mil_plate", 15 ] ],
1030+
[ [ "alloy_sheet", 25 ] ]
10291031
]
10301032
},
10311033
{
@@ -1046,7 +1048,8 @@
10461048
[ [ "power_supply", 20 ] ],
10471049
[ [ "storage_battery", 2 ] ],
10481050
[ [ "plut_cell", 4 ] ],
1049-
[ [ "mil_plate", 6 ] ]
1051+
[ [ "mil_plate", 6 ] ],
1052+
[ [ "alloy_sheet", 15 ] ]
10501053
]
10511054
},
10521055
{
@@ -1058,6 +1061,7 @@
10581061
"using": [ [ "soldering_standard", 30 ], [ "welding_standard", 20 ] ],
10591062
"qualities": [ { "id": "SCREW", "level": 1 }, { "id": "WRENCH", "level": 1 }, { "id": "SAW_M", "level": 1 } ],
10601063
"components": [
1064+
[ [ "gatling_mech_laser_salvaged", 1 ] ],
10611065
[ [ "ai_module", 1 ] ],
10621066
[ [ "sensor_module", 1 ] ],
10631067
[ [ "memory_module", 1 ] ],
@@ -1067,7 +1071,8 @@
10671071
[ [ "power_supply", 20 ] ],
10681072
[ [ "storage_battery", 2 ] ],
10691073
[ [ "plut_cell", 4 ] ],
1070-
[ [ "mil_plate", 20 ] ]
1074+
[ [ "mil_plate", 20 ] ],
1075+
[ [ "alloy_sheet", 20 ] ]
10711076
]
10721077
},
10731078
{

data/json/vehicleparts/turret.json

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -146,6 +146,34 @@
146146
"removal": { "skills": [ [ "mechanics", 3 ] ] }
147147
}
148148
},
149+
{
150+
"id": "mounted_gatling_mech_laser_rebuilt",
151+
"copy-from": "turret",
152+
"type": "vehicle_part",
153+
"name": { "str": "mounted gatling laser" },
154+
"item": "gatling_mech_laser_rebuilt",
155+
"color": "blue",
156+
"broken_color": "blue",
157+
"breaks_into": [ { "item": "scrap", "count": 14 }, { "item": "steel_chunk", "count": 6 }, { "item": "steel_lump", "count": 2 } ],
158+
"requirements": {
159+
"install": { "skills": [ [ "mechanics", 6 ], [ "electronics", 6 ] ] },
160+
"removal": { "skills": [ [ "mechanics", 4 ] ] }
161+
}
162+
},
163+
{
164+
"id": "mounted_recon_mech_laser_rebuilt",
165+
"copy-from": "turret",
166+
"type": "vehicle_part",
167+
"name": { "str": "mounted marksman laser" },
168+
"item": "recon_mech_laser_rebuilt",
169+
"color": "blue",
170+
"broken_color": "blue",
171+
"breaks_into": [ { "item": "scrap", "count": 14 }, { "item": "steel_chunk", "count": 6 }, { "item": "steel_lump", "count": 2 } ],
172+
"requirements": {
173+
"install": { "skills": [ [ "mechanics", 6 ], [ "electronics", 6 ] ] },
174+
"removal": { "skills": [ [ "mechanics", 4 ] ] }
175+
}
176+
},
149177
{
150178
"id": "m249",
151179
"copy-from": "turret",

src/avatar_action.cpp

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -400,6 +400,15 @@ bool avatar_action::move( avatar &you, map &m, const tripoint &d )
400400
if( !veh1->handle_potential_theft( you ) ) {
401401
return true;
402402
} else {
403+
// This check must be present in both avatar_action::move and map::open_door for vehiclepart doors specifically,
404+
// having it in just one does not prevent opening doors on horseback, for some insane reason.
405+
if( you.is_mounted() ) {
406+
auto mon = you.mounted_creature.get();
407+
if( !mon->has_flag( MF_RIDEABLE_MECH ) ) {
408+
// Message is printed by the other check in map::open_door
409+
return false;
410+
}
411+
}
403412
if( outside_vehicle ) {
404413
veh1->open_all_at( dpart );
405414
} else {

src/game.cpp

Lines changed: 16 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5470,7 +5470,22 @@ void game::examine( const tripoint &examp )
54705470
if( c != nullptr ) {
54715471
monster *mon = dynamic_cast<monster *>( c );
54725472
if( mon != nullptr ) {
5473-
add_msg( _( "There is a %s." ), mon->get_name() );
5473+
if( mon->battery_item && mon->has_effect( effect_pet ) ) {
5474+
const itype &type = *mon->type->mech_battery;
5475+
int max_charge = type.magazine->capacity;
5476+
float charge_percent;
5477+
if( mon->battery_item ) {
5478+
charge_percent = static_cast<float>( mon->battery_item->ammo_remaining() ) / max_charge * 100;
5479+
} else {
5480+
charge_percent = 0.0;
5481+
}
5482+
add_msg( _( "There is a %s. Battery level: %d%%" ), mon->get_name(),
5483+
static_cast<int>( charge_percent ) );
5484+
} else {
5485+
add_msg( _( "There is a %s." ), mon->get_name() );
5486+
}
5487+
5488+
54745489
if( mon->has_effect( effect_pet ) && !u.is_mounted() ) {
54755490
if( monexamine::pet_menu( *mon ) ) {
54765491
return;

src/handle_action.cpp

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1856,7 +1856,13 @@ bool game::handle_action()
18561856
if( u.has_active_mutation( trait_SHELL2 ) ) {
18571857
add_msg( m_info, _( "You can't open things while you're in your shell." ) );
18581858
} else if( u.is_mounted() ) {
1859-
add_msg( m_info, _( "You can't open things while you're riding." ) );
1859+
auto mon = u.mounted_creature.get();
1860+
if( !mon->has_flag( MF_RIDEABLE_MECH ) ) {
1861+
add_msg( m_info, _( "You can't open things while you're riding." ) );
1862+
break;
1863+
} else {
1864+
open();
1865+
}
18601866
} else {
18611867
open();
18621868
}
@@ -1869,6 +1875,9 @@ bool game::handle_action()
18691875
auto mon = u.mounted_creature.get();
18701876
if( !mon->has_flag( MF_RIDEABLE_MECH ) ) {
18711877
add_msg( m_info, _( "You can't close things while you're riding." ) );
1878+
break;
1879+
} else {
1880+
close();
18721881
}
18731882
} else if( mouse_target ) {
18741883
doors::close_door( m, u, *mouse_target );

src/map.cpp

Lines changed: 22 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3979,11 +3979,18 @@ bool map::open_door( const tripoint &p, const bool inside, const bool check_only
39793979
avatar &you = get_avatar();
39803980
const auto &ter = this->ter( p ).obj();
39813981
const auto &furn = this->furn( p ).obj();
3982+
39823983
if( ter.open ) {
39833984
if( has_flag( "OPENCLOSE_INSIDE", p ) && !inside ) {
39843985
return false;
39853986
}
3986-
3987+
if( you.is_mounted() ) {
3988+
auto mon = you.mounted_creature.get();
3989+
if( !mon->has_flag( MF_RIDEABLE_MECH ) ) {
3990+
add_msg( m_info, _( "You can't open things while you're riding." ) );
3991+
return false;
3992+
}
3993+
}
39873994
if( !check_only ) {
39883995
sounds::sound( p, 6, sounds::sound_t::movement, _( "swish" ), true,
39893996
"open_door", ter.id.str() );
@@ -4001,6 +4008,13 @@ bool map::open_door( const tripoint &p, const bool inside, const bool check_only
40014008
if( has_flag( "OPENCLOSE_INSIDE", p ) && !inside ) {
40024009
return false;
40034010
}
4011+
if( you.is_mounted() ) {
4012+
auto mon = you.mounted_creature.get();
4013+
if( !mon->has_flag( MF_RIDEABLE_MECH ) ) {
4014+
add_msg( m_info, _( "You can't open things while you're riding." ) );
4015+
return false;
4016+
}
4017+
}
40044018

40054019
if( !check_only ) {
40064020
sounds::sound( p, 6, sounds::sound_t::movement, _( "swish" ), true,
@@ -4012,6 +4026,13 @@ bool map::open_door( const tripoint &p, const bool inside, const bool check_only
40124026
} else if( const optional_vpart_position vp = veh_at( p ) ) {
40134027
int openable = vp->vehicle().next_part_to_open( vp->part_index(), true );
40144028
if( openable >= 0 ) {
4029+
if( you.is_mounted() ) {
4030+
auto mon = you.mounted_creature.get();
4031+
if( !mon->has_flag( MF_RIDEABLE_MECH ) ) {
4032+
add_msg( m_info, _( "You can't open things while you're riding." ) );
4033+
return false;
4034+
}
4035+
}
40154036
if( !check_only ) {
40164037
if( !vp->vehicle().handle_potential_theft( you ) ) {
40174038
return false;

0 commit comments

Comments
 (0)