From 15f18ad03c74e3563c0184fb07153a0839abf60f Mon Sep 17 00:00:00 2001 From: fairyarmadillo <94415528+fairyarmadillo@users.noreply.github.com> Date: Wed, 13 Dec 2023 01:05:09 -0800 Subject: [PATCH 01/30] seat and storage stuff --- .../furniture-storage.json | 2 + data/json/items/vehicle/seating.json | 34 ++++++++++-- data/json/recipes/other/parts.json | 52 ++++++++++++++++++- data/json/vehicleparts/seats.json | 29 ++++++----- data/json/vehicleparts/vehicle_parts.json | 4 +- 5 files changed, 101 insertions(+), 20 deletions(-) diff --git a/data/json/furniture_and_terrain/furniture-storage.json b/data/json/furniture_and_terrain/furniture-storage.json index 6dee0739cbb13..581dbaa8bd1eb 100644 --- a/data/json/furniture_and_terrain/furniture-storage.json +++ b/data/json/furniture_and_terrain/furniture-storage.json @@ -1402,6 +1402,8 @@ "move_cost_mod": 3, "coverage": 70, "required_str": 16, + "//": "Furniture is 2 tiles wide. A 6 yard bin holds around 4500 liters, so we half that." + "max_volume": "2250 L", "flags": [ "CONTAINER", "PLACE_ITEM", "BLOCKSDOOR", "HIDE_PLACE", "NO_SIGHT", "FIRE_CONTAINER" ], "deconstruct": { "items": [ diff --git a/data/json/items/vehicle/seating.json b/data/json/items/vehicle/seating.json index 04d053c75af91..f76391117e365 100644 --- a/data/json/items/vehicle/seating.json +++ b/data/json/items/vehicle/seating.json @@ -2,13 +2,13 @@ { "type": "GENERIC", "id": "seat", - "name": { "str": "seat" }, + "name": { "str": "bucket seat" }, "description": "A soft car seat made from synthetic fabric.", "weight": "9071 g", "to_hit": -4, "color": "red", "symbol": "0", - "material": [ "cotton", "steel" ], + "material": [ "nylon", "steel" ], "volume": "7500 ml", "category": "veh_parts", "price": 35000, @@ -19,9 +19,35 @@ "type": "GENERIC", "copy-from": "seat", "id": "seat_leather", - "name": { "str": "leather seat" }, + "name": { "str": "leather bucket seat" }, "description": "A soft car seat covered with leather.", - "material": [ "leather", "cotton", "steel" ], + "material": [ "leather", "nylon", "steel" ], + "price": 60000, + "price_postapoc": 250 + }, + { + "type": "GENERIC", + "id": "seat_bench", + "name": { "str": "bench seat" }, + "description": "A wide, flat seat like you'd find in the back of a sedan, upholstered with soft nylon.", + "weight": "9071 g", + "to_hit": -4, + "color": "red", + "symbol": "0", + "material": [ "nylon", "steel" ], + "volume": "7500 ml", + "category": "veh_parts", + "price": 35000, + "price_postapoc": 100, + "melee_damage": { "bash": 4 } + }, + { + "type": "GENERIC", + "copy-from": "seat", + "id": "seat_bench_leather", + "name": { "str": "leather bench seat" }, + "description": "A wide, flat seat like you'd find in the back of a sedan, upholstered with leather.", + "material": [ "leather", "nylon", "steel" ], "price": 60000, "price_postapoc": 250 }, diff --git a/data/json/recipes/other/parts.json b/data/json/recipes/other/parts.json index b763008be05c6..ae80287241b97 100644 --- a/data/json/recipes/other/parts.json +++ b/data/json/recipes/other/parts.json @@ -763,7 +763,7 @@ { "proficiency": "prof_welding_basic", "skill_penalty": 0.5 }, { "proficiency": "prof_welding" } ], - "components": [ [ [ "pipe", 4 ] ], [ [ "spring", 2 ] ], [ [ "cotton_patchwork", 20 ], [ "sheet", 1 ] ], [ [ "pipe_fittings", 4 ] ] ] + "components": [ [ [ "pipe", 4 ] ], [ [ "spring", 2 ] ], [ [ "nylon_patchwork", 20 ], [ "nylon_sheet", 1 ] ], [ [ "pipe_fittings", 4 ] ] ] }, { "type": "recipe", @@ -790,7 +790,55 @@ [ [ "spring", 2 ] ], [ [ "leather", 12 ], [ "fur", 12 ], [ "tanned_hide", 3 ], [ "tanned_pelt", 3 ] ], [ [ "pipe_fittings", 4 ] ], - [ [ "cotton_patchwork", 8 ] ] + [ [ "nylon_patchwork", 8 ] ] + ] + }, + { + "type": "recipe", + "activity_level": "MODERATE_EXERCISE", + "result": "seat_bench", + "category": "CC_OTHER", + "subcategory": "CSC_OTHER_PARTS", + "skill_used": "fabrication", + "difficulty": 1, + "time": "2 h", + "reversible": { "time": "20 m" }, + "autolearn": true, + "//": "20cm weld", + "using": [ [ "sewing_standard", 50 ], [ "welding_standard", 20 ] ], + "proficiencies": [ + { "proficiency": "prof_metalworking" }, + { "proficiency": "prof_welding_basic", "skill_penalty": 0.5 }, + { "proficiency": "prof_welding" } + ], + "components": [ [ [ "pipe", 4 ] ], [ [ "spring", 2 ] ], [ [ "nylon_patchwork", 20 ], [ "nylon_sheet", 1 ] ], [ [ "pipe_fittings", 4 ] ] ] + }, + { + "type": "recipe", + "activity_level": "MODERATE_EXERCISE", + "result": "seat_leather_bench", + "category": "CC_OTHER", + "subcategory": "CSC_OTHER_PARTS", + "skill_used": "fabrication", + "difficulty": 1, + "time": "6 h", + "reversible": { "time": "20 m" }, + "autolearn": true, + "//": "20cm weld", + "using": [ [ "sewing_standard", 50 ], [ "welding_standard", 20 ] ], + "proficiencies": [ + { "proficiency": "prof_metalworking" }, + { "proficiency": "prof_welding_basic", "skill_penalty": 0.5 }, + { "proficiency": "prof_welding" }, + { "proficiency": "prof_leatherworking_basic" }, + { "proficiency": "prof_leatherworking" } + ], + "components": [ + [ [ "pipe", 4 ] ], + [ [ "spring", 2 ] ], + [ [ "leather", 12 ], [ "fur", 12 ], [ "tanned_hide", 3 ], [ "tanned_pelt", 3 ] ], + [ [ "pipe_fittings", 4 ] ], + [ [ "nylon_patchwork", 8 ] ] ] }, { diff --git a/data/json/vehicleparts/seats.json b/data/json/vehicleparts/seats.json index de27e4385a2b5..76428c5662a39 100644 --- a/data/json/vehicleparts/seats.json +++ b/data/json/vehicleparts/seats.json @@ -1,7 +1,7 @@ [ { "entries": [ - { "count": [ 2, 8 ], "item": "cotton_patchwork" }, + { "count": [ 2, 8 ], "item": "nylon_patchwork" }, { "count": [ 1, 3 ], "item": "pipe" }, { "count": [ 0, 2 ], "item": "spring" }, { "count": [ 3, 5 ], "item": "scrap" } @@ -13,7 +13,7 @@ { "entries": [ { "count": [ 1, 5 ], "item": "leather" }, - { "count": [ 1, 3 ], "item": "cotton_patchwork" }, + { "count": [ 1, 3 ], "item": "nylon_patchwork" }, { "count": [ 1, 3 ], "item": "pipe" }, { "count": [ 0, 2 ], "item": "spring" }, { "count": [ 3, 5 ], "item": "scrap" } @@ -31,7 +31,7 @@ "comfort": 2, "damage_modifier": 60, "damage_reduction": { "all": 2, "bash": 5 }, - "description": "A place to sit, or sleep if you're desperate.", + "description": "A soft upholstered car seat, contoured to hold one person.", "durability": 300, "flags": [ "SEAT", "BOARDABLE", "CARGO", "BELTABLE" ], "floor_bedding_warmth": 200, @@ -39,7 +39,7 @@ "location": "center", "looks_like": "reclining_seat", "//": "weld repairs would mostly be the frame and springs of the seat, so low 6cm cost per quadrant", - "name": { "str": "seat" }, + "name": { "str": "bucket seat" }, "requirements": { "install": { "skills": [ [ "mechanics", 1 ] ], "time": "30 m", "using": [ [ "vehicle_wrench_2", 1 ] ] }, "removal": { "skills": [ [ "mechanics", 2 ] ], "time": "15 m", "using": [ [ "vehicle_wrench_2", 1 ] ] }, @@ -67,7 +67,8 @@ "breaks_into": "ig_vp_seat_leather", "copy-from": "seat", "item": "seat_leather", - "name": { "str": "leather seat" }, + "name": { "str": "leather bucket seat" }, + "description": "A leather car seat for one.", "type": "vehicle_part", "variants_bases": [ { "id": "windshield", "label": "Windshield" } ] }, @@ -75,10 +76,10 @@ "id": "reclining_seat", "copy-from": "seat", "comfort": 3, - "description": "A place to sit, with an adjustable backrest.", + "description": "A soft seat with an adjustable backrest, making it reasonably comfortable.", "durability": 100, "floor_bedding_warmth": 350, - "name": { "str": "reclining seat" }, + "name": { "str": "reclining bucket seat" }, "size": "6250 ml", "extend": { "flags": [ "BED" ] }, "type": "vehicle_part", @@ -90,18 +91,19 @@ "copy-from": "reclining_seat", "item": "seat_leather", "looks_like": "seat_leather", - "name": { "str": "reclining leather seat" }, + "name": { "str": "reclining leather bucket seat" }, "type": "vehicle_part", "variants_bases": [ { "id": "windshield", "label": "Windshield" } ] }, { "id": "seat_back", "copy-from": "seat", - "comfort": 4, - "description": "A benchlike seat. Mostly found in the second row, also known as the back or rear seat.", + "comfort": 3, + "description": "A soft, wide seat with a high back, the kind often used in back seats or older cars. It might be a decent place to sleep.", "floor_bedding_warmth": 500, - "name": { "str": "back seat" }, - "size": "30 L", + "item": "seat_bench", + "name": { "str": "bench seat" }, + "size": "63 L", "extend": { "flags": [ "BED" ] }, "type": "vehicle_part" }, @@ -111,7 +113,8 @@ "breaks_into": "ig_vp_seat_leather", "item": "seat_leather", "looks_like": "seat_leather", - "name": { "str": "leather back seat" }, + "item": "seat_bench_leather", + "name": { "str": "leather bench seat" }, "type": "vehicle_part" }, { diff --git a/data/json/vehicleparts/vehicle_parts.json b/data/json/vehicleparts/vehicle_parts.json index 68f433948604f..950242ea89bd2 100644 --- a/data/json/vehicleparts/vehicle_parts.json +++ b/data/json/vehicleparts/vehicle_parts.json @@ -202,7 +202,7 @@ "damage_modifier": 60, "durability": 95, "description": "A small but comfortable bed.", - "size": "50 L", + "size": "65 L", "item": "mattress", "comfort": 4, "floor_bedding_warmth": 700, @@ -2474,6 +2474,7 @@ "description": "A place to sit.", "item": "frame_wood_light", "location": "center", + "comfort": 1, "requirements": { "install": { "skills": [ [ "mechanics", 1 ] ], "time": "30 m", "using": [ [ "rope_natural_short", 2 ] ] }, "removal": { "skills": [ [ "mechanics", 1 ] ], "time": "15 m", "qualities": [ { "id": "CUT", "level": 2 } ] }, @@ -2513,6 +2514,7 @@ "name": { "str": "wooden bench" }, "copy-from": "seat_wood", "durability": 150, + "comfort": 1, "description": "A benchlike place to sit." }, { From 6d11135ac0b861f2f85efca0596cbcb4d98c1efc Mon Sep 17 00:00:00 2001 From: fairyarmadillo <94415528+fairyarmadillo@users.noreply.github.com> Date: Wed, 13 Dec 2023 01:10:38 -0800 Subject: [PATCH 02/30] Seats hold bodies --- data/json/vehicleparts/seats.json | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/data/json/vehicleparts/seats.json b/data/json/vehicleparts/seats.json index 76428c5662a39..8cd9cfe06fe94 100644 --- a/data/json/vehicleparts/seats.json +++ b/data/json/vehicleparts/seats.json @@ -49,7 +49,7 @@ "using": [ [ "repair_welding_standard", 1 ], [ "sewing_standard", 8 ] ] } }, - "size": "25 L", + "size": "63 L", "type": "vehicle_part", "variants_bases": [ { "id": "windshield", "label": "Windshield" }, { "id": "swivel_chair", "label": "Swivel Chair" } ], "variants": [ @@ -103,7 +103,7 @@ "floor_bedding_warmth": 500, "item": "seat_bench", "name": { "str": "bench seat" }, - "size": "63 L", + "size": "65 L", "extend": { "flags": [ "BED" ] }, "type": "vehicle_part" }, @@ -168,7 +168,7 @@ }, { "id": "metal_bench", - "copy-from": "seat", + "copy-from": "seat_back", "breaks_into": "ig_vp_prison_bench", "comfort": 0, "floor_bedding_warmth": 0, From 8dae6d332af44bbd5c05c426a2839d4ade226c29 Mon Sep 17 00:00:00 2001 From: fairyarmadillo <94415528+fairyarmadillo@users.noreply.github.com> Date: Wed, 13 Dec 2023 02:39:52 -0800 Subject: [PATCH 03/30] fixes --- .../furniture-storage.json | 2 +- data/json/recipes/other/parts.json | 10 +++++----- data/json/vehicleparts/seats.json | 9 ++++----- data/json/vehicleparts/vehicle_parts.json | 18 ++++++++++-------- 4 files changed, 20 insertions(+), 19 deletions(-) diff --git a/data/json/furniture_and_terrain/furniture-storage.json b/data/json/furniture_and_terrain/furniture-storage.json index 581dbaa8bd1eb..6311ec996a4ab 100644 --- a/data/json/furniture_and_terrain/furniture-storage.json +++ b/data/json/furniture_and_terrain/furniture-storage.json @@ -1402,7 +1402,7 @@ "move_cost_mod": 3, "coverage": 70, "required_str": 16, - "//": "Furniture is 2 tiles wide. A 6 yard bin holds around 4500 liters, so we half that." + "//": "Furniture is 2 tiles wide. A 6 yard bin holds around 4500 liters, so we half that.", "max_volume": "2250 L", "flags": [ "CONTAINER", "PLACE_ITEM", "BLOCKSDOOR", "HIDE_PLACE", "NO_SIGHT", "FIRE_CONTAINER" ], "deconstruct": { diff --git a/data/json/recipes/other/parts.json b/data/json/recipes/other/parts.json index ae80287241b97..76f55cfaa1a53 100644 --- a/data/json/recipes/other/parts.json +++ b/data/json/recipes/other/parts.json @@ -763,7 +763,7 @@ { "proficiency": "prof_welding_basic", "skill_penalty": 0.5 }, { "proficiency": "prof_welding" } ], - "components": [ [ [ "pipe", 4 ] ], [ [ "spring", 2 ] ], [ [ "nylon_patchwork", 20 ], [ "nylon_sheet", 1 ] ], [ [ "pipe_fittings", 4 ] ] ] + "components": [ [ [ "pipe", 4 ] ], [ [ "spring", 2 ] ], [ [ "nylon", 20 ], [ "sheet_nylon", 1 ] ], [ [ "pipe_fittings", 4 ] ] ] }, { "type": "recipe", @@ -790,7 +790,7 @@ [ [ "spring", 2 ] ], [ [ "leather", 12 ], [ "fur", 12 ], [ "tanned_hide", 3 ], [ "tanned_pelt", 3 ] ], [ [ "pipe_fittings", 4 ] ], - [ [ "nylon_patchwork", 8 ] ] + [ [ "nylon", 8 ] ] ] }, { @@ -811,12 +811,12 @@ { "proficiency": "prof_welding_basic", "skill_penalty": 0.5 }, { "proficiency": "prof_welding" } ], - "components": [ [ [ "pipe", 4 ] ], [ [ "spring", 2 ] ], [ [ "nylon_patchwork", 20 ], [ "nylon_sheet", 1 ] ], [ [ "pipe_fittings", 4 ] ] ] + "components": [ [ [ "pipe", 4 ] ], [ [ "spring", 2 ] ], [ [ "nylon", 20 ], [ "sheet_nylon", 1 ] ], [ [ "pipe_fittings", 4 ] ] ] }, { "type": "recipe", "activity_level": "MODERATE_EXERCISE", - "result": "seat_leather_bench", + "result": "seat_bench_leather", "category": "CC_OTHER", "subcategory": "CSC_OTHER_PARTS", "skill_used": "fabrication", @@ -838,7 +838,7 @@ [ [ "spring", 2 ] ], [ [ "leather", 12 ], [ "fur", 12 ], [ "tanned_hide", 3 ], [ "tanned_pelt", 3 ] ], [ [ "pipe_fittings", 4 ] ], - [ [ "nylon_patchwork", 8 ] ] + [ [ "nylon", 8 ] ] ] }, { diff --git a/data/json/vehicleparts/seats.json b/data/json/vehicleparts/seats.json index 8cd9cfe06fe94..424ca3b179954 100644 --- a/data/json/vehicleparts/seats.json +++ b/data/json/vehicleparts/seats.json @@ -1,7 +1,7 @@ [ { "entries": [ - { "count": [ 2, 8 ], "item": "nylon_patchwork" }, + { "count": [ 2, 8 ], "item": "nylon" }, { "count": [ 1, 3 ], "item": "pipe" }, { "count": [ 0, 2 ], "item": "spring" }, { "count": [ 3, 5 ], "item": "scrap" } @@ -13,7 +13,7 @@ { "entries": [ { "count": [ 1, 5 ], "item": "leather" }, - { "count": [ 1, 3 ], "item": "nylon_patchwork" }, + { "count": [ 1, 3 ], "item": "nylon" }, { "count": [ 1, 3 ], "item": "pipe" }, { "count": [ 0, 2 ], "item": "spring" }, { "count": [ 3, 5 ], "item": "scrap" } @@ -78,9 +78,9 @@ "comfort": 3, "description": "A soft seat with an adjustable backrest, making it reasonably comfortable.", "durability": 100, + "size": "62500 ml", "floor_bedding_warmth": 350, "name": { "str": "reclining bucket seat" }, - "size": "6250 ml", "extend": { "flags": [ "BED" ] }, "type": "vehicle_part", "variants_bases": [ { "id": "windshield", "label": "Windshield" } ] @@ -111,9 +111,8 @@ "id": "seat_back_leather", "copy-from": "seat_back", "breaks_into": "ig_vp_seat_leather", - "item": "seat_leather", - "looks_like": "seat_leather", "item": "seat_bench_leather", + "looks_like": "seat_leather", "name": { "str": "leather bench seat" }, "type": "vehicle_part" }, diff --git a/data/json/vehicleparts/vehicle_parts.json b/data/json/vehicleparts/vehicle_parts.json index 950242ea89bd2..0390ad4c0d8ad 100644 --- a/data/json/vehicleparts/vehicle_parts.json +++ b/data/json/vehicleparts/vehicle_parts.json @@ -202,7 +202,7 @@ "damage_modifier": 60, "durability": 95, "description": "A small but comfortable bed.", - "size": "65 L", + "size": "70 L", "item": "mattress", "comfort": 4, "floor_bedding_warmth": 700, @@ -298,6 +298,7 @@ "color": "white", "durability": 400, "description": "An aisle.", + "size": "100 L", "item": "sheet_metal", "location": "center", "//": "1m square sheet of metal, likely affixed with bolts in places, assume 200cm weld to install and 50cm weld to repair", @@ -314,7 +315,7 @@ }, "repair": { "skills": [ [ "mechanics", 2 ] ], "time": "6 m", "using": [ [ "repair_welding_standard", 5 ] ] } }, - "flags": [ "AISLE", "BOARDABLE" ], + "flags": [ "AISLE", "BOARDABLE", "CARGO" ], "breaks_into": "ig_vp_sheet_metal", "damage_reduction": { "all": 28 }, "variants": [ @@ -348,7 +349,7 @@ "description": "A collapsible aisle.", "folded_volume": "12500 ml", "item": "foldwoodframe", - "flags": [ "AISLE", "BOARDABLE" ] + "flags": [ "AISLE", "BOARDABLE", "CARGO" ] }, { "type": "vehicle_part", @@ -359,7 +360,7 @@ "color": "white", "durability": 400, "description": "An aisle. A hatch lets you access a cargo space beneath it.", - "size": "87500 ml", + "size": "100 L", "item": "cargo_aisle", "location": "center", "//": "same requirements as aisle to install but higher repair costs due to more mass", @@ -2471,10 +2472,9 @@ "broken_color": "brown", "damage_modifier": 20, "durability": 75, - "description": "A place to sit.", + "description": "A place to sit, barely.", "item": "frame_wood_light", "location": "center", - "comfort": 1, "requirements": { "install": { "skills": [ [ "mechanics", 1 ] ], "time": "30 m", "using": [ [ "rope_natural_short", 2 ] ] }, "removal": { "skills": [ [ "mechanics", 1 ] ], "time": "15 m", "qualities": [ { "id": "CUT", "level": 2 } ] }, @@ -2496,14 +2496,16 @@ "damage_modifier": 60, "durability": 125, "description": "A place to sit.", + "comfort": 1, "item": "frame_wood", "location": "center", + "size": "62500 ml", "requirements": { "install": { "skills": [ [ "mechanics", 1 ] ], "time": "30 m", "using": [ [ "vehicle_nail_install", 1 ] ] }, "removal": { "skills": [ [ "mechanics", 2 ] ], "time": "15 m", "using": [ [ "vehicle_nail_removal", 1 ] ] }, "repair": { "skills": [ [ "mechanics", 2 ] ], "time": "30 m", "using": [ [ "adhesive", 2 ] ] } }, - "flags": [ "SEAT", "BOARDABLE", "BELTABLE" ], + "flags": [ "SEAT", "BOARDABLE", "BELTABLE", "CARGO" ], "breaks_into": [ { "item": "splinter", "count": [ 7, 9 ] } ], "damage_reduction": { "all": 8 }, "variants": [ { "symbols": "#", "symbols_broken": "*" } ] @@ -2514,7 +2516,7 @@ "name": { "str": "wooden bench" }, "copy-from": "seat_wood", "durability": 150, - "comfort": 1, + "size": "65 L", "description": "A benchlike place to sit." }, { From 04ef9d84d6f5bbcb9b883e58e8982c2bc730e338 Mon Sep 17 00:00:00 2001 From: fairyarmadillo <94415528+fairyarmadillo@users.noreply.github.com> Date: Wed, 13 Dec 2023 02:45:23 -0800 Subject: [PATCH 04/30] desc --- data/json/vehicleparts/seats.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/data/json/vehicleparts/seats.json b/data/json/vehicleparts/seats.json index 424ca3b179954..f48a74fa07714 100644 --- a/data/json/vehicleparts/seats.json +++ b/data/json/vehicleparts/seats.json @@ -76,7 +76,7 @@ "id": "reclining_seat", "copy-from": "seat", "comfort": 3, - "description": "A soft seat with an adjustable backrest, making it reasonably comfortable.", + "description": "A soft seat with an adjustable backrest, making it a reasonably comfortable place to sleep.", "durability": 100, "size": "62500 ml", "floor_bedding_warmth": 350, From 2521412b1f0977d71604cc2d022a1ca83b2564a9 Mon Sep 17 00:00:00 2001 From: fairyarmadillo <94415528+fairyarmadillo@users.noreply.github.com> Date: Wed, 13 Dec 2023 03:01:44 -0800 Subject: [PATCH 05/30] Update furniture-storage.json --- data/json/furniture_and_terrain/furniture-storage.json | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/data/json/furniture_and_terrain/furniture-storage.json b/data/json/furniture_and_terrain/furniture-storage.json index 6311ec996a4ab..0d6528114093e 100644 --- a/data/json/furniture_and_terrain/furniture-storage.json +++ b/data/json/furniture_and_terrain/furniture-storage.json @@ -1402,9 +1402,8 @@ "move_cost_mod": 3, "coverage": 70, "required_str": 16, - "//": "Furniture is 2 tiles wide. A 6 yard bin holds around 4500 liters, so we half that.", - "max_volume": "2250 L", - "flags": [ "CONTAINER", "PLACE_ITEM", "BLOCKSDOOR", "HIDE_PLACE", "NO_SIGHT", "FIRE_CONTAINER" ], + "max_volume": "1500 L", + "flags": [ "CONTAINER", "PLACE_ITEM", "BLOCKSDOOR", "HIDE_PLACE", "NO_SIGHT", "FIRE_CONTAINER", "LIQUIDCONT" ], "deconstruct": { "items": [ { "item": "frame", "count": [ 2, 3 ] }, From 6c61138806bdbc55953dfff1f413aa412c48ae75 Mon Sep 17 00:00:00 2001 From: fairyarmadillo <94415528+fairyarmadillo@users.noreply.github.com> Date: Wed, 13 Dec 2023 03:23:04 -0800 Subject: [PATCH 06/30] Update data/json/recipes/other/parts.json Co-authored-by: Karol1223 <68503002+Karol1223@users.noreply.github.com> --- data/json/recipes/other/parts.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/data/json/recipes/other/parts.json b/data/json/recipes/other/parts.json index 76f55cfaa1a53..4cff00203f209 100644 --- a/data/json/recipes/other/parts.json +++ b/data/json/recipes/other/parts.json @@ -763,7 +763,7 @@ { "proficiency": "prof_welding_basic", "skill_penalty": 0.5 }, { "proficiency": "prof_welding" } ], - "components": [ [ [ "pipe", 4 ] ], [ [ "spring", 2 ] ], [ [ "nylon", 20 ], [ "sheet_nylon", 1 ] ], [ [ "pipe_fittings", 4 ] ] ] + "components": [ [ [ "pipe", 4 ] ], [ [ "spring", 2 ] ], [ [ "nylon", 20 ], [ "sheet_nylon", 3 ] ], [ [ "pipe_fittings", 4 ] ] ] }, { "type": "recipe", From d67b82a5ddbc19fa62b4967eabf665c467a6b4c5 Mon Sep 17 00:00:00 2001 From: fairyarmadillo <94415528+fairyarmadillo@users.noreply.github.com> Date: Wed, 13 Dec 2023 03:23:10 -0800 Subject: [PATCH 07/30] Update data/json/recipes/other/parts.json Co-authored-by: Karol1223 <68503002+Karol1223@users.noreply.github.com> --- data/json/recipes/other/parts.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/data/json/recipes/other/parts.json b/data/json/recipes/other/parts.json index 4cff00203f209..71b63ae53ccc2 100644 --- a/data/json/recipes/other/parts.json +++ b/data/json/recipes/other/parts.json @@ -811,7 +811,7 @@ { "proficiency": "prof_welding_basic", "skill_penalty": 0.5 }, { "proficiency": "prof_welding" } ], - "components": [ [ [ "pipe", 4 ] ], [ [ "spring", 2 ] ], [ [ "nylon", 20 ], [ "sheet_nylon", 1 ] ], [ [ "pipe_fittings", 4 ] ] ] + "components": [ [ [ "pipe", 4 ] ], [ [ "spring", 2 ] ], [ [ "nylon", 20 ], [ "sheet_nylon", 3 ] ], [ [ "pipe_fittings", 4 ] ] ] }, { "type": "recipe", From efed745e5d1536b39c3b8594315684bb049323ee Mon Sep 17 00:00:00 2001 From: fairyarmadillo <94415528+fairyarmadillo@users.noreply.github.com> Date: Fri, 15 Dec 2023 11:55:49 -0800 Subject: [PATCH 08/30] cargo_passable --- data/json/vehicleparts/doors.json | 8 +++--- data/json/vehicleparts/vehicle_parts.json | 6 ++--- data/json/vehicleparts/vp_flags.json | 5 ++++ src/game.cpp | 30 +++++++++++++++++++++++ src/veh_type.cpp | 1 + src/veh_type.h | 1 + 6 files changed, 44 insertions(+), 7 deletions(-) diff --git a/data/json/vehicleparts/doors.json b/data/json/vehicleparts/doors.json index c6e67a23586e4..32636dc47eb0c 100644 --- a/data/json/vehicleparts/doors.json +++ b/data/json/vehicleparts/doors.json @@ -9,7 +9,7 @@ "damage_reduction": { "all": 20 }, "description": "A door. Has a window so you can see out of it, even when closed.", "durability": 225, - "flags": [ "CARGO", "OBSTACLE", "OPENABLE", "BOARDABLE", "WINDOW", "DOOR", "LOCKABLE_DOOR" ], + "flags": [ "CARGO", "OBSTACLE", "OPENABLE", "BOARDABLE", "WINDOW", "DOOR", "LOCKABLE_DOOR", "CARGO_PASSABLE" ], "item": "frame", "location": "center", "looks_like": "t_door_metal_c", @@ -209,7 +209,7 @@ }, "breaks_into": [ { "item": "splinter", "count": [ 7, 9 ] } ], "extend": { "flags": [ "SIMPLE_PART" ] }, - "delete": { "flags": [ "CARGO" ] }, + "delete": { "flags": [ "CARGO", "CARGO_PASSABLE" ] }, "damage_reduction": { "all": 8 } }, { @@ -237,7 +237,7 @@ "repair": { "skills": [ [ "mechanics", 3 ] ], "time": "60 m", "using": [ [ "repair_welding_standard", 2 ] ] } }, "extend": { "flags": [ "LOW_FINAL_AIR_DRAG", "SIMPLE_PART", "NO_ROOF_NEEDED" ] }, - "delete": { "flags": [ "CARGO", "COVERED", "LOCKABLE_CARGO" ] } + "delete": { "flags": [ "CARGO", "COVERED", "LOCKABLE_CARGO", "CARGO_PASSABLE" ] } }, { "type": "vehicle_part", @@ -272,7 +272,7 @@ }, "breaks_into": "ig_vp_sheet_metal", "extend": { "flags": [ "OPAQUE", "SIMPLE_PART" ] }, - "delete": { "flags": [ "CARGO", "COVERED", "LOCKABLE_CARGO", "WINDOW" ] }, + "delete": { "flags": [ "CARGO", "COVERED", "LOCKABLE_CARGO", "WINDOW", "CARGO_PASSABLE" ] }, "damage_reduction": { "all": 7 } }, { diff --git a/data/json/vehicleparts/vehicle_parts.json b/data/json/vehicleparts/vehicle_parts.json index 0390ad4c0d8ad..f0b2f514b43cc 100644 --- a/data/json/vehicleparts/vehicle_parts.json +++ b/data/json/vehicleparts/vehicle_parts.json @@ -359,8 +359,8 @@ "categories": [ "cargo" ], "color": "white", "durability": 400, - "description": "An aisle. A hatch lets you access a cargo space beneath it.", - "size": "100 L", + "description": "An aisle. A hatch lets you access a cargo space beneath it, keeping items stored here out of the way.", + "size": "87500 ml", "item": "cargo_aisle", "location": "center", "//": "same requirements as aisle to install but higher repair costs due to more mass", @@ -377,7 +377,7 @@ }, "repair": { "skills": [ [ "mechanics", 2 ] ], "time": "10 m", "using": [ [ "repair_welding_standard", 6 ] ] } }, - "flags": [ "AISLE", "BOARDABLE", "CARGO", "LOCKABLE_CARGO", "COVERED" ], + "flags": [ "AISLE", "BOARDABLE", "CARGO", "LOCKABLE_CARGO", "COVERED", "CARGO_PASSABLE" ], "breaks_into": "ig_vp_sheet_metal", "damage_reduction": { "all": 28 }, "variants": [ { "symbols": "=", "symbols_broken": "#" } ] diff --git a/data/json/vehicleparts/vp_flags.json b/data/json/vehicleparts/vp_flags.json index 2b1a728c467e0..75541699c20c6 100644 --- a/data/json/vehicleparts/vp_flags.json +++ b/data/json/vehicleparts/vp_flags.json @@ -666,5 +666,10 @@ "id": "NEEDS_WHEEL_MOUNT_SKATEBOARD", "type": "json_flag", "requires_flag": "WHEEL_MOUNT_SKATEBOARD" + }, + { + "id": "CARGO_PASSABLE", + "type": "json_flag", + "requires_flag": "CARGO_PASSABLE" } ] diff --git a/src/game.cpp b/src/game.cpp index 9ef2750940183..03beb0a339203 100644 --- a/src/game.cpp +++ b/src/game.cpp @@ -10420,6 +10420,36 @@ bool game::walk_move( const tripoint &dest_loc, const bool via_ramp, const bool } u.set_underwater( false ); + if( vp_there ) { + add_msg( m_warning, _( "VP is there." ) ); + vehicle &veh = vp_there->vehicle(); + units::volume capacity = 0_ml; + units::volume free_cargo = 0_ml; + auto cargo_parts = veh.get_parts_at( dest_loc, "CARGO", part_status_flag::any ); + for( auto& part : cargo_parts ) { + vehicle_stack contents = veh.get_items( *part ); + const vpart_info &vpinfo = part->info(); + const optional_vpart_position vp = m.veh_at( dest_loc ); + if ( !vp.part_with_feature("CARGO_PASSABLE", true ) ) { + add_msg( m_warning, _( "There's cargo there." ) ); + capacity += vpinfo.size; + free_cargo += contents.free_volume(); + } + } + if( capacity > 0_ml ) { + add_msg( m_warning, _( "Free cargo is %s." ), format_volume( free_cargo ) ); + // First, we'll try to squeeze in. + if( ( ( u.get_size() > creature_size::tiny ) && free_cargo < 15625_ml ) || ( ( u.get_size() > creature_size::small ) && free_cargo < 31250_ml ) || ( ( u.get_size() > creature_size::medium ) && free_cargo < 62500_ml ) || ( ( u.get_size() > creature_size::large ) && free_cargo < 125000_ml ) || ( ( u.get_size() > creature_size::huge ) && free_cargo < 250000_ml ) ) { + if( ( ( u.get_size() > creature_size::tiny ) && free_cargo < 11719_ml ) || ( ( u.get_size() > creature_size::small ) && free_cargo < 23438_ml ) || ( ( u.get_size() > creature_size::medium ) && free_cargo < 46875_ml ) || ( ( u.get_size() > creature_size::large ) && free_cargo < 93750_ml ) || ( ( u.get_size() > creature_size::huge ) && free_cargo < 187500_ml ) ) { + u.add_msg_if_player( m_warning, _( "There's not enough room for you to fit there." ) ); + return false; // Even if you squeeze, there's no room. + } + u.add_msg_if_player( m_warning, _( "You contort your body to squeeze into the cramped space." ) ); + } + + } + } + if( !shifting_furniture && !pushing && is_dangerous_tile( dest_loc ) ) { std::vector harmful_stuff = get_dangerous_tile( dest_loc ); if( harmful_stuff.size() == 1 && harmful_stuff[0] == "ledge" ) { diff --git a/src/veh_type.cpp b/src/veh_type.cpp index 1dc955f6988b9..b863081707195 100644 --- a/src/veh_type.cpp +++ b/src/veh_type.cpp @@ -117,6 +117,7 @@ static const std::unordered_map vpart_bitflag_map = { "WINDOW", VPFLAG_WINDOW }, { "CURTAIN", VPFLAG_CURTAIN }, { "CARGO", VPFLAG_CARGO }, + { "CARGO_PASSABLE", VPFLAG_CARGO_PASSABLE }, { "INTERNAL", VPFLAG_INTERNAL }, { "SOLAR_PANEL", VPFLAG_SOLAR_PANEL }, { "WIND_TURBINE", VPFLAG_WIND_TURBINE }, diff --git a/src/veh_type.h b/src/veh_type.h index 8ca09d8995715..2f23bca1b0051 100644 --- a/src/veh_type.h +++ b/src/veh_type.h @@ -92,6 +92,7 @@ enum vpart_bitflags : int { VPFLAG_WINDOW, VPFLAG_CURTAIN, VPFLAG_CARGO, + VPFLAG_CARGO_PASSABLE, VPFLAG_INTERNAL, VPFLAG_SOLAR_PANEL, VPFLAG_WATER_WHEEL, From aea4dda9722346756bdb5a8a628ec23cc5d25d77 Mon Sep 17 00:00:00 2001 From: fairyarmadillo <94415528+fairyarmadillo@users.noreply.github.com> Date: Fri, 15 Dec 2023 12:54:38 -0800 Subject: [PATCH 09/30] hm --- data/json/vehicleparts/doors.json | 6 +++--- data/json/vehicleparts/vehicle_parts.json | 2 +- data/json/vehicleparts/vp_flags.json | 3 +-- 3 files changed, 5 insertions(+), 6 deletions(-) diff --git a/data/json/vehicleparts/doors.json b/data/json/vehicleparts/doors.json index 32636dc47eb0c..66e71da137de0 100644 --- a/data/json/vehicleparts/doors.json +++ b/data/json/vehicleparts/doors.json @@ -9,7 +9,7 @@ "damage_reduction": { "all": 20 }, "description": "A door. Has a window so you can see out of it, even when closed.", "durability": 225, - "flags": [ "CARGO", "OBSTACLE", "OPENABLE", "BOARDABLE", "WINDOW", "DOOR", "LOCKABLE_DOOR", "CARGO_PASSABLE" ], + "flags": [ "CARGO", "CARGO_PASSABLE", "OBSTACLE", "OPENABLE", "BOARDABLE", "WINDOW", "DOOR", "LOCKABLE_DOOR" ], "item": "frame", "location": "center", "looks_like": "t_door_metal_c", @@ -237,7 +237,7 @@ "repair": { "skills": [ [ "mechanics", 3 ] ], "time": "60 m", "using": [ [ "repair_welding_standard", 2 ] ] } }, "extend": { "flags": [ "LOW_FINAL_AIR_DRAG", "SIMPLE_PART", "NO_ROOF_NEEDED" ] }, - "delete": { "flags": [ "CARGO", "COVERED", "LOCKABLE_CARGO", "CARGO_PASSABLE" ] } + "delete": { "flags": [ "CARGO", "CARGO_PASSABLE", "COVERED", "LOCKABLE_CARGO" ] } }, { "type": "vehicle_part", @@ -272,7 +272,7 @@ }, "breaks_into": "ig_vp_sheet_metal", "extend": { "flags": [ "OPAQUE", "SIMPLE_PART" ] }, - "delete": { "flags": [ "CARGO", "COVERED", "LOCKABLE_CARGO", "WINDOW", "CARGO_PASSABLE" ] }, + "delete": { "flags": [ "CARGO", "CARGO_PASSABLE", "COVERED", "LOCKABLE_CARGO", "WINDOW" ] }, "damage_reduction": { "all": 7 } }, { diff --git a/data/json/vehicleparts/vehicle_parts.json b/data/json/vehicleparts/vehicle_parts.json index f0b2f514b43cc..38f9298fded18 100644 --- a/data/json/vehicleparts/vehicle_parts.json +++ b/data/json/vehicleparts/vehicle_parts.json @@ -377,7 +377,7 @@ }, "repair": { "skills": [ [ "mechanics", 2 ] ], "time": "10 m", "using": [ [ "repair_welding_standard", 6 ] ] } }, - "flags": [ "AISLE", "BOARDABLE", "CARGO", "LOCKABLE_CARGO", "COVERED", "CARGO_PASSABLE" ], + "flags": [ "AISLE", "BOARDABLE", "CARGO", "CARGO_PASSABLE", "LOCKABLE_CARGO", "COVERED" ], "breaks_into": "ig_vp_sheet_metal", "damage_reduction": { "all": 28 }, "variants": [ { "symbols": "=", "symbols_broken": "#" } ] diff --git a/data/json/vehicleparts/vp_flags.json b/data/json/vehicleparts/vp_flags.json index 75541699c20c6..8dd67415408a6 100644 --- a/data/json/vehicleparts/vp_flags.json +++ b/data/json/vehicleparts/vp_flags.json @@ -669,7 +669,6 @@ }, { "id": "CARGO_PASSABLE", - "type": "json_flag", - "requires_flag": "CARGO_PASSABLE" + "type": "json_flag" } ] From 83dae5a7dc01e1e91af41492136e0c7766f188c9 Mon Sep 17 00:00:00 2001 From: fairyarmadillo <94415528+fairyarmadillo@users.noreply.github.com> Date: Sun, 17 Dec 2023 06:43:26 -0800 Subject: [PATCH 10/30] block NPC --- src/npcmove.cpp | 84 +++++++++++++++++++++++++++++++++++++++++++++---- 1 file changed, 78 insertions(+), 6 deletions(-) diff --git a/src/npcmove.cpp b/src/npcmove.cpp index efe89a774f3bc..8110857f407ad 100644 --- a/src/npcmove.cpp +++ b/src/npcmove.cpp @@ -414,8 +414,7 @@ bool npc::sees_dangerous_field( const tripoint &p ) const return is_dangerous_fields( get_map().field_at( p ) ); } -bool npc::could_move_onto( const tripoint &p ) const -{ +bool npc::could_move_onto( const tripoint &p ) const { map &here = get_map(); if( !here.passable( p ) ) { return false; @@ -1785,7 +1784,6 @@ void npc::execute_action( npc_action action ) case npc_follow_embarked: { const optional_vpart_position vp = here.veh_at( player_character.pos() ); - if( !vp ) { debugmsg( "Following an embarked player with no vehicle at their location?" ); // TODO: change to wait? - for now pause @@ -1811,11 +1809,41 @@ void npc::execute_action( npc_action action ) continue; } + // a seat is available if either unassigned or assigned to us auto available_seat = [&]( const vehicle_part & pt ) { if( !pt.is_seat() ) { return false; } + if( vp.part_with_feature( VPFLAG_CARGO, true ) ) { + add_msg( m_warning, _( "SEAT: checking if its cargo." ) ); + units::volume capacity = 0_ml; + units::volume free_cargo = 0_ml; + auto cargo_parts = veh->get_parts_at( tar, "CARGO", part_status_flag::any ); + for( auto& part : cargo_parts ) { + add_msg( m_warning, _( "SEAT: cargo_parts initiated." ) ); + vehicle_stack contents = veh->get_items( *part ); + const vpart_info &vpinfo = part->info(); + tripoint spot = veh->global_part_pos3( *part ); + const optional_vpart_position checkpart = here.veh_at( spot ); + add_msg( m_warning, _( "SEAT: There's cargo where NPC wants to go." ) ); + if ( !checkpart.part_with_feature( "CARGO_PASSABLE", true ) ) { + add_msg( m_warning, _( "SEAT: CARGO_PASSABLE not found." ) ); + capacity += vpinfo.size; + free_cargo += contents.free_volume(); + } + } + if( capacity > 0_ml ) { + add_msg( m_warning, _( "SEAT: Free cargo for NPC seat is %s." ), format_volume( free_cargo ) ); + // First, we'll try to squeeze in. + if( ( ( get_size() > creature_size::tiny ) && free_cargo < 15625_ml ) || ( ( get_size() > creature_size::small ) && free_cargo < 31250_ml ) || ( ( get_size() > creature_size::medium ) && free_cargo < 62500_ml ) || ( ( get_size() > creature_size::large ) && free_cargo < 125000_ml ) || ( ( get_size() > creature_size::huge ) && free_cargo < 250000_ml ) ) { + if( ( ( get_size() > creature_size::tiny ) && free_cargo < 11719_ml ) || ( ( get_size() > creature_size::small ) && free_cargo < 23438_ml ) || ( ( get_size() > creature_size::medium ) && free_cargo < 46875_ml ) || ( ( get_size() > creature_size::large ) && free_cargo < 93750_ml ) || ( ( get_size() > creature_size::huge ) && free_cargo < 187500_ml ) ) { + add_msg( m_warning, _( "SEAT: There's not enough room for NPC to fit there, free cargo is %s." ), format_volume( free_cargo ) ); + return false; + } + } + } + } const npc *who = pt.crew(); return !who || who->getID() == getID(); }; @@ -2809,6 +2837,7 @@ bool npc::can_open_door( const tripoint &p, const bool inside ) const bool npc::can_move_to( const tripoint &p, bool no_bashing ) const { map &here = get_map(); + // Allow moving into any bashable spots, but penalize them during pathing // Doors are not passable for hallucinations return( rl_dist( pos(), p ) <= 1 && here.has_floor_or_water( p ) && !g->is_dangerous_tile( p ) && @@ -2836,6 +2865,49 @@ void npc::move_to( const tripoint &pt, bool no_bashing, std::set *nomo } } + if( here.veh_at( p ).part_with_feature( VPFLAG_CARGO, true ) ) { + add_msg( m_warning, _( "Cargo found for npc." ) ); + const optional_vpart_position vp = here.veh_at( p ); + vehicle &veh1 = vp->vehicle(); + units::volume capacity = 0_ml; + units::volume free_cargo = 0_ml; + auto cargo_parts = veh1.get_parts_at( p, "CARGO", part_status_flag::any ); + for( auto& part : cargo_parts ) { + vehicle_stack contents = veh1.get_items( *part ); + const vpart_info &vpinfo = part->info(); + const optional_vpart_position vp = here.veh_at( p ); + if ( !vp.part_with_feature("CARGO_PASSABLE", true ) ) { + add_msg( m_warning, _( "There's cargo where NPC wants to go." ) ); + capacity += vpinfo.size; + free_cargo += contents.free_volume(); + } + } + if( capacity > 0_ml ) { + add_msg( m_warning, _( "Free cargo for NPC spot is %s." ), format_volume( free_cargo ) ); + // First, we'll try to squeeze in. + if( ( ( get_size() > creature_size::tiny ) && free_cargo < 15625_ml ) || ( ( get_size() > creature_size::small ) && free_cargo < 31250_ml ) || ( ( get_size() > creature_size::medium ) && free_cargo < 62500_ml ) || ( ( get_size() > creature_size::large ) && free_cargo < 125000_ml ) || ( ( get_size() > creature_size::huge ) && free_cargo < 250000_ml ) ) { + if( ( ( get_size() > creature_size::tiny ) && free_cargo < 11719_ml ) || ( ( get_size() > creature_size::small ) && free_cargo < 23438_ml ) || ( ( get_size() > creature_size::medium ) && free_cargo < 46875_ml ) || ( ( get_size() > creature_size::large ) && free_cargo < 93750_ml ) || ( ( get_size() > creature_size::huge ) && free_cargo < 187500_ml ) ) { + add_msg( m_warning, _( "There's not enough room for NPC to fit there, free cargo is %s." ), format_volume( free_cargo ) ); + // Move to a neighbor field instead, if possible. + // Maybe this code already exists somewhere? + //auto other_points = here.get_dir_circle( pos(), p ); + // for( const tripoint &ot : other_points ) { + // if( could_move_onto( ot ) && ( nomove == nullptr || nomove->find( ot ) == nomove->end() ) ) { + // p = ot; + // break; + // } + // } + } + path.clear(); + move_pause(); + return; + } + } + add_msg( m_warning, _( "There's room for NPC to fit there, free cargo is %s." ), format_volume( free_cargo ) ); + } + + + recoil = MAX_RECOIL; if( has_effect( effect_stunned ) || has_effect( effect_psi_stunned ) ) { @@ -3061,13 +3133,13 @@ void npc::move_to( const tripoint &pt, bool no_bashing, std::set *nomo } if( here.veh_at( p ).part_with_feature( VPFLAG_BOARDABLE, true ) ) { - here.board_vehicle( p, this ); + here.board_vehicle( p, this ); } - here.creature_on_trap( *this ); here.creature_in_field( *this ); + } } -} + void npc::move_to_next() { From 1925aef59dabbaf8849de2ed9fe5af63f0dfd8a3 Mon Sep 17 00:00:00 2001 From: fairyarmadillo <94415528+fairyarmadillo@users.noreply.github.com> Date: Sun, 17 Dec 2023 10:56:04 -0800 Subject: [PATCH 11/30] Do it at character level --- src/character.cpp | 39 ++++++++++++++++++++++++++++ src/character.h | 3 +++ src/game.cpp | 58 +++++++++++++++++++++-------------------- src/npcmove.cpp | 66 ++++++++++++++++++++++++++--------------------- 4 files changed, 108 insertions(+), 58 deletions(-) diff --git a/src/character.cpp b/src/character.cpp index 4c7d070a72841..26a34c2e36510 100644 --- a/src/character.cpp +++ b/src/character.cpp @@ -7946,6 +7946,45 @@ std::string Character::weapname_ammo() const } } +bool Character::move_in_vehicle( Creature *source, const tripoint &dest_loc ) +{ + map &m = get_map(); + const optional_vpart_position vp_there = m.veh_at( dest_loc ); + if( vp_there ) { + add_msg( m_warning, _( "VP is there." ) ); + vehicle &veh = vp_there->vehicle(); + units::volume capacity = 0_ml; + units::volume free_cargo = 0_ml; + auto cargo_parts = veh.get_parts_at( dest_loc, "CARGO", part_status_flag::any ); + for( auto& part : cargo_parts ) { + vehicle_stack contents = veh.get_items( *part ); + const vpart_info &vpinfo = part->info(); + const optional_vpart_position vp = m.veh_at( dest_loc ); + if ( !vp.part_with_feature("CARGO_PASSABLE", true ) ) { + add_msg( m_warning, _( "There's cargo there." ) ); + capacity += vpinfo.size; + free_cargo += contents.free_volume(); + } + } + + if( capacity > 0_ml ) { + add_msg( m_warning, _( "Free cargo is %s." ), format_volume( free_cargo ) ); + // First, we'll try to squeeze in. + if( ( ( get_size() > creature_size::tiny ) && free_cargo < 15625_ml ) || ( ( get_size() > creature_size::small ) && free_cargo < 31250_ml ) || ( ( get_size() > creature_size::medium ) && free_cargo < 62500_ml ) || ( ( get_size() > creature_size::large ) && free_cargo < 125000_ml ) || ( ( get_size() > creature_size::huge ) && free_cargo < 250000_ml ) ) { + if( ( ( get_size() > creature_size::tiny ) && free_cargo < 11719_ml ) || ( ( get_size() > creature_size::small ) && free_cargo < 23438_ml ) || ( ( get_size() > creature_size::medium ) && free_cargo < 46875_ml ) || ( ( get_size() > creature_size::large ) && free_cargo < 93750_ml ) || ( ( get_size() > creature_size::huge ) && free_cargo < 187500_ml ) ) { + add_msg_if_player( m_warning, _( "There's not enough room for you to fit there." ) ); + add_msg_if_npc( m_warning, _( "There's not enough room for %s to fit there." ), source->disp_name() ); + return false; // Even if you squeeze, there's no room. + } + add_msg_if_player( m_warning, _( "You contort your body to squeeze into the cramped space." ) ); + add_msg_if_npc( m_warning, _( "%s contorts their body to fit into the cramped space." ), source->disp_name() ); + return true; + } + } + } + return true; +} + void Character::on_hit( Creature *source, bodypart_id bp_hit, float /*difficulty*/, dealt_projectile_attack const *const proj ) { diff --git a/src/character.h b/src/character.h index c947f303408db..5211c86a3cac9 100644 --- a/src/character.h +++ b/src/character.h @@ -1386,6 +1386,9 @@ class Character : public Creature, public visitable void dismount(); void forced_dismount(); + /** Attempt to enter a tile in a vehicle */ + bool move_in_vehicle( Creature *source, const tripoint &dest_loc ); + bool is_deaf() const; bool is_mute() const; // Get the specified limb score. If bp is defined, only the scores from that body part type are summed. diff --git a/src/game.cpp b/src/game.cpp index 03beb0a339203..4359ef4b2fe6b 100644 --- a/src/game.cpp +++ b/src/game.cpp @@ -10420,35 +10420,37 @@ bool game::walk_move( const tripoint &dest_loc, const bool via_ramp, const bool } u.set_underwater( false ); - if( vp_there ) { - add_msg( m_warning, _( "VP is there." ) ); - vehicle &veh = vp_there->vehicle(); - units::volume capacity = 0_ml; - units::volume free_cargo = 0_ml; - auto cargo_parts = veh.get_parts_at( dest_loc, "CARGO", part_status_flag::any ); - for( auto& part : cargo_parts ) { - vehicle_stack contents = veh.get_items( *part ); - const vpart_info &vpinfo = part->info(); - const optional_vpart_position vp = m.veh_at( dest_loc ); - if ( !vp.part_with_feature("CARGO_PASSABLE", true ) ) { - add_msg( m_warning, _( "There's cargo there." ) ); - capacity += vpinfo.size; - free_cargo += contents.free_volume(); - } - } - if( capacity > 0_ml ) { - add_msg( m_warning, _( "Free cargo is %s." ), format_volume( free_cargo ) ); - // First, we'll try to squeeze in. - if( ( ( u.get_size() > creature_size::tiny ) && free_cargo < 15625_ml ) || ( ( u.get_size() > creature_size::small ) && free_cargo < 31250_ml ) || ( ( u.get_size() > creature_size::medium ) && free_cargo < 62500_ml ) || ( ( u.get_size() > creature_size::large ) && free_cargo < 125000_ml ) || ( ( u.get_size() > creature_size::huge ) && free_cargo < 250000_ml ) ) { - if( ( ( u.get_size() > creature_size::tiny ) && free_cargo < 11719_ml ) || ( ( u.get_size() > creature_size::small ) && free_cargo < 23438_ml ) || ( ( u.get_size() > creature_size::medium ) && free_cargo < 46875_ml ) || ( ( u.get_size() > creature_size::large ) && free_cargo < 93750_ml ) || ( ( u.get_size() > creature_size::huge ) && free_cargo < 187500_ml ) ) { - u.add_msg_if_player( m_warning, _( "There's not enough room for you to fit there." ) ); - return false; // Even if you squeeze, there's no room. - } - u.add_msg_if_player( m_warning, _( "You contort your body to squeeze into the cramped space." ) ); - } - - } + if( vp_there && !u.move_in_vehicle(static_cast(&u), dest_loc) ) { + return false; } +// add_msg( m_warning, _( "VP is there." ) ); +// vehicle &veh = vp_there->vehicle(); +// units::volume capacity = 0_ml; +// units::volume free_cargo = 0_ml; +// auto cargo_parts = veh.get_parts_at( dest_loc, "CARGO", part_status_flag::any ); +// for( auto& part : cargo_parts ) { +// vehicle_stack contents = veh.get_items( *part ); +// const vpart_info &vpinfo = part->info(); +// const optional_vpart_position vp = m.veh_at( dest_loc ); +// if ( !vp.part_with_feature("CARGO_PASSABLE", true ) ) { +// add_msg( m_warning, _( "There's cargo there." ) ); +// capacity += vpinfo.size; +// free_cargo += contents.free_volume(); +// } +// } +// if( capacity > 0_ml ) { +// add_msg( m_warning, _( "Free cargo is %s." ), format_volume( free_cargo ) ); +// // First, we'll try to squeeze in. +// if( ( ( u.get_size() > creature_size::tiny ) && free_cargo < 15625_ml ) || ( ( u.get_size() > creature_size::small ) && free_cargo < 31250_ml ) || ( ( u.get_size() > creature_size::medium ) && free_cargo < 62500_ml ) || ( ( u.get_size() > creature_size::large ) && free_cargo < 125000_ml ) || ( ( u.get_size() > creature_size::huge ) && free_cargo < 250000_ml ) ) { +// if( ( ( u.get_size() > creature_size::tiny ) && free_cargo < 11719_ml ) || ( ( u.get_size() > creature_size::small ) && free_cargo < 23438_ml ) || ( ( u.get_size() > creature_size::medium ) && free_cargo < 46875_ml ) || ( ( u.get_size() > creature_size::large ) && free_cargo < 93750_ml ) || ( ( u.get_size() > creature_size::huge ) && free_cargo < 187500_ml ) ) { +// u.add_msg_if_player( m_warning, _( "There's not enough room for you to fit there." ) ); +// return false; // Even if you squeeze, there's no room. +// } +// u.add_msg_if_player( m_warning, _( "You contort your body to squeeze into the cramped space." ) ); +// } +// +// } +// } if( !shifting_furniture && !pushing && is_dangerous_tile( dest_loc ) ) { std::vector harmful_stuff = get_dangerous_tile( dest_loc ); diff --git a/src/npcmove.cpp b/src/npcmove.cpp index 8110857f407ad..fa90a8e88c9c2 100644 --- a/src/npcmove.cpp +++ b/src/npcmove.cpp @@ -2865,29 +2865,35 @@ void npc::move_to( const tripoint &pt, bool no_bashing, std::set *nomo } } - if( here.veh_at( p ).part_with_feature( VPFLAG_CARGO, true ) ) { - add_msg( m_warning, _( "Cargo found for npc." ) ); - const optional_vpart_position vp = here.veh_at( p ); - vehicle &veh1 = vp->vehicle(); - units::volume capacity = 0_ml; - units::volume free_cargo = 0_ml; - auto cargo_parts = veh1.get_parts_at( p, "CARGO", part_status_flag::any ); - for( auto& part : cargo_parts ) { - vehicle_stack contents = veh1.get_items( *part ); - const vpart_info &vpinfo = part->info(); - const optional_vpart_position vp = here.veh_at( p ); - if ( !vp.part_with_feature("CARGO_PASSABLE", true ) ) { - add_msg( m_warning, _( "There's cargo where NPC wants to go." ) ); - capacity += vpinfo.size; - free_cargo += contents.free_volume(); - } - } - if( capacity > 0_ml ) { - add_msg( m_warning, _( "Free cargo for NPC spot is %s." ), format_volume( free_cargo ) ); + if( here.veh_at( p ).part_with_feature( VPFLAG_CARGO, true ) && !move_in_vehicle( this, p ) ) { + path.clear(); + move_pause(); + return; + } + + // if( here.veh_at( p ).part_with_feature( VPFLAG_CARGO, true ) ) { + // add_msg( m_warning, _( "Cargo found for npc." ) ); + // const optional_vpart_position vp = here.veh_at( p ); + // vehicle &veh1 = vp->vehicle(); + // units::volume capacity = 0_ml; + // units::volume free_cargo = 0_ml; + // auto cargo_parts = veh1.get_parts_at( p, "CARGO", part_status_flag::any ); + // for( auto& part : cargo_parts ) { + // vehicle_stack contents = veh1.get_items( *part ); + // const vpart_info &vpinfo = part->info(); + // const optional_vpart_position vp = here.veh_at( p ); + // if ( !vp.part_with_feature("CARGO_PASSABLE", true ) ) { + // add_msg( m_warning, _( "There's cargo where NPC wants to go." ) ); + // capacity += vpinfo.size; + // free_cargo += contents.free_volume(); + // } + // } + // if( capacity > 0_ml ) { + // add_msg( m_warning, _( "Free cargo for NPC spot is %s." ), format_volume( free_cargo ) ); // First, we'll try to squeeze in. - if( ( ( get_size() > creature_size::tiny ) && free_cargo < 15625_ml ) || ( ( get_size() > creature_size::small ) && free_cargo < 31250_ml ) || ( ( get_size() > creature_size::medium ) && free_cargo < 62500_ml ) || ( ( get_size() > creature_size::large ) && free_cargo < 125000_ml ) || ( ( get_size() > creature_size::huge ) && free_cargo < 250000_ml ) ) { - if( ( ( get_size() > creature_size::tiny ) && free_cargo < 11719_ml ) || ( ( get_size() > creature_size::small ) && free_cargo < 23438_ml ) || ( ( get_size() > creature_size::medium ) && free_cargo < 46875_ml ) || ( ( get_size() > creature_size::large ) && free_cargo < 93750_ml ) || ( ( get_size() > creature_size::huge ) && free_cargo < 187500_ml ) ) { - add_msg( m_warning, _( "There's not enough room for NPC to fit there, free cargo is %s." ), format_volume( free_cargo ) ); + // if( ( ( get_size() > creature_size::tiny ) && free_cargo < 15625_ml ) || ( ( get_size() > creature_size::small ) && free_cargo < 31250_ml ) || ( ( get_size() > creature_size::medium ) && free_cargo < 62500_ml ) || ( ( get_size() > creature_size::large ) && free_cargo < 125000_ml ) || ( ( get_size() > creature_size::huge ) && free_cargo < 250000_ml ) ) { + // if( ( ( get_size() > creature_size::tiny ) && free_cargo < 11719_ml ) || ( ( get_size() > creature_size::small ) && free_cargo < 23438_ml ) || ( ( get_size() > creature_size::medium ) && free_cargo < 46875_ml ) || ( ( get_size() > creature_size::large ) && free_cargo < 93750_ml ) || ( ( get_size() > creature_size::huge ) && free_cargo < 187500_ml ) ) { + // add_msg( m_warning, _( "There's not enough room for NPC to fit there, free cargo is %s." ), format_volume( free_cargo ) ); // Move to a neighbor field instead, if possible. // Maybe this code already exists somewhere? //auto other_points = here.get_dir_circle( pos(), p ); @@ -2897,14 +2903,14 @@ void npc::move_to( const tripoint &pt, bool no_bashing, std::set *nomo // break; // } // } - } - path.clear(); - move_pause(); - return; - } - } - add_msg( m_warning, _( "There's room for NPC to fit there, free cargo is %s." ), format_volume( free_cargo ) ); - } + // } + // path.clear(); + // move_pause(); + // return; + // } + // } + // add_msg( m_warning, _( "There's room for NPC to fit there, free cargo is %s." ), format_volume( free_cargo ) ); + //} From 3605c86b1c0b77dcd822fc1067ef5859fc644072 Mon Sep 17 00:00:00 2001 From: fairyarmadillo <94415528+fairyarmadillo@users.noreply.github.com> Date: Sun, 17 Dec 2023 23:56:32 -0800 Subject: [PATCH 12/30] hmm --- src/character.cpp | 6 +++--- src/character.h | 2 +- src/npcmove.cpp | 32 ++++++++++++++++++++++---------- 3 files changed, 26 insertions(+), 14 deletions(-) diff --git a/src/character.cpp b/src/character.cpp index 26a34c2e36510..195d8ca8ba020 100644 --- a/src/character.cpp +++ b/src/character.cpp @@ -7946,7 +7946,7 @@ std::string Character::weapname_ammo() const } } -bool Character::move_in_vehicle( Creature *source, const tripoint &dest_loc ) +bool Character::move_in_vehicle(Creature* c, const tripoint& dest_loc) const { map &m = get_map(); const optional_vpart_position vp_there = m.veh_at( dest_loc ); @@ -7973,11 +7973,11 @@ bool Character::move_in_vehicle( Creature *source, const tripoint &dest_loc ) if( ( ( get_size() > creature_size::tiny ) && free_cargo < 15625_ml ) || ( ( get_size() > creature_size::small ) && free_cargo < 31250_ml ) || ( ( get_size() > creature_size::medium ) && free_cargo < 62500_ml ) || ( ( get_size() > creature_size::large ) && free_cargo < 125000_ml ) || ( ( get_size() > creature_size::huge ) && free_cargo < 250000_ml ) ) { if( ( ( get_size() > creature_size::tiny ) && free_cargo < 11719_ml ) || ( ( get_size() > creature_size::small ) && free_cargo < 23438_ml ) || ( ( get_size() > creature_size::medium ) && free_cargo < 46875_ml ) || ( ( get_size() > creature_size::large ) && free_cargo < 93750_ml ) || ( ( get_size() > creature_size::huge ) && free_cargo < 187500_ml ) ) { add_msg_if_player( m_warning, _( "There's not enough room for you to fit there." ) ); - add_msg_if_npc( m_warning, _( "There's not enough room for %s to fit there." ), source->disp_name() ); + add_msg_if_npc( m_warning, _( "There's not enough room for %s to fit there." ), c->disp_name() ); return false; // Even if you squeeze, there's no room. } add_msg_if_player( m_warning, _( "You contort your body to squeeze into the cramped space." ) ); - add_msg_if_npc( m_warning, _( "%s contorts their body to fit into the cramped space." ), source->disp_name() ); + add_msg_if_npc( m_warning, _( "%s contorts their body to fit into the cramped space." ), c->disp_name() ); return true; } } diff --git a/src/character.h b/src/character.h index 5211c86a3cac9..cf7a669f4b5b1 100644 --- a/src/character.h +++ b/src/character.h @@ -1387,7 +1387,7 @@ class Character : public Creature, public visitable void forced_dismount(); /** Attempt to enter a tile in a vehicle */ - bool move_in_vehicle( Creature *source, const tripoint &dest_loc ); + bool move_in_vehicle( Creature *source, const tripoint &dest_loc ) const; bool is_deaf() const; bool is_mute() const; diff --git a/src/npcmove.cpp b/src/npcmove.cpp index fa90a8e88c9c2..9bfdb865ddd45 100644 --- a/src/npcmove.cpp +++ b/src/npcmove.cpp @@ -419,6 +419,10 @@ bool npc::could_move_onto( const tripoint &p ) const { if( !here.passable( p ) ) { return false; } + if ( !move_in_vehicle(const_cast(this), p ) ) { + add_msg( m_bad, _( "%s is tryna go around." ), get_name().c_str() ); + return false; + } if( !sees_dangerous_field( p ) ) { return true; @@ -1808,25 +1812,25 @@ void npc::execute_action( npc_action action ) if( passenger != this && passenger != nullptr ) { continue; } - - + add_msg( m_warning, _( "SEAT: checking all boardable parts." ) ); // a seat is available if either unassigned or assigned to us - auto available_seat = [&]( const vehicle_part & pt ) { + auto available_seat = [&]( const vehicle_part & pt, const vpart_reference & checked_part ) { if( !pt.is_seat() ) { return false; } - if( vp.part_with_feature( VPFLAG_CARGO, true ) ) { + if( checked_part.part_with_feature( VPFLAG_CARGO, true ) ) { add_msg( m_warning, _( "SEAT: checking if its cargo." ) ); units::volume capacity = 0_ml; units::volume free_cargo = 0_ml; - auto cargo_parts = veh->get_parts_at( tar, "CARGO", part_status_flag::any ); + tripoint target = veh->global_part_pos3( pt ); + auto cargo_parts = veh->get_parts_at( target, "CARGO", part_status_flag::any ); for( auto& part : cargo_parts ) { add_msg( m_warning, _( "SEAT: cargo_parts initiated." ) ); vehicle_stack contents = veh->get_items( *part ); const vpart_info &vpinfo = part->info(); tripoint spot = veh->global_part_pos3( *part ); const optional_vpart_position checkpart = here.veh_at( spot ); - add_msg( m_warning, _( "SEAT: There's cargo where NPC wants to go." ) ); + add_msg( m_warning, _( "SEAT: There's cargo at %s." ), spot.to_string_writable() ); if ( !checkpart.part_with_feature( "CARGO_PASSABLE", true ) ) { add_msg( m_warning, _( "SEAT: CARGO_PASSABLE not found." ) ); capacity += vpinfo.size; @@ -1857,7 +1861,7 @@ void npc::execute_action( npc_action action ) // We probably wanted to go there in the last turn priority = 4; - } else if( available_seat( pt ) ) { + } else if( available_seat( pt, vp ) ) { // Assuming player "owns" a sensible vehicle seats should be in good spots to occupy // Prefer our assigned seat if we have one const npc *who = pt.crew(); @@ -2866,9 +2870,17 @@ void npc::move_to( const tripoint &pt, bool no_bashing, std::set *nomo } if( here.veh_at( p ).part_with_feature( VPFLAG_CARGO, true ) && !move_in_vehicle( this, p ) ) { - path.clear(); - move_pause(); - return; + auto other_points = here.get_dir_circle( pos(), p ); + for( const tripoint &ot : other_points ) { + if( could_move_onto( ot ) && ( nomove == nullptr || nomove->find( ot ) == nomove->end() ) ) { + p = ot; + break; + } else { + path.clear(); + move_pause(); + return; + } + } } // if( here.veh_at( p ).part_with_feature( VPFLAG_CARGO, true ) ) { From 87e23497990dfe9940efe35e7c15761550aacb70 Mon Sep 17 00:00:00 2001 From: fairyarmadillo <94415528+fairyarmadillo@users.noreply.github.com> Date: Mon, 18 Dec 2023 08:33:47 -0800 Subject: [PATCH 13/30] yeeeehaw --- data/json/effects.json | 21 +++++++++ data/json/vehicleparts/cargo.json | 2 +- data/json/vehicleparts/doors.json | 2 +- data/json/vehicleparts/vehicle_parts.json | 15 ++++--- data/json/vehicleparts/vp_flags.json | 4 ++ src/character.cpp | 52 ++++++++++++++--------- src/game.cpp | 28 ------------ src/monmove.cpp | 37 +++++++++++++++- src/monster.h | 2 + src/npc.cpp | 6 +-- src/npcmove.cpp | 51 +--------------------- src/veh_interact.cpp | 4 +- src/veh_type.cpp | 3 +- src/veh_type.h | 1 + 14 files changed, 115 insertions(+), 113 deletions(-) diff --git a/data/json/effects.json b/data/json/effects.json index 7274225ed00ca..c97dd39f0c49c 100644 --- a/data/json/effects.json +++ b/data/json/effects.json @@ -4604,5 +4604,26 @@ "venom_pain", "venom_weaken" ] + }, + { + "type": "effect_type", + "id": "cramped_space", + "name": [ "Cramped Space" ], + "desc": [ "You are painfully crammed into a space too small for your body." ], + "miss_messages": [ [ "You don't have any room to move!", 1 ] ], + "rating": "bad", + "resist_traits": [ "BENDY1", "BENDY2", "BENDY3" ], + "resist_effects": [ "incorporeal" ], + "pain_sizing": true, + "hurt_sizing": true, + "base_mods": { + "dex_mod": [ -2 ], + "str_mod": [ -2 ], + "speed_mod": [ -20 ], + "pain_min": [ 2 ], + "pain_chance": [ 100, 500 ], + "pain_max_val": [ 35 ] + }, + "show_in_info": true } ] diff --git a/data/json/vehicleparts/cargo.json b/data/json/vehicleparts/cargo.json index fef17d9acd507..a5db7d6d5981e 100644 --- a/data/json/vehicleparts/cargo.json +++ b/data/json/vehicleparts/cargo.json @@ -225,7 +225,7 @@ "removal": { "skills": [ [ "mechanics", 2 ] ], "time": "30 m", "using": [ [ "vehicle_weld_removal", 1 ] ] }, "repair": { "skills": [ [ "mechanics", 4 ] ], "time": "6 m", "using": [ [ "repair_welding_standard", 5 ] ] } }, - "flags": [ "UNMOUNT_ON_DAMAGE", "CARGO", "PROTRUSION", "COVERED", "BOARDABLE" ], + "flags": [ "UNMOUNT_ON_DAMAGE", "CARGO", "PROTRUSION", "COVERED", "BOARDABLE", "HUGE_OK" ], "damage_reduction": { "all": 26 }, "variants": [ { "symbols": "=", "symbols_broken": "#" } ] }, diff --git a/data/json/vehicleparts/doors.json b/data/json/vehicleparts/doors.json index 66e71da137de0..fe60b76c8c5ca 100644 --- a/data/json/vehicleparts/doors.json +++ b/data/json/vehicleparts/doors.json @@ -9,7 +9,7 @@ "damage_reduction": { "all": 20 }, "description": "A door. Has a window so you can see out of it, even when closed.", "durability": 225, - "flags": [ "CARGO", "CARGO_PASSABLE", "OBSTACLE", "OPENABLE", "BOARDABLE", "WINDOW", "DOOR", "LOCKABLE_DOOR" ], + "flags": [ "CARGO", "CARGO_PASSABLE", "OBSTACLE", "OPENABLE", "BOARDABLE", "WINDOW", "DOOR", "LOCKABLE_DOOR", "HUGE_OK" ], "item": "frame", "location": "center", "looks_like": "t_door_metal_c", diff --git a/data/json/vehicleparts/vehicle_parts.json b/data/json/vehicleparts/vehicle_parts.json index 38f9298fded18..4b907315859bf 100644 --- a/data/json/vehicleparts/vehicle_parts.json +++ b/data/json/vehicleparts/vehicle_parts.json @@ -121,7 +121,8 @@ "STEERABLE", "UNMOUNT_ON_DAMAGE", "UNSTABLE_WHEEL", - "WHEEL" + "WHEEL", + "HUGE_OK" ], "damage_reduction": { "all": 2 }, "variants": [ { "symbols": "H", "symbols_broken": "M" } ] @@ -160,7 +161,8 @@ "STEERABLE", "UNMOUNT_ON_DAMAGE", "UNSTABLE_WHEEL", - "WHEEL" + "WHEEL", + "HUGE_OK" ], "damage_reduction": { "all": 20 }, "variants": [ { "symbols": "H", "symbols_broken": "M" } ] @@ -187,7 +189,7 @@ "repair": { "skills": [ [ "fabrication", 1 ] ], "time": "5 m", "using": [ [ "repair_welding_standard", 1 ] ] } }, "breaks_into": [ { "item": "scrap", "count": [ 4, 6 ] } ], - "flags": [ "ENGINE", "BOARDABLE", "E_STARTS_INSTANTLY", "ANIMAL_CTRL", "HARNESS_human", "STEERABLE", "UNMOUNT_ON_DAMAGE" ], + "flags": [ "ENGINE", "BOARDABLE", "E_STARTS_INSTANTLY", "ANIMAL_CTRL", "HARNESS_human", "STEERABLE", "UNMOUNT_ON_DAMAGE", "HUGE_OK" ], "damage_reduction": { "all": 2 }, "variants": [ { "symbols": "-", "symbols_broken": "~" } ] }, @@ -864,7 +866,7 @@ "size": "75 L", "item": "frame_wood_light", "location": "center", - "flags": [ "CARGO", "BOARDABLE", "COVERED" ], + "flags": [ "CARGO", "BOARDABLE", "COVERED", "HUGE_OK" ], "breaks_into": [ { "item": "splinter", "count": [ 3, 5 ] }, { "item": "string_36", "count": [ 10, 15 ] } ], "requirements": { "install": { "time": "10 m", "using": [ [ "rope_natural_short", 1 ] ] }, @@ -2206,7 +2208,7 @@ }, "repair": { "skills": [ [ "mechanics", 2 ] ], "time": "20 m", "using": [ [ "repair_welding_standard", 12 ] ] } }, - "flags": [ "BOARDABLE", "CARGO", "COVERED" ], + "flags": [ "BOARDABLE", "CARGO", "COVERED", "HUGE_OK" ], "breaks_into": [ { "item": "steel_lump", "count": [ 6, 8 ] }, { "item": "steel_chunk", "count": [ 6, 8 ] }, @@ -2226,6 +2228,7 @@ "description": "A cargo space for carrying livestock. 'e'xamine it to capture an animal next to you, or to release the animal currently contained. When selecting an animal to capture, choose its tile relative to you, not the part.", "//1": "240cm weld to install, 60cm per damage quadrant to repair", "size": "200 L", + "comfort": 2, "item": "livestock_carrier", "location": "center", "requirements": { @@ -2241,7 +2244,7 @@ }, "repair": { "skills": [ [ "mechanics", 2 ] ], "time": "20 m", "using": [ [ "repair_welding_standard", 12 ] ] } }, - "flags": [ "BOARDABLE", "CARGO", "COVERED", "CAPTURE_MONSTER_VEH" ], + "flags": [ "BOARDABLE", "CARGO", "COVERED", "CAPTURE_MONSTER_VEH", "HUGE_OK", "BED" ], "breaks_into": [ { "item": "steel_lump", "count": [ 6, 8 ] }, { "item": "steel_chunk", "count": [ 6, 8 ] }, diff --git a/data/json/vehicleparts/vp_flags.json b/data/json/vehicleparts/vp_flags.json index 8dd67415408a6..8328abc58ec05 100644 --- a/data/json/vehicleparts/vp_flags.json +++ b/data/json/vehicleparts/vp_flags.json @@ -670,5 +670,9 @@ { "id": "CARGO_PASSABLE", "type": "json_flag" + }, + { + "id": "HUGE_OK", + "type": "json_flag" } ] diff --git a/src/character.cpp b/src/character.cpp index 195d8ca8ba020..6ed3d7eb292a4 100644 --- a/src/character.cpp +++ b/src/character.cpp @@ -223,6 +223,7 @@ static const efftype_id effect_contacts( "contacts" ); static const efftype_id effect_controlled( "controlled" ); static const efftype_id effect_corroding( "corroding" ); static const efftype_id effect_cough_suppress( "cough_suppress" ); +static const efftype_id effect_cramped_space( "cramped_space" ); static const efftype_id effect_darkness( "darkness" ); static const efftype_id effect_deaf( "deaf" ); static const efftype_id effect_dermatik( "dermatik" ); @@ -5063,23 +5064,22 @@ void Character::update_needs( int rate_multiplier ) mod_painkiller( -std::min( get_painkiller(), rate_multiplier ) ); } - // Huge folks take penalties for cramming themselves in vehicles - if( in_vehicle && get_size() == creature_size::huge && - !( has_flag( json_flag_PAIN_IMMUNE ) || has_effect( effect_narcosis ) ) ) { + // Being stuck in a tight space sucks. + if( has_effect( effect_cramped_space) ) { + if ( !in_vehicle ) { + remove_effect( effect_cramped_space ); + } + if ( move_in_vehicle( this, pos() ) ) { + remove_effect( effect_cramped_space ); + } vehicle *veh = veh_pointer_or_null( get_map().veh_at( pos() ) ); - // it's painful to work the controls, but passengers in open topped vehicles are fine - if( veh && ( veh->enclosed_at( pos() ) || veh->player_in_control( *this ) ) ) { - add_msg_if_player( m_bad, - _( "You're cramping up from stuffing yourself in this vehicle." ) ); - if( is_npc() ) { - npc &as_npc = dynamic_cast( *this ); - as_npc.complain_about( "cramped_vehicle", 1_hours, "", false ); + if( ( veh->player_in_control( *this ) ) ) { + } + if( is_npc() && !has_effect( effect_narcosis ) ) { + npc &as_npc = dynamic_cast( *this ); + as_npc.complain_about( "cramped_vehicle", 1_hours, "", false ); } - - mod_pain( rng( 4, 6 ) ); - mod_focus( -1 ); } - } } needs_rates Character::calc_needs_rates() const { @@ -5572,7 +5572,7 @@ Character::comfort_response_t Character::base_comfort_value( const tripoint &p ) } else { comfort -= here.move_cost( p ); } - if( vp->vehicle().enclosed_at( p ) && get_size() == creature_size::huge ) { + if( has_effect( effect_cramped_space) ) { comfort = static_cast( comfort_level::impossible ); } } @@ -7961,23 +7961,35 @@ bool Character::move_in_vehicle(Creature* c, const tripoint& dest_loc) const const vpart_info &vpinfo = part->info(); const optional_vpart_position vp = m.veh_at( dest_loc ); if ( !vp.part_with_feature("CARGO_PASSABLE", true ) ) { - add_msg( m_warning, _( "There's cargo there." ) ); capacity += vpinfo.size; free_cargo += contents.free_volume(); } } if( capacity > 0_ml ) { + const optional_vpart_position vp = m.veh_at( dest_loc ); add_msg( m_warning, _( "Free cargo is %s." ), format_volume( free_cargo ) ); - // First, we'll try to squeeze in. - if( ( ( get_size() > creature_size::tiny ) && free_cargo < 15625_ml ) || ( ( get_size() > creature_size::small ) && free_cargo < 31250_ml ) || ( ( get_size() > creature_size::medium ) && free_cargo < 62500_ml ) || ( ( get_size() > creature_size::large ) && free_cargo < 125000_ml ) || ( ( get_size() > creature_size::huge ) && free_cargo < 250000_ml ) ) { - if( ( ( get_size() > creature_size::tiny ) && free_cargo < 11719_ml ) || ( ( get_size() > creature_size::small ) && free_cargo < 23438_ml ) || ( ( get_size() > creature_size::medium ) && free_cargo < 46875_ml ) || ( ( get_size() > creature_size::large ) && free_cargo < 93750_ml ) || ( ( get_size() > creature_size::huge ) && free_cargo < 187500_ml ) ) { + // First, we'll try to squeeze in. Open-topped vehicle parts have more room for us. + if( !veh.enclosed_at( dest_loc ) ) { + free_cargo *= 1.2; + } + if( ( ( get_size() == creature_size::tiny ) && free_cargo < 15625_ml ) || ( ( get_size() == creature_size::small ) && free_cargo < 31250_ml ) || ( ( get_size() == creature_size::medium ) && free_cargo < 62500_ml ) || ( ( get_size() == creature_size::large ) && free_cargo < 125000_ml ) || ( ( get_size() == creature_size::huge ) && free_cargo < 250000_ml ) ) { + if( ( ( get_size() == creature_size::tiny ) && free_cargo < 11719_ml ) || ( ( get_size() == creature_size::small ) && free_cargo < 23438_ml ) || ( ( get_size() == creature_size::medium ) && free_cargo < 46875_ml ) || ( ( get_size() == creature_size::large ) && free_cargo < 93750_ml ) || ( ( get_size() == creature_size::huge ) && free_cargo < 187500_ml ) ) { add_msg_if_player( m_warning, _( "There's not enough room for you to fit there." ) ); - add_msg_if_npc( m_warning, _( "There's not enough room for %s to fit there." ), c->disp_name() ); return false; // Even if you squeeze, there's no room. } + // Sufficiently gigantic characters aren't comfortable in stock seats, roof or no. + if( get_size() == creature_size::huge ) { + if ( !vp.part_with_feature( "AISLE", true ) || !vp.part_with_feature( "HUGE_OK", true ) ) { + add_msg_if_player( m_warning, _( "You barely fit in this tiny human vehicle." ) ); + add_msg_if_npc( m_warning, _( "%s has to really cram their huge body to fit." ), c->disp_name() ); + c->add_effect( effect_cramped_space, 2_turns, true ); + return true; + } + } add_msg_if_player( m_warning, _( "You contort your body to squeeze into the cramped space." ) ); add_msg_if_npc( m_warning, _( "%s contorts their body to fit into the cramped space." ), c->disp_name() ); + c->add_effect( effect_cramped_space, 2_turns, true ); return true; } } diff --git a/src/game.cpp b/src/game.cpp index 4359ef4b2fe6b..1f877503e0f5a 100644 --- a/src/game.cpp +++ b/src/game.cpp @@ -10423,34 +10423,6 @@ bool game::walk_move( const tripoint &dest_loc, const bool via_ramp, const bool if( vp_there && !u.move_in_vehicle(static_cast(&u), dest_loc) ) { return false; } -// add_msg( m_warning, _( "VP is there." ) ); -// vehicle &veh = vp_there->vehicle(); -// units::volume capacity = 0_ml; -// units::volume free_cargo = 0_ml; -// auto cargo_parts = veh.get_parts_at( dest_loc, "CARGO", part_status_flag::any ); -// for( auto& part : cargo_parts ) { -// vehicle_stack contents = veh.get_items( *part ); -// const vpart_info &vpinfo = part->info(); -// const optional_vpart_position vp = m.veh_at( dest_loc ); -// if ( !vp.part_with_feature("CARGO_PASSABLE", true ) ) { -// add_msg( m_warning, _( "There's cargo there." ) ); -// capacity += vpinfo.size; -// free_cargo += contents.free_volume(); -// } -// } -// if( capacity > 0_ml ) { -// add_msg( m_warning, _( "Free cargo is %s." ), format_volume( free_cargo ) ); -// // First, we'll try to squeeze in. -// if( ( ( u.get_size() > creature_size::tiny ) && free_cargo < 15625_ml ) || ( ( u.get_size() > creature_size::small ) && free_cargo < 31250_ml ) || ( ( u.get_size() > creature_size::medium ) && free_cargo < 62500_ml ) || ( ( u.get_size() > creature_size::large ) && free_cargo < 125000_ml ) || ( ( u.get_size() > creature_size::huge ) && free_cargo < 250000_ml ) ) { -// if( ( ( u.get_size() > creature_size::tiny ) && free_cargo < 11719_ml ) || ( ( u.get_size() > creature_size::small ) && free_cargo < 23438_ml ) || ( ( u.get_size() > creature_size::medium ) && free_cargo < 46875_ml ) || ( ( u.get_size() > creature_size::large ) && free_cargo < 93750_ml ) || ( ( u.get_size() > creature_size::huge ) && free_cargo < 187500_ml ) ) { -// u.add_msg_if_player( m_warning, _( "There's not enough room for you to fit there." ) ); -// return false; // Even if you squeeze, there's no room. -// } -// u.add_msg_if_player( m_warning, _( "You contort your body to squeeze into the cramped space." ) ); -// } -// -// } -// } if( !shifting_furniture && !pushing && is_dangerous_tile( dest_loc ) ) { std::vector harmful_stuff = get_dangerous_tile( dest_loc ); diff --git a/src/monmove.cpp b/src/monmove.cpp index 50db8e34a16e5..614afb9063a56 100644 --- a/src/monmove.cpp +++ b/src/monmove.cpp @@ -50,6 +50,7 @@ #include "translations.h" #include "trap.h" #include "units.h" +#include "veh_type.h" #include "vehicle.h" #include "viewer.h" #include "vpart_position.h" @@ -163,6 +164,36 @@ static bool z_is_valid( int z ) return z >= -OVERMAP_DEPTH && z <= OVERMAP_HEIGHT; } +bool monster::monster_move_in_vehicle( const tripoint& p ) const +{ + map &m = get_map(); + const optional_vpart_position vp_there = m.veh_at( p ); + if( vp_there ) { + vehicle &veh = vp_there->vehicle(); + units::volume capacity = 0_ml; + units::volume free_cargo = 0_ml; + auto cargo_parts = veh.get_parts_at( p, "CARGO", part_status_flag::any ); + for( auto& part : cargo_parts ) { + vehicle_stack contents = veh.get_items( *part ); + const vpart_info &vpinfo = part->info(); + const optional_vpart_position vp = m.veh_at( p ); + if ( !vp.part_with_feature("CARGO_PASSABLE", true ) ) { + capacity += vpinfo.size; + free_cargo += contents.free_volume(); + } + } + if( capacity > 0_ml ) { + // Unlike characters, monsters don't squeeze, they fit or they don't. + if( ( ( get_size() > creature_size::tiny ) && free_cargo < 11719_ml ) || ( ( get_size() > creature_size::small ) && free_cargo < 23438_ml ) || ( ( get_size() > creature_size::medium ) && free_cargo < 46875_ml ) || ( ( get_size() > creature_size::large ) && free_cargo < 93750_ml ) || ( ( get_size() > creature_size::huge ) && free_cargo < 187500_ml ) ) { + return false; + } + } + } + return true; +} + + + bool monster::will_move_to( const tripoint &p ) const { map &here = get_map(); @@ -177,11 +208,15 @@ bool monster::will_move_to( const tripoint &p ) const } if( !here.has_vehicle_floor( p ) ) { - if( ( !can_submerge() && !flies() ) && here.has_flag( ter_furn_flag::TFLAG_DEEP_WATER, p ) ) { + if( !can_submerge() && !flies() && here.has_flag( ter_furn_flag::TFLAG_DEEP_WATER, p ) ) { return false; } } + if( here.veh_at( p ).part_with_feature( VPFLAG_CARGO, true ) && !monster_move_in_vehicle( p ) ) { + return false; + } + if( digs() && !here.has_flag( ter_furn_flag::TFLAG_DIGGABLE, p ) && !here.has_flag( ter_furn_flag::TFLAG_BURROWABLE, p ) ) { return false; diff --git a/src/monster.h b/src/monster.h index 48f571552d2d2..9a0696b2d0a5f 100644 --- a/src/monster.h +++ b/src/monster.h @@ -212,6 +212,8 @@ class monster : public Creature bool will_move_to( const tripoint &p ) const; bool know_danger_at( const tripoint &p ) const; + bool monster_move_in_vehicle( const tripoint &dest_loc ) const; + bool will_reach( const point &p ); // Do we have plans to get to (x, y)? int turns_to_reach( const point &p ); // How long will it take? diff --git a/src/npc.cpp b/src/npc.cpp index 7a1429ce04551..c48d5a862c4a7 100644 --- a/src/npc.cpp +++ b/src/npc.cpp @@ -3510,8 +3510,8 @@ std::set npc::get_path_avoid() const } } - for( const tripoint &p : here.points_in_radius( pos(), 5 ) ) { - if( sees_dangerous_field( p ) ) { + for( const tripoint &p : here.points_in_radius( pos(), 6 ) ) { + if( sees_dangerous_field( p ) || ( here.veh_at( p ).part_with_feature( VPFLAG_CARGO, true ) && !move_in_vehicle( const_cast(this), p ) ) ) { ret.insert( p ); } } @@ -3979,4 +3979,4 @@ std::unique_ptr get_talker_for( npc &guy ) std::unique_ptr get_talker_for( npc *guy ) { return std::make_unique( guy ); -} +} \ No newline at end of file diff --git a/src/npcmove.cpp b/src/npcmove.cpp index 9bfdb865ddd45..a25b036d75c47 100644 --- a/src/npcmove.cpp +++ b/src/npcmove.cpp @@ -1812,37 +1812,31 @@ void npc::execute_action( npc_action action ) if( passenger != this && passenger != nullptr ) { continue; } - add_msg( m_warning, _( "SEAT: checking all boardable parts." ) ); // a seat is available if either unassigned or assigned to us auto available_seat = [&]( const vehicle_part & pt, const vpart_reference & checked_part ) { if( !pt.is_seat() ) { return false; } if( checked_part.part_with_feature( VPFLAG_CARGO, true ) ) { - add_msg( m_warning, _( "SEAT: checking if its cargo." ) ); units::volume capacity = 0_ml; units::volume free_cargo = 0_ml; tripoint target = veh->global_part_pos3( pt ); auto cargo_parts = veh->get_parts_at( target, "CARGO", part_status_flag::any ); for( auto& part : cargo_parts ) { - add_msg( m_warning, _( "SEAT: cargo_parts initiated." ) ); vehicle_stack contents = veh->get_items( *part ); const vpart_info &vpinfo = part->info(); tripoint spot = veh->global_part_pos3( *part ); const optional_vpart_position checkpart = here.veh_at( spot ); - add_msg( m_warning, _( "SEAT: There's cargo at %s." ), spot.to_string_writable() ); if ( !checkpart.part_with_feature( "CARGO_PASSABLE", true ) ) { - add_msg( m_warning, _( "SEAT: CARGO_PASSABLE not found." ) ); capacity += vpinfo.size; free_cargo += contents.free_volume(); } } if( capacity > 0_ml ) { - add_msg( m_warning, _( "SEAT: Free cargo for NPC seat is %s." ), format_volume( free_cargo ) ); // First, we'll try to squeeze in. if( ( ( get_size() > creature_size::tiny ) && free_cargo < 15625_ml ) || ( ( get_size() > creature_size::small ) && free_cargo < 31250_ml ) || ( ( get_size() > creature_size::medium ) && free_cargo < 62500_ml ) || ( ( get_size() > creature_size::large ) && free_cargo < 125000_ml ) || ( ( get_size() > creature_size::huge ) && free_cargo < 250000_ml ) ) { if( ( ( get_size() > creature_size::tiny ) && free_cargo < 11719_ml ) || ( ( get_size() > creature_size::small ) && free_cargo < 23438_ml ) || ( ( get_size() > creature_size::medium ) && free_cargo < 46875_ml ) || ( ( get_size() > creature_size::large ) && free_cargo < 93750_ml ) || ( ( get_size() > creature_size::huge ) && free_cargo < 187500_ml ) ) { - add_msg( m_warning, _( "SEAT: There's not enough room for NPC to fit there, free cargo is %s." ), format_volume( free_cargo ) ); + add_msg_debug( debugmode::DF_NPC, "%s can't find a seat with enough free space.", disp_name() ); return false; } } @@ -2883,49 +2877,6 @@ void npc::move_to( const tripoint &pt, bool no_bashing, std::set *nomo } } - // if( here.veh_at( p ).part_with_feature( VPFLAG_CARGO, true ) ) { - // add_msg( m_warning, _( "Cargo found for npc." ) ); - // const optional_vpart_position vp = here.veh_at( p ); - // vehicle &veh1 = vp->vehicle(); - // units::volume capacity = 0_ml; - // units::volume free_cargo = 0_ml; - // auto cargo_parts = veh1.get_parts_at( p, "CARGO", part_status_flag::any ); - // for( auto& part : cargo_parts ) { - // vehicle_stack contents = veh1.get_items( *part ); - // const vpart_info &vpinfo = part->info(); - // const optional_vpart_position vp = here.veh_at( p ); - // if ( !vp.part_with_feature("CARGO_PASSABLE", true ) ) { - // add_msg( m_warning, _( "There's cargo where NPC wants to go." ) ); - // capacity += vpinfo.size; - // free_cargo += contents.free_volume(); - // } - // } - // if( capacity > 0_ml ) { - // add_msg( m_warning, _( "Free cargo for NPC spot is %s." ), format_volume( free_cargo ) ); - // First, we'll try to squeeze in. - // if( ( ( get_size() > creature_size::tiny ) && free_cargo < 15625_ml ) || ( ( get_size() > creature_size::small ) && free_cargo < 31250_ml ) || ( ( get_size() > creature_size::medium ) && free_cargo < 62500_ml ) || ( ( get_size() > creature_size::large ) && free_cargo < 125000_ml ) || ( ( get_size() > creature_size::huge ) && free_cargo < 250000_ml ) ) { - // if( ( ( get_size() > creature_size::tiny ) && free_cargo < 11719_ml ) || ( ( get_size() > creature_size::small ) && free_cargo < 23438_ml ) || ( ( get_size() > creature_size::medium ) && free_cargo < 46875_ml ) || ( ( get_size() > creature_size::large ) && free_cargo < 93750_ml ) || ( ( get_size() > creature_size::huge ) && free_cargo < 187500_ml ) ) { - // add_msg( m_warning, _( "There's not enough room for NPC to fit there, free cargo is %s." ), format_volume( free_cargo ) ); - // Move to a neighbor field instead, if possible. - // Maybe this code already exists somewhere? - //auto other_points = here.get_dir_circle( pos(), p ); - // for( const tripoint &ot : other_points ) { - // if( could_move_onto( ot ) && ( nomove == nullptr || nomove->find( ot ) == nomove->end() ) ) { - // p = ot; - // break; - // } - // } - // } - // path.clear(); - // move_pause(); - // return; - // } - // } - // add_msg( m_warning, _( "There's room for NPC to fit there, free cargo is %s." ), format_volume( free_cargo ) ); - //} - - - recoil = MAX_RECOIL; if( has_effect( effect_stunned ) || has_effect( effect_psi_stunned ) ) { diff --git a/src/veh_interact.cpp b/src/veh_interact.cpp index de0cd73e660e8..606dc591b0633 100644 --- a/src/veh_interact.cpp +++ b/src/veh_interact.cpp @@ -2930,8 +2930,8 @@ void veh_interact::display_details( const vpart_info *part ) } // line 5 [vertical/hybrid] flags - std::vector flags = { { "OPAQUE", "OPENABLE", "BOARDABLE" } }; - std::vector flag_labels = { { _( "opaque" ), _( "openable" ), _( "boardable" ) } }; + std::vector flags = { { "OPAQUE", "OPENABLE", "BOARDABLE", "CARGO_PASSABLE" } }; + std::vector flag_labels = { { _( "opaque" ), _( "openable" ), _( "boardable" ), _( "secure storage" ) } }; std::string label; for( size_t i = 0; i < flags.size(); i++ ) { if( part->has_flag( flags[i] ) ) { diff --git a/src/veh_type.cpp b/src/veh_type.cpp index b863081707195..22cfb24c0cd68 100644 --- a/src/veh_type.cpp +++ b/src/veh_type.cpp @@ -138,7 +138,8 @@ static const std::unordered_map vpart_bitflag_map = { "ROOF", VPFLAG_ROOF }, { "CABLE_PORTS", VPFLAG_CABLE_PORTS }, { "BATTERY", VPFLAG_BATTERY }, - { "POWER_TRANSFER", VPFLAG_POWER_TRANSFER } + { "POWER_TRANSFER", VPFLAG_POWER_TRANSFER }, + { "HUGE_OK", VPFLAG_HUGE_OK } }; static std::map vpart_migrations; diff --git a/src/veh_type.h b/src/veh_type.h index 2f23bca1b0051..82552a0d8a0e4 100644 --- a/src/veh_type.h +++ b/src/veh_type.h @@ -111,6 +111,7 @@ enum vpart_bitflags : int { VPFLAG_CABLE_PORTS, VPFLAG_BATTERY, VPFLAG_POWER_TRANSFER, + VPFLAG_HUGE_OK, NUM_VPFLAGS }; From be706f107f04f9ea95c72358e5f8a7f7a0931217 Mon Sep 17 00:00:00 2001 From: fairyarmadillo <94415528+fairyarmadillo@users.noreply.github.com> Date: Mon, 18 Dec 2023 09:00:03 -0800 Subject: [PATCH 14/30] adjustments --- data/json/vehicleparts/seats.json | 8 ++++---- data/json/vehicleparts/vehicle_parts.json | 6 +++--- 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/data/json/vehicleparts/seats.json b/data/json/vehicleparts/seats.json index f48a74fa07714..68db65780b6a0 100644 --- a/data/json/vehicleparts/seats.json +++ b/data/json/vehicleparts/seats.json @@ -49,7 +49,7 @@ "using": [ [ "repair_welding_standard", 1 ], [ "sewing_standard", 8 ] ] } }, - "size": "63 L", + "size": "80 L", "type": "vehicle_part", "variants_bases": [ { "id": "windshield", "label": "Windshield" }, { "id": "swivel_chair", "label": "Swivel Chair" } ], "variants": [ @@ -78,7 +78,7 @@ "comfort": 3, "description": "A soft seat with an adjustable backrest, making it a reasonably comfortable place to sleep.", "durability": 100, - "size": "62500 ml", + "size": "84000 ml", "floor_bedding_warmth": 350, "name": { "str": "reclining bucket seat" }, "extend": { "flags": [ "BED" ] }, @@ -103,7 +103,7 @@ "floor_bedding_warmth": 500, "item": "seat_bench", "name": { "str": "bench seat" }, - "size": "65 L", + "size": "80 L", "extend": { "flags": [ "BED" ] }, "type": "vehicle_part" }, @@ -181,7 +181,7 @@ "removal": { "skills": [ [ "mechanics", 2 ] ], "time": "30 m", "using": "vehicle_weld_removal" }, "repair": { "skills": [ [ "mechanics", 2 ] ], "time": "60 m", "using": [ [ "repair_welding_standard", 2 ] ] } }, - "size": "0 ml", + "size": "62500 ml", "delete": { "flags": [ "CARGO" ] }, "type": "vehicle_part" } diff --git a/data/json/vehicleparts/vehicle_parts.json b/data/json/vehicleparts/vehicle_parts.json index 4b907315859bf..ab9372f741ec4 100644 --- a/data/json/vehicleparts/vehicle_parts.json +++ b/data/json/vehicleparts/vehicle_parts.json @@ -204,7 +204,7 @@ "damage_modifier": 60, "durability": 95, "description": "A small but comfortable bed.", - "size": "70 L", + "size": "150 L", "item": "mattress", "comfort": 4, "floor_bedding_warmth": 700, @@ -2227,7 +2227,7 @@ "durability": 250, "description": "A cargo space for carrying livestock. 'e'xamine it to capture an animal next to you, or to release the animal currently contained. When selecting an animal to capture, choose its tile relative to you, not the part.", "//1": "240cm weld to install, 60cm per damage quadrant to repair", - "size": "200 L", + "size": "300 L", "comfort": 2, "item": "livestock_carrier", "location": "center", @@ -2519,7 +2519,7 @@ "name": { "str": "wooden bench" }, "copy-from": "seat_wood", "durability": 150, - "size": "65 L", + "size": "62500 ml", "description": "A benchlike place to sit." }, { From d070fa7960ef02d1eabf6ebda406a5e4571265c7 Mon Sep 17 00:00:00 2001 From: fairyarmadillo <94415528+fairyarmadillo@users.noreply.github.com> Date: Tue, 19 Dec 2023 10:48:54 -0800 Subject: [PATCH 15/30] Updates --- data/json/effects.json | 2 + data/json/npcs/talk_tags.json | 21 ++++-- data/json/vehicleparts/seats.json | 2 - data/json/vehicleparts/vehicle_parts.json | 3 +- data/json/vehicleparts/vp_flags.json | 6 +- src/character.cpp | 89 +++++++++++++++-------- src/monmove.cpp | 34 +++++++-- src/monster.h | 2 +- 8 files changed, 109 insertions(+), 50 deletions(-) diff --git a/data/json/effects.json b/data/json/effects.json index 782277d5ea686..f8280de7f4ce9 100644 --- a/data/json/effects.json +++ b/data/json/effects.json @@ -4644,6 +4644,8 @@ "name": [ "Cramped Space" ], "desc": [ "You are painfully crammed into a space too small for your body." ], "miss_messages": [ [ "You don't have any room to move!", 1 ] ], + "apply_message": "You are squeezed uncomfortably into the cramped space.", + "remove_message": "It feels good having room to move again.", "rating": "bad", "resist_traits": [ "BENDY1", "BENDY2", "BENDY3" ], "resist_effects": [ "incorporeal" ], diff --git a/data/json/npcs/talk_tags.json b/data/json/npcs/talk_tags.json index 111e9088b7e95..b60b504c54d12 100644 --- a/data/json/npcs/talk_tags.json +++ b/data/json/npcs/talk_tags.json @@ -1015,18 +1015,23 @@ "category": "", "//": "NPC complaint if a HUGE NPC is taking pain from being inside a vehicle. Key points are that the NPC is HUGE and they're in a confined vehicle, along with some hints on how to resolve it.", "text": [ - "Can I get out and walk? This vehicle is too small.", + "Can I get out and walk? This spot is too cramped.", "How about we make the next vehicle a convertible?", "This vehicle is too small.", + "Argh, I don't fit!", "I'm not a contortionist!", - "I can't fit in your tiny human vehicle.", - "This sucks. I'm too big.", + "There's not enough room for me here.", + "This spot is squeezing the life out of me.", + "I can hardly breathe, crammed in like this.", + "I'm like a sardine over here!.", + "Ugh, I'm getting squashed.", + "How about we stop and stretch our legs?", + "I could use a break from being wedged in like this.", + "This is like being in a trash compactor.", + ", I can barely move!", "This space was not designed for big boned people.", - "So the fact I am huge isn't an issue to you? As it is to me.", - "I don't like being a mutant crammed into your tiny little vehicle.", - "Getting awfully cramped in here.", - "I don't think this vehicle was designed for someone like me.", - "It's tighter than a nun's cunt in here!'" + "I don't like being crammed in like this.", + "Getting awfully cramped in here." ] }, { diff --git a/data/json/vehicleparts/seats.json b/data/json/vehicleparts/seats.json index 68db65780b6a0..567a9288cc744 100644 --- a/data/json/vehicleparts/seats.json +++ b/data/json/vehicleparts/seats.json @@ -103,7 +103,6 @@ "floor_bedding_warmth": 500, "item": "seat_bench", "name": { "str": "bench seat" }, - "size": "80 L", "extend": { "flags": [ "BED" ] }, "type": "vehicle_part" }, @@ -182,7 +181,6 @@ "repair": { "skills": [ [ "mechanics", 2 ] ], "time": "60 m", "using": [ [ "repair_welding_standard", 2 ] ] } }, "size": "62500 ml", - "delete": { "flags": [ "CARGO" ] }, "type": "vehicle_part" } ] diff --git a/data/json/vehicleparts/vehicle_parts.json b/data/json/vehicleparts/vehicle_parts.json index ab9372f741ec4..53e8e51c1bb15 100644 --- a/data/json/vehicleparts/vehicle_parts.json +++ b/data/json/vehicleparts/vehicle_parts.json @@ -204,7 +204,7 @@ "damage_modifier": 60, "durability": 95, "description": "A small but comfortable bed.", - "size": "150 L", + "size": "100 L", "item": "mattress", "comfort": 4, "floor_bedding_warmth": 700, @@ -2519,7 +2519,6 @@ "name": { "str": "wooden bench" }, "copy-from": "seat_wood", "durability": 150, - "size": "62500 ml", "description": "A benchlike place to sit." }, { diff --git a/data/json/vehicleparts/vp_flags.json b/data/json/vehicleparts/vp_flags.json index 8328abc58ec05..9a06d4cb567a4 100644 --- a/data/json/vehicleparts/vp_flags.json +++ b/data/json/vehicleparts/vp_flags.json @@ -669,10 +669,12 @@ }, { "id": "CARGO_PASSABLE", - "type": "json_flag" + "type": "json_flag", + "info": "Items stored here won't get in the way of any passengers." }, { "id": "HUGE_OK", - "type": "json_flag" + "type": "json_flag", + "info": "Even when roofed, this part is roomy enough to comfortably admit very large creatures, like cows and horses." } ] diff --git a/src/character.cpp b/src/character.cpp index af117a3695f97..bb3db2af1ed4b 100644 --- a/src/character.cpp +++ b/src/character.cpp @@ -5093,22 +5093,8 @@ void Character::update_needs( int rate_multiplier ) } // Being stuck in a tight space sucks. - if( has_effect( effect_cramped_space) ) { - if ( !in_vehicle ) { - remove_effect( effect_cramped_space ); - } - if ( move_in_vehicle( this, pos() ) ) { - remove_effect( effect_cramped_space ); - } - vehicle *veh = veh_pointer_or_null( get_map().veh_at( pos() ) ); - if( ( veh->player_in_control( *this ) ) ) { - } - if( is_npc() && !has_effect( effect_narcosis ) ) { - npc &as_npc = dynamic_cast( *this ); - as_npc.complain_about( "cramped_vehicle", 1_hours, "", false ); - } - } } + needs_rates Character::calc_needs_rates() const { const effect &sleep = get_effect( effect_sleep ); @@ -7979,7 +7965,7 @@ bool Character::move_in_vehicle(Creature* c, const tripoint& dest_loc) const map &m = get_map(); const optional_vpart_position vp_there = m.veh_at( dest_loc ); if( vp_there ) { - add_msg( m_warning, _( "VP is there." ) ); + //const optional_vpart_position vp_there = m.veh_at( dest_loc ); vehicle &veh = vp_there->vehicle(); units::volume capacity = 0_ml; units::volume free_cargo = 0_ml; @@ -7995,8 +7981,6 @@ bool Character::move_in_vehicle(Creature* c, const tripoint& dest_loc) const } if( capacity > 0_ml ) { - const optional_vpart_position vp = m.veh_at( dest_loc ); - add_msg( m_warning, _( "Free cargo is %s." ), format_volume( free_cargo ) ); // First, we'll try to squeeze in. Open-topped vehicle parts have more room for us. if( !veh.enclosed_at( dest_loc ) ) { free_cargo *= 1.2; @@ -8006,21 +7990,18 @@ bool Character::move_in_vehicle(Creature* c, const tripoint& dest_loc) const add_msg_if_player( m_warning, _( "There's not enough room for you to fit there." ) ); return false; // Even if you squeeze, there's no room. } - // Sufficiently gigantic characters aren't comfortable in stock seats, roof or no. - if( get_size() == creature_size::huge ) { - if ( !vp.part_with_feature( "AISLE", true ) || !vp.part_with_feature( "HUGE_OK", true ) ) { - add_msg_if_player( m_warning, _( "You barely fit in this tiny human vehicle." ) ); - add_msg_if_npc( m_warning, _( "%s has to really cram their huge body to fit." ), c->disp_name() ); - c->add_effect( effect_cramped_space, 2_turns, true ); - return true; - } - } - add_msg_if_player( m_warning, _( "You contort your body to squeeze into the cramped space." ) ); - add_msg_if_npc( m_warning, _( "%s contorts their body to fit into the cramped space." ), c->disp_name() ); c->add_effect( effect_cramped_space, 2_turns, true ); return true; } } + const optional_vpart_position vp = m.veh_at( dest_loc ); + // Sufficiently gigantic characters aren't comfortable in stock seats, roof or no. + if( get_size() == creature_size::huge && !vp.part_with_feature( "AISLE", true ) && !vp.part_with_feature( "HUGE_OK", true ) && !has_effect( effect_cramped_space ) ) { + add_msg_if_player( m_warning, _( "You barely fit in this tiny human vehicle." ) ); + add_msg_if_npc( m_warning, _( "%s has to really cram their huge body to fit." ), c->disp_name() ); + c->add_effect( effect_cramped_space, 2_turns, true ); + return true; + } } return true; } @@ -10912,6 +10893,56 @@ void Character::process_effects() terminating_effects.pop(); } + // Being stuck in tight spaces sucks. TODO: could be expanded to apply to non-vehicle conditions. + if( has_effect( effect_cramped_space ) && !in_vehicle ) { + remove_effect( effect_cramped_space ); + } + // Check all of this here to ensure the player can't sit in a comfortable seat and then drop 50 liters of junk in their own lap. + if( in_vehicle ) { + map &here = get_map(); + const tripoint your_pos = pos(); + if ( in_vehicle ) { + if( is_npc() && !has_effect( effect_narcosis ) && has_effect( effect_cramped_space ) ) { + npc &as_npc = dynamic_cast( *this ); + as_npc.complain_about( "cramped_vehicle", 1_hours, "", false ); + } + } + const optional_vpart_position vp_there = here.veh_at( your_pos ); + vehicle &veh = vp_there->vehicle(); + units::volume capacity = 0_ml; + units::volume free_cargo = 0_ml; + auto cargo_parts = veh.get_parts_at( your_pos, "CARGO", part_status_flag::any ); + for( auto& part : cargo_parts ) { + vehicle_stack contents = veh.get_items( *part ); + const vpart_info &vpinfo = part->info(); + const optional_vpart_position vp = here.veh_at( your_pos ); + if ( !vp.part_with_feature("CARGO_PASSABLE", true ) ) { + capacity += vpinfo.size; + free_cargo += contents.free_volume(); + } + } + if( capacity > 0_ml ) { + // Open-topped vehicle parts have more room. + if( !veh.enclosed_at( your_pos ) ) { + free_cargo *= 1.2; + } + if( ( ( get_size() == creature_size::tiny ) && free_cargo < 15625_ml ) || ( ( get_size() == creature_size::small ) && free_cargo < 31250_ml ) || ( ( get_size() == creature_size::medium ) && free_cargo < 62500_ml ) || ( ( get_size() == creature_size::large ) && free_cargo < 125000_ml ) || ( ( get_size() == creature_size::huge ) && free_cargo < 250000_ml ) ) { + if( !has_effect( effect_cramped_space ) ) { + add_effect( effect_cramped_space, 2_turns, true ); + } + return; + } + } + const optional_vpart_position vp = here.veh_at( your_pos ); + if( get_size() == creature_size::huge && !vp.part_with_feature( "AISLE", true ) && !vp.part_with_feature( "HUGE_OK", true ) ) { + if( !has_effect( effect_cramped_space ) ) { + add_effect( effect_cramped_space, 2_turns, true ); + } + return; + } + remove_effect( effect_cramped_space ); + } + if( has_effect( effect_boomered ) && ( is_avatar() || is_npc() ) && one_in( 10 ) && !has_trait( trait_COMPOUND_EYES ) && !has_effect( effect_pre_conjunctivitis_bacterial ) && !has_effect( effect_pre_conjunctivitis_viral ) && !has_effect( effect_conjunctivitis_bacterial ) && diff --git a/src/monmove.cpp b/src/monmove.cpp index 614afb9063a56..d68889ff5b383 100644 --- a/src/monmove.cpp +++ b/src/monmove.cpp @@ -59,6 +59,7 @@ static const damage_type_id damage_cut( "cut" ); static const efftype_id effect_bouldering( "bouldering" ); static const efftype_id effect_countdown( "countdown" ); +static const efftype_id effect_cramped_space( "cramped_space" ); static const efftype_id effect_docile( "docile" ); static const efftype_id effect_downed( "downed" ); static const efftype_id effect_dragging( "dragging" ); @@ -104,6 +105,7 @@ static const mon_flag_str_id mon_flag_PATH_AVOID_DANGER_1( "PATH_AVOID_DANGER_1" static const mon_flag_str_id mon_flag_PATH_AVOID_DANGER_2( "PATH_AVOID_DANGER_2" ); static const mon_flag_str_id mon_flag_PATH_AVOID_FALL( "PATH_AVOID_FALL" ); static const mon_flag_str_id mon_flag_PATH_AVOID_FIRE( "PATH_AVOID_FIRE" ); +static const mon_flag_str_id mon_flag_PLASTIC( "PLASTIC" ); static const mon_flag_str_id mon_flag_PRIORITIZE_TARGETS( "PRIORITIZE_TARGETS" ); static const mon_flag_str_id mon_flag_PUSH_MON( "PUSH_MON" ); static const mon_flag_str_id mon_flag_PUSH_VEH( "PUSH_VEH" ); @@ -112,6 +114,7 @@ static const mon_flag_str_id mon_flag_RIDEABLE_MECH( "RIDEABLE_MECH" ); static const mon_flag_str_id mon_flag_SEES( "SEES" ); static const mon_flag_str_id mon_flag_SHORTACIDTRAIL( "SHORTACIDTRAIL" ); static const mon_flag_str_id mon_flag_SLUDGETRAIL( "SLUDGETRAIL" ); +static const mon_flag_str_id mon_flag_SMALL_HIDER( "SMALL_HIDER" ); static const mon_flag_str_id mon_flag_SMALLSLUDGETRAIL( "SMALLSLUDGETRAIL" ); static const mon_flag_str_id mon_flag_SMELLS( "SMELLS" ); static const mon_flag_str_id mon_flag_STUMBLES( "STUMBLES" ); @@ -167,7 +170,11 @@ static bool z_is_valid( int z ) bool monster::monster_move_in_vehicle( const tripoint& p ) const { map &m = get_map(); + const tripoint_abs_ms this_spot; + creature_tracker &creatures = get_creature_tracker(); + monster *const critter = creatures.creature_at( this_spot ); const optional_vpart_position vp_there = m.veh_at( p ); + const optional_vpart_position vp = m.veh_at( p ); if( vp_there ) { vehicle &veh = vp_there->vehicle(); units::volume capacity = 0_ml; @@ -176,24 +183,39 @@ bool monster::monster_move_in_vehicle( const tripoint& p ) const for( auto& part : cargo_parts ) { vehicle_stack contents = veh.get_items( *part ); const vpart_info &vpinfo = part->info(); - const optional_vpart_position vp = m.veh_at( p ); if ( !vp.part_with_feature("CARGO_PASSABLE", true ) ) { capacity += vpinfo.size; free_cargo += contents.free_volume(); } } if( capacity > 0_ml ) { - // Unlike characters, monsters don't squeeze, they fit or they don't. - if( ( ( get_size() > creature_size::tiny ) && free_cargo < 11719_ml ) || ( ( get_size() > creature_size::small ) && free_cargo < 23438_ml ) || ( ( get_size() > creature_size::medium ) && free_cargo < 46875_ml ) || ( ( get_size() > creature_size::large ) && free_cargo < 93750_ml ) || ( ( get_size() > creature_size::huge ) && free_cargo < 187500_ml ) ) { - return false; + add_msg( m_warning, _( "Free cargo is %s." ), format_volume( free_cargo ) ); + // First, we'll try to squeeze in. Open-topped vehicle parts have more room for us. + if( !veh.enclosed_at( p ) ) { + free_cargo *= 1.2; + } + if( ( !veh.enclosed_at( p ) && flies() ) ) { + return true; // Cargo won't block a flying monster if there's no roof. + } + if( ( ( get_size() == creature_size::tiny ) && free_cargo < 15625_ml ) || ( ( get_size() == creature_size::small ) && free_cargo < 31250_ml ) || ( ( get_size() == creature_size::medium ) && free_cargo < 62500_ml ) || ( ( get_size() == creature_size::large ) && free_cargo < 125000_ml ) || ( ( get_size() == creature_size::huge ) && free_cargo < 250000_ml ) ) { + if( ( ( get_size() == creature_size::tiny ) && free_cargo < 11719_ml ) || ( ( get_size() == creature_size::small ) && free_cargo < 23438_ml ) || ( ( get_size() == creature_size::medium ) && free_cargo < 46875_ml ) || ( ( get_size() == creature_size::large ) && free_cargo < 93750_ml ) || ( ( get_size() == creature_size::huge ) && free_cargo < 187500_ml ) || ( get_volume() > 850000_ml && !vp.part_with_feature( "HUGE_OK", true ) ) ) { + return false; // Return false if there's just no room whatsoever. Anything over 850 liters will simply never fit in a vehicle part that isn't specifically made for it. + } + if( ( type->bodytype == "snake" || type->bodytype == "blob" || type->bodytype == "fish" || has_flag( mon_flag_PLASTIC )|| has_flag( mon_flag_SMALL_HIDER ) ) ) { + return true; // Return true if we're wiggly enough to be fine with cramped space. + } + critter->add_effect( effect_cramped_space, 2_turns, true ); + return true; } } + if( get_size() == creature_size::huge && !vp.part_with_feature( "AISLE", true ) && !vp.part_with_feature( "HUGE_OK", true ) ) { + critter->add_effect( effect_cramped_space, 2_turns, true ); + return true; // Sufficiently gigantic creatures have trouble in stock seats, roof or no. + } } return true; } - - bool monster::will_move_to( const tripoint &p ) const { map &here = get_map(); diff --git a/src/monster.h b/src/monster.h index 9a0696b2d0a5f..1ec70f3285b36 100644 --- a/src/monster.h +++ b/src/monster.h @@ -212,7 +212,7 @@ class monster : public Creature bool will_move_to( const tripoint &p ) const; bool know_danger_at( const tripoint &p ) const; - bool monster_move_in_vehicle( const tripoint &dest_loc ) const; + bool monster_move_in_vehicle( const tripoint &p ) const; bool will_reach( const point &p ); // Do we have plans to get to (x, y)? int turns_to_reach( const point &p ); // How long will it take? From 62bb2ba3395e03c394857b472ef40e8b4d704c13 Mon Sep 17 00:00:00 2001 From: fairyarmadillo <94415528+fairyarmadillo@users.noreply.github.com> Date: Tue, 19 Dec 2023 12:10:45 -0800 Subject: [PATCH 16/30] enum, clean up --- src/character.cpp | 85 +++++++++++++++++++++++++++-------------------- src/monmove.cpp | 42 ++++++++++++++--------- src/npcmove.cpp | 36 ++++---------------- 3 files changed, 82 insertions(+), 81 deletions(-) diff --git a/src/character.cpp b/src/character.cpp index bb3db2af1ed4b..5a4857b99dbfb 100644 --- a/src/character.cpp +++ b/src/character.cpp @@ -7960,12 +7960,12 @@ std::string Character::weapname_ammo() const } } +// Tests to see if a character has room to enter a vehicle tile. bool Character::move_in_vehicle(Creature* c, const tripoint& dest_loc) const { map &m = get_map(); const optional_vpart_position vp_there = m.veh_at( dest_loc ); if( vp_there ) { - //const optional_vpart_position vp_there = m.veh_at( dest_loc ); vehicle &veh = vp_there->vehicle(); units::volume capacity = 0_ml; units::volume free_cargo = 0_ml; @@ -7979,17 +7979,25 @@ bool Character::move_in_vehicle(Creature* c, const tripoint& dest_loc) const free_cargo += contents.free_volume(); } } - if( capacity > 0_ml ) { // First, we'll try to squeeze in. Open-topped vehicle parts have more room for us. if( !veh.enclosed_at( dest_loc ) ) { free_cargo *= 1.2; } - if( ( ( get_size() == creature_size::tiny ) && free_cargo < 15625_ml ) || ( ( get_size() == creature_size::small ) && free_cargo < 31250_ml ) || ( ( get_size() == creature_size::medium ) && free_cargo < 62500_ml ) || ( ( get_size() == creature_size::large ) && free_cargo < 125000_ml ) || ( ( get_size() == creature_size::huge ) && free_cargo < 250000_ml ) ) { - if( ( ( get_size() == creature_size::tiny ) && free_cargo < 11719_ml ) || ( ( get_size() == creature_size::small ) && free_cargo < 23438_ml ) || ( ( get_size() == creature_size::medium ) && free_cargo < 46875_ml ) || ( ( get_size() == creature_size::large ) && free_cargo < 93750_ml ) || ( ( get_size() == creature_size::huge ) && free_cargo < 187500_ml ) ) { - add_msg_if_player( m_warning, _( "There's not enough room for you to fit there." ) ); - return false; // Even if you squeeze, there's no room. - } + const creature_size size = get_size(); + if ( ( size == creature_size::tiny && free_cargo < 15625_ml ) || + ( size == creature_size::small && free_cargo < 31250_ml ) || + ( size == creature_size::medium && free_cargo < 62500_ml ) || + ( size == creature_size::large && free_cargo < 125000_ml ) || + ( size == creature_size::huge && free_cargo < 250000_ml ) ) { + if ( ( size == creature_size::tiny && free_cargo < 11719_ml ) || + ( size == creature_size::small && free_cargo < 23438_ml ) || + ( size == creature_size::medium && free_cargo < 46875_ml ) || + ( size == creature_size::large && free_cargo < 93750_ml ) || + ( size == creature_size::huge && free_cargo < 187500_ml ) ) { + add_msg_if_player( m_warning, _( "There's not enough room for you to fit there." ) ); + return false; // Even if we squeeze, there's no room. + } c->add_effect( effect_cramped_space, 2_turns, true ); return true; } @@ -10901,45 +10909,50 @@ void Character::process_effects() if( in_vehicle ) { map &here = get_map(); const tripoint your_pos = pos(); - if ( in_vehicle ) { - if( is_npc() && !has_effect( effect_narcosis ) && has_effect( effect_cramped_space ) ) { - npc &as_npc = dynamic_cast( *this ); - as_npc.complain_about( "cramped_vehicle", 1_hours, "", false ); - } + if( is_npc() && !has_effect( effect_narcosis ) && has_effect( effect_cramped_space ) ) { + npc &as_npc = dynamic_cast( *this ); + as_npc.complain_about( "cramped_vehicle", 1_hours, "", false ); } const optional_vpart_position vp_there = here.veh_at( your_pos ); - vehicle &veh = vp_there->vehicle(); - units::volume capacity = 0_ml; - units::volume free_cargo = 0_ml; - auto cargo_parts = veh.get_parts_at( your_pos, "CARGO", part_status_flag::any ); - for( auto& part : cargo_parts ) { - vehicle_stack contents = veh.get_items( *part ); - const vpart_info &vpinfo = part->info(); - const optional_vpart_position vp = here.veh_at( your_pos ); - if ( !vp.part_with_feature("CARGO_PASSABLE", true ) ) { - capacity += vpinfo.size; - free_cargo += contents.free_volume(); - } - } - if( capacity > 0_ml ) { - // Open-topped vehicle parts have more room. - if( !veh.enclosed_at( your_pos ) ) { - free_cargo *= 1.2; - } - if( ( ( get_size() == creature_size::tiny ) && free_cargo < 15625_ml ) || ( ( get_size() == creature_size::small ) && free_cargo < 31250_ml ) || ( ( get_size() == creature_size::medium ) && free_cargo < 62500_ml ) || ( ( get_size() == creature_size::large ) && free_cargo < 125000_ml ) || ( ( get_size() == creature_size::huge ) && free_cargo < 250000_ml ) ) { - if( !has_effect( effect_cramped_space ) ) { - add_effect( effect_cramped_space, 2_turns, true ); + if( vp_there ) { + vehicle &veh = vp_there->vehicle(); + units::volume capacity = 0_ml; + units::volume free_cargo = 0_ml; + auto cargo_parts = veh.get_parts_at( your_pos, "CARGO", part_status_flag::any ); + for( auto& part : cargo_parts ) { + vehicle_stack contents = veh.get_items( *part ); + const vpart_info &vpinfo = part->info(); + const optional_vpart_position vp = here.veh_at( your_pos ); + if ( !vp.part_with_feature("CARGO_PASSABLE", true ) ) { + capacity += vpinfo.size; + free_cargo += contents.free_volume(); } - return; } - } - const optional_vpart_position vp = here.veh_at( your_pos ); + const creature_size size = get_size(); + if( capacity > 0_ml ) { + // Open-topped vehicle parts have more room. + if( !veh.enclosed_at( your_pos ) ) { + free_cargo *= 1.2; + } + if ( ( size == creature_size::tiny && free_cargo < 15625_ml ) || + ( size == creature_size::small && free_cargo < 31250_ml ) || + ( size == creature_size::medium && free_cargo < 62500_ml ) || + ( size == creature_size::large && free_cargo < 125000_ml ) || + ( size == creature_size::huge && free_cargo < 250000_ml ) ) { + if ( !has_effect( effect_cramped_space ) ) { + add_effect( effect_cramped_space, 2_turns, true ); + } + return; + } + } + const optional_vpart_position vp = here.veh_at( your_pos ); if( get_size() == creature_size::huge && !vp.part_with_feature( "AISLE", true ) && !vp.part_with_feature( "HUGE_OK", true ) ) { if( !has_effect( effect_cramped_space ) ) { add_effect( effect_cramped_space, 2_turns, true ); } return; } + } remove_effect( effect_cramped_space ); } diff --git a/src/monmove.cpp b/src/monmove.cpp index d68889ff5b383..598ed61d2c501 100644 --- a/src/monmove.cpp +++ b/src/monmove.cpp @@ -189,29 +189,39 @@ bool monster::monster_move_in_vehicle( const tripoint& p ) const } } if( capacity > 0_ml ) { - add_msg( m_warning, _( "Free cargo is %s." ), format_volume( free_cargo ) ); - // First, we'll try to squeeze in. Open-topped vehicle parts have more room for us. + // First, we'll try to squeeze in. Open-topped vehicle parts have more room to step over cargo. if( !veh.enclosed_at( p ) ) { free_cargo *= 1.2; } if( ( !veh.enclosed_at( p ) && flies() ) ) { - return true; // Cargo won't block a flying monster if there's no roof. - } - if( ( ( get_size() == creature_size::tiny ) && free_cargo < 15625_ml ) || ( ( get_size() == creature_size::small ) && free_cargo < 31250_ml ) || ( ( get_size() == creature_size::medium ) && free_cargo < 62500_ml ) || ( ( get_size() == creature_size::large ) && free_cargo < 125000_ml ) || ( ( get_size() == creature_size::huge ) && free_cargo < 250000_ml ) ) { - if( ( ( get_size() == creature_size::tiny ) && free_cargo < 11719_ml ) || ( ( get_size() == creature_size::small ) && free_cargo < 23438_ml ) || ( ( get_size() == creature_size::medium ) && free_cargo < 46875_ml ) || ( ( get_size() == creature_size::large ) && free_cargo < 93750_ml ) || ( ( get_size() == creature_size::huge ) && free_cargo < 187500_ml ) || ( get_volume() > 850000_ml && !vp.part_with_feature( "HUGE_OK", true ) ) ) { - return false; // Return false if there's just no room whatsoever. Anything over 850 liters will simply never fit in a vehicle part that isn't specifically made for it. - } - if( ( type->bodytype == "snake" || type->bodytype == "blob" || type->bodytype == "fish" || has_flag( mon_flag_PLASTIC )|| has_flag( mon_flag_SMALL_HIDER ) ) ) { - return true; // Return true if we're wiggly enough to be fine with cramped space. - } - critter->add_effect( effect_cramped_space, 2_turns, true ); - return true; - } - } - if( get_size() == creature_size::huge && !vp.part_with_feature( "AISLE", true ) && !vp.part_with_feature( "HUGE_OK", true ) ) { + return true; // No amount of cargo will block a flying monster if there's no roof. + } + const creature_size size = get_size(); + if ( ( size == creature_size::tiny && free_cargo < 15625_ml ) || + ( size == creature_size::small && free_cargo < 31250_ml ) || + ( size == creature_size::medium && free_cargo < 62500_ml ) || + ( size == creature_size::large && free_cargo < 125000_ml ) || + ( size == creature_size::huge && free_cargo < 250000_ml ) ) { + if ( ( size == creature_size::tiny && free_cargo < 11719_ml ) || + ( size == creature_size::small && free_cargo < 23438_ml ) || + ( size == creature_size::medium && free_cargo < 46875_ml ) || + ( size == creature_size::large && free_cargo < 93750_ml ) || + ( size == creature_size::huge && free_cargo < 187500_ml ) || + ( get_volume() > 850000_ml && !vp.part_with_feature( "HUGE_OK", true ) ) ) { + return false; // Return false if there's just no room whatsoever. Anything over 850 liters will simply never fit in a vehicle part that isn't specifically made for it. + // I'm sorry but you can't let a kaiju ride shotgun. + if( ( type->bodytype == "snake" || type->bodytype == "blob" || type->bodytype == "fish" || has_flag( mon_flag_PLASTIC )|| has_flag( mon_flag_SMALL_HIDER ) ) ) { + return true; // Return true if we're wiggly enough to be fine with cramped space. + } + critter->add_effect( effect_cramped_space, 2_turns, true ); + return true; // Otherwise we add the effect and return true. + } + } + if( size == creature_size::huge && !vp.part_with_feature( "AISLE", true ) && !vp.part_with_feature( "HUGE_OK", true ) ) { critter->add_effect( effect_cramped_space, 2_turns, true ); return true; // Sufficiently gigantic creatures have trouble in stock seats, roof or no. } + } } return true; } diff --git a/src/npcmove.cpp b/src/npcmove.cpp index 3c02a32fe4331..c2323dc703ec0 100644 --- a/src/npcmove.cpp +++ b/src/npcmove.cpp @@ -420,7 +420,6 @@ bool npc::could_move_onto( const tripoint &p ) const { return false; } if ( !move_in_vehicle(const_cast(this), p ) ) { - add_msg( m_bad, _( "%s is tryna go around." ), get_name().c_str() ); return false; } @@ -1812,36 +1811,15 @@ void npc::execute_action( npc_action action ) if( passenger != this && passenger != nullptr ) { continue; } - // a seat is available if either unassigned or assigned to us - auto available_seat = [&]( const vehicle_part & pt, const vpart_reference & checked_part ) { + // A seat is available if we can move there and it's either unassigned or assigned to us + auto available_seat = [&]( const vehicle_part & pt ) { + tripoint target = veh->global_part_pos3( pt ); if( !pt.is_seat() ) { return false; } - if( checked_part.part_with_feature( VPFLAG_CARGO, true ) ) { - units::volume capacity = 0_ml; - units::volume free_cargo = 0_ml; - tripoint target = veh->global_part_pos3( pt ); - auto cargo_parts = veh->get_parts_at( target, "CARGO", part_status_flag::any ); - for( auto& part : cargo_parts ) { - vehicle_stack contents = veh->get_items( *part ); - const vpart_info &vpinfo = part->info(); - tripoint spot = veh->global_part_pos3( *part ); - const optional_vpart_position checkpart = here.veh_at( spot ); - if ( !checkpart.part_with_feature( "CARGO_PASSABLE", true ) ) { - capacity += vpinfo.size; - free_cargo += contents.free_volume(); - } - } - if( capacity > 0_ml ) { - // First, we'll try to squeeze in. - if( ( ( get_size() > creature_size::tiny ) && free_cargo < 15625_ml ) || ( ( get_size() > creature_size::small ) && free_cargo < 31250_ml ) || ( ( get_size() > creature_size::medium ) && free_cargo < 62500_ml ) || ( ( get_size() > creature_size::large ) && free_cargo < 125000_ml ) || ( ( get_size() > creature_size::huge ) && free_cargo < 250000_ml ) ) { - if( ( ( get_size() > creature_size::tiny ) && free_cargo < 11719_ml ) || ( ( get_size() > creature_size::small ) && free_cargo < 23438_ml ) || ( ( get_size() > creature_size::medium ) && free_cargo < 46875_ml ) || ( ( get_size() > creature_size::large ) && free_cargo < 93750_ml ) || ( ( get_size() > creature_size::huge ) && free_cargo < 187500_ml ) ) { - add_msg_debug( debugmode::DF_NPC, "%s can't find a seat with enough free space.", disp_name() ); - return false; - } - } - } - } + if( !could_move_onto( target ) ) { + return false; + } const npc *who = pt.crew(); return !who || who->getID() == getID(); }; @@ -1855,7 +1833,7 @@ void npc::execute_action( npc_action action ) // We probably wanted to go there in the last turn priority = 4; - } else if( available_seat( pt, vp ) ) { + } else if( available_seat( pt ) ) { // Assuming player "owns" a sensible vehicle seats should be in good spots to occupy // Prefer our assigned seat if we have one const npc *who = pt.crew(); From 693058752e5fd944ac08af0b1fa9ebb438ff808a Mon Sep 17 00:00:00 2001 From: fairyarmadillo <94415528+fairyarmadillo@users.noreply.github.com> Date: Tue, 19 Dec 2023 12:24:40 -0800 Subject: [PATCH 17/30] astyle --- src/character.cpp | 120 +++++++++++++++++++++++----------------------- src/game.cpp | 4 +- src/monmove.cpp | 32 +++++++------ src/npc.cpp | 3 +- src/npcmove.cpp | 31 ++++++------ 5 files changed, 98 insertions(+), 92 deletions(-) diff --git a/src/character.cpp b/src/character.cpp index 5a4857b99dbfb..584009c8c31b5 100644 --- a/src/character.cpp +++ b/src/character.cpp @@ -5586,7 +5586,7 @@ Character::comfort_response_t Character::base_comfort_value( const tripoint &p ) } else { comfort -= here.move_cost( p ); } - if( has_effect( effect_cramped_space) ) { + if( has_effect( effect_cramped_space ) ) { comfort = static_cast( comfort_level::impossible ); } } @@ -7961,7 +7961,7 @@ std::string Character::weapname_ammo() const } // Tests to see if a character has room to enter a vehicle tile. -bool Character::move_in_vehicle(Creature* c, const tripoint& dest_loc) const +bool Character::move_in_vehicle( Creature *c, const tripoint &dest_loc ) const { map &m = get_map(); const optional_vpart_position vp_there = m.veh_at( dest_loc ); @@ -7970,13 +7970,13 @@ bool Character::move_in_vehicle(Creature* c, const tripoint& dest_loc) const units::volume capacity = 0_ml; units::volume free_cargo = 0_ml; auto cargo_parts = veh.get_parts_at( dest_loc, "CARGO", part_status_flag::any ); - for( auto& part : cargo_parts ) { + for( auto &part : cargo_parts ) { vehicle_stack contents = veh.get_items( *part ); const vpart_info &vpinfo = part->info(); const optional_vpart_position vp = m.veh_at( dest_loc ); - if ( !vp.part_with_feature("CARGO_PASSABLE", true ) ) { - capacity += vpinfo.size; - free_cargo += contents.free_volume(); + if( !vp.part_with_feature( "CARGO_PASSABLE", true ) ) { + capacity += vpinfo.size; + free_cargo += contents.free_volume(); } } if( capacity > 0_ml ) { @@ -7985,30 +7985,31 @@ bool Character::move_in_vehicle(Creature* c, const tripoint& dest_loc) const free_cargo *= 1.2; } const creature_size size = get_size(); - if ( ( size == creature_size::tiny && free_cargo < 15625_ml ) || + if( ( size == creature_size::tiny && free_cargo < 15625_ml ) || ( size == creature_size::small && free_cargo < 31250_ml ) || ( size == creature_size::medium && free_cargo < 62500_ml ) || ( size == creature_size::large && free_cargo < 125000_ml ) || ( size == creature_size::huge && free_cargo < 250000_ml ) ) { - if ( ( size == creature_size::tiny && free_cargo < 11719_ml ) || + if( ( size == creature_size::tiny && free_cargo < 11719_ml ) || ( size == creature_size::small && free_cargo < 23438_ml ) || ( size == creature_size::medium && free_cargo < 46875_ml ) || ( size == creature_size::large && free_cargo < 93750_ml ) || ( size == creature_size::huge && free_cargo < 187500_ml ) ) { add_msg_if_player( m_warning, _( "There's not enough room for you to fit there." ) ); return false; // Even if we squeeze, there's no room. - } - c->add_effect( effect_cramped_space, 2_turns, true ); - return true; + } + c->add_effect( effect_cramped_space, 2_turns, true ); + return true; } } - const optional_vpart_position vp = m.veh_at( dest_loc ); - // Sufficiently gigantic characters aren't comfortable in stock seats, roof or no. - if( get_size() == creature_size::huge && !vp.part_with_feature( "AISLE", true ) && !vp.part_with_feature( "HUGE_OK", true ) && !has_effect( effect_cramped_space ) ) { - add_msg_if_player( m_warning, _( "You barely fit in this tiny human vehicle." ) ); - add_msg_if_npc( m_warning, _( "%s has to really cram their huge body to fit." ), c->disp_name() ); - c->add_effect( effect_cramped_space, 2_turns, true ); - return true; + const optional_vpart_position vp = m.veh_at( dest_loc ); + // Sufficiently gigantic characters aren't comfortable in stock seats, roof or no. + if( get_size() == creature_size::huge && !vp.part_with_feature( "AISLE", true ) && + !vp.part_with_feature( "HUGE_OK", true ) && !has_effect( effect_cramped_space ) ) { + add_msg_if_player( m_warning, _( "You barely fit in this tiny human vehicle." ) ); + add_msg_if_npc( m_warning, _( "%s has to really cram their huge body to fit." ), c->disp_name() ); + c->add_effect( effect_cramped_space, 2_turns, true ); + return true; } } return true; @@ -10904,57 +10905,58 @@ void Character::process_effects() // Being stuck in tight spaces sucks. TODO: could be expanded to apply to non-vehicle conditions. if( has_effect( effect_cramped_space ) && !in_vehicle ) { remove_effect( effect_cramped_space ); - } + } // Check all of this here to ensure the player can't sit in a comfortable seat and then drop 50 liters of junk in their own lap. if( in_vehicle ) { map &here = get_map(); const tripoint your_pos = pos(); - if( is_npc() && !has_effect( effect_narcosis ) && has_effect( effect_cramped_space ) ) { + if( is_npc() && !has_effect( effect_narcosis ) && has_effect( effect_cramped_space ) ) { npc &as_npc = dynamic_cast( *this ); as_npc.complain_about( "cramped_vehicle", 1_hours, "", false ); + } + const optional_vpart_position vp_there = here.veh_at( your_pos ); + if( vp_there ) { + vehicle &veh = vp_there->vehicle(); + units::volume capacity = 0_ml; + units::volume free_cargo = 0_ml; + auto cargo_parts = veh.get_parts_at( your_pos, "CARGO", part_status_flag::any ); + for( auto &part : cargo_parts ) { + vehicle_stack contents = veh.get_items( *part ); + const vpart_info &vpinfo = part->info(); + const optional_vpart_position vp = here.veh_at( your_pos ); + if( !vp.part_with_feature( "CARGO_PASSABLE", true ) ) { + capacity += vpinfo.size; + free_cargo += contents.free_volume(); + } } - const optional_vpart_position vp_there = here.veh_at( your_pos ); - if( vp_there ) { - vehicle &veh = vp_there->vehicle(); - units::volume capacity = 0_ml; - units::volume free_cargo = 0_ml; - auto cargo_parts = veh.get_parts_at( your_pos, "CARGO", part_status_flag::any ); - for( auto& part : cargo_parts ) { - vehicle_stack contents = veh.get_items( *part ); - const vpart_info &vpinfo = part->info(); - const optional_vpart_position vp = here.veh_at( your_pos ); - if ( !vp.part_with_feature("CARGO_PASSABLE", true ) ) { - capacity += vpinfo.size; - free_cargo += contents.free_volume(); - } - } - const creature_size size = get_size(); - if( capacity > 0_ml ) { - // Open-topped vehicle parts have more room. - if( !veh.enclosed_at( your_pos ) ) { - free_cargo *= 1.2; - } - if ( ( size == creature_size::tiny && free_cargo < 15625_ml ) || - ( size == creature_size::small && free_cargo < 31250_ml ) || - ( size == creature_size::medium && free_cargo < 62500_ml ) || - ( size == creature_size::large && free_cargo < 125000_ml ) || - ( size == creature_size::huge && free_cargo < 250000_ml ) ) { - if ( !has_effect( effect_cramped_space ) ) { - add_effect( effect_cramped_space, 2_turns, true ); - } - return; - } - } - const optional_vpart_position vp = here.veh_at( your_pos ); - if( get_size() == creature_size::huge && !vp.part_with_feature( "AISLE", true ) && !vp.part_with_feature( "HUGE_OK", true ) ) { - if( !has_effect( effect_cramped_space ) ) { + const creature_size size = get_size(); + if( capacity > 0_ml ) { + // Open-topped vehicle parts have more room. + if( !veh.enclosed_at( your_pos ) ) { + free_cargo *= 1.2; + } + if( ( size == creature_size::tiny && free_cargo < 15625_ml ) || + ( size == creature_size::small && free_cargo < 31250_ml ) || + ( size == creature_size::medium && free_cargo < 62500_ml ) || + ( size == creature_size::large && free_cargo < 125000_ml ) || + ( size == creature_size::huge && free_cargo < 250000_ml ) ) { + if( !has_effect( effect_cramped_space ) ) { add_effect( effect_cramped_space, 2_turns, true ); - } - return; } + return; + } + } + const optional_vpart_position vp = here.veh_at( your_pos ); + if( get_size() == creature_size::huge && !vp.part_with_feature( "AISLE", true ) && + !vp.part_with_feature( "HUGE_OK", true ) ) { + if( !has_effect( effect_cramped_space ) ) { + add_effect( effect_cramped_space, 2_turns, true ); + } + return; } - remove_effect( effect_cramped_space ); - } + } + remove_effect( effect_cramped_space ); + } if( has_effect( effect_boomered ) && ( is_avatar() || is_npc() ) && one_in( 10 ) && !has_trait( trait_COMPOUND_EYES ) && !has_effect( effect_pre_conjunctivitis_bacterial ) && diff --git a/src/game.cpp b/src/game.cpp index 1f877503e0f5a..272bcb464b0bd 100644 --- a/src/game.cpp +++ b/src/game.cpp @@ -10420,8 +10420,8 @@ bool game::walk_move( const tripoint &dest_loc, const bool via_ramp, const bool } u.set_underwater( false ); - if( vp_there && !u.move_in_vehicle(static_cast(&u), dest_loc) ) { - return false; + if( vp_there && !u.move_in_vehicle( static_cast( &u ), dest_loc ) ) { + return false; } if( !shifting_furniture && !pushing && is_dangerous_tile( dest_loc ) ) { diff --git a/src/monmove.cpp b/src/monmove.cpp index 598ed61d2c501..ff8a1e34ded0e 100644 --- a/src/monmove.cpp +++ b/src/monmove.cpp @@ -167,7 +167,7 @@ static bool z_is_valid( int z ) return z >= -OVERMAP_DEPTH && z <= OVERMAP_HEIGHT; } -bool monster::monster_move_in_vehicle( const tripoint& p ) const +bool monster::monster_move_in_vehicle( const tripoint &p ) const { map &m = get_map(); const tripoint_abs_ms this_spot; @@ -180,12 +180,12 @@ bool monster::monster_move_in_vehicle( const tripoint& p ) const units::volume capacity = 0_ml; units::volume free_cargo = 0_ml; auto cargo_parts = veh.get_parts_at( p, "CARGO", part_status_flag::any ); - for( auto& part : cargo_parts ) { + for( auto &part : cargo_parts ) { vehicle_stack contents = veh.get_items( *part ); const vpart_info &vpinfo = part->info(); - if ( !vp.part_with_feature("CARGO_PASSABLE", true ) ) { - capacity += vpinfo.size; - free_cargo += contents.free_volume(); + if( !vp.part_with_feature( "CARGO_PASSABLE", true ) ) { + capacity += vpinfo.size; + free_cargo += contents.free_volume(); } } if( capacity > 0_ml ) { @@ -197,29 +197,31 @@ bool monster::monster_move_in_vehicle( const tripoint& p ) const return true; // No amount of cargo will block a flying monster if there's no roof. } const creature_size size = get_size(); - if ( ( size == creature_size::tiny && free_cargo < 15625_ml ) || + if( ( size == creature_size::tiny && free_cargo < 15625_ml ) || ( size == creature_size::small && free_cargo < 31250_ml ) || ( size == creature_size::medium && free_cargo < 62500_ml ) || ( size == creature_size::large && free_cargo < 125000_ml ) || ( size == creature_size::huge && free_cargo < 250000_ml ) ) { - if ( ( size == creature_size::tiny && free_cargo < 11719_ml ) || + if( ( size == creature_size::tiny && free_cargo < 11719_ml ) || ( size == creature_size::small && free_cargo < 23438_ml ) || ( size == creature_size::medium && free_cargo < 46875_ml ) || ( size == creature_size::large && free_cargo < 93750_ml ) || - ( size == creature_size::huge && free_cargo < 187500_ml ) || + ( size == creature_size::huge && free_cargo < 187500_ml ) || ( get_volume() > 850000_ml && !vp.part_with_feature( "HUGE_OK", true ) ) ) { return false; // Return false if there's just no room whatsoever. Anything over 850 liters will simply never fit in a vehicle part that isn't specifically made for it. - // I'm sorry but you can't let a kaiju ride shotgun. - if( ( type->bodytype == "snake" || type->bodytype == "blob" || type->bodytype == "fish" || has_flag( mon_flag_PLASTIC )|| has_flag( mon_flag_SMALL_HIDER ) ) ) { + // I'm sorry but you can't let a kaiju ride shotgun. + if( ( type->bodytype == "snake" || type->bodytype == "blob" || type->bodytype == "fish" || + has_flag( mon_flag_PLASTIC ) || has_flag( mon_flag_SMALL_HIDER ) ) ) { return true; // Return true if we're wiggly enough to be fine with cramped space. - } + } critter->add_effect( effect_cramped_space, 2_turns, true ); return true; // Otherwise we add the effect and return true. - } } - if( size == creature_size::huge && !vp.part_with_feature( "AISLE", true ) && !vp.part_with_feature( "HUGE_OK", true ) ) { - critter->add_effect( effect_cramped_space, 2_turns, true ); - return true; // Sufficiently gigantic creatures have trouble in stock seats, roof or no. + } + if( size == creature_size::huge && !vp.part_with_feature( "AISLE", true ) && + !vp.part_with_feature( "HUGE_OK", true ) ) { + critter->add_effect( effect_cramped_space, 2_turns, true ); + return true; // Sufficiently gigantic creatures have trouble in stock seats, roof or no. } } } diff --git a/src/npc.cpp b/src/npc.cpp index 7533fd924ef17..79d20a9efe487 100644 --- a/src/npc.cpp +++ b/src/npc.cpp @@ -3518,7 +3518,8 @@ std::set npc::get_path_avoid() const } for( const tripoint &p : here.points_in_radius( pos(), 6 ) ) { - if( sees_dangerous_field( p ) || ( here.veh_at( p ).part_with_feature( VPFLAG_CARGO, true ) && !move_in_vehicle( const_cast(this), p ) ) ) { + if( sees_dangerous_field( p ) || ( here.veh_at( p ).part_with_feature( VPFLAG_CARGO, true ) && + !move_in_vehicle( const_cast( this ), p ) ) ) { ret.insert( p ); } } diff --git a/src/npcmove.cpp b/src/npcmove.cpp index c2323dc703ec0..c3cc4aba030f6 100644 --- a/src/npcmove.cpp +++ b/src/npcmove.cpp @@ -414,12 +414,13 @@ bool npc::sees_dangerous_field( const tripoint &p ) const return is_dangerous_fields( get_map().field_at( p ) ); } -bool npc::could_move_onto( const tripoint &p ) const { +bool npc::could_move_onto( const tripoint &p ) const +{ map &here = get_map(); if( !here.passable( p ) ) { return false; } - if ( !move_in_vehicle(const_cast(this), p ) ) { + if( !move_in_vehicle( const_cast( this ), p ) ) { return false; } @@ -1813,13 +1814,13 @@ void npc::execute_action( npc_action action ) } // A seat is available if we can move there and it's either unassigned or assigned to us auto available_seat = [&]( const vehicle_part & pt ) { - tripoint target = veh->global_part_pos3( pt ); + tripoint target = veh->global_part_pos3( pt ); if( !pt.is_seat() ) { return false; } if( !could_move_onto( target ) ) { return false; - } + } const npc *who = pt.crew(); return !who || who->getID() == getID(); }; @@ -2844,16 +2845,16 @@ void npc::move_to( const tripoint &pt, bool no_bashing, std::set *nomo if( here.veh_at( p ).part_with_feature( VPFLAG_CARGO, true ) && !move_in_vehicle( this, p ) ) { auto other_points = here.get_dir_circle( pos(), p ); - for( const tripoint &ot : other_points ) { - if( could_move_onto( ot ) && ( nomove == nullptr || nomove->find( ot ) == nomove->end() ) ) { - p = ot; - break; - } else { - path.clear(); - move_pause(); - return; - } + for( const tripoint &ot : other_points ) { + if( could_move_onto( ot ) && ( nomove == nullptr || nomove->find( ot ) == nomove->end() ) ) { + p = ot; + break; + } else { + path.clear(); + move_pause(); + return; } + } } recoil = MAX_RECOIL; @@ -3081,12 +3082,12 @@ void npc::move_to( const tripoint &pt, bool no_bashing, std::set *nomo } if( here.veh_at( p ).part_with_feature( VPFLAG_BOARDABLE, true ) ) { - here.board_vehicle( p, this ); + here.board_vehicle( p, this ); } here.creature_on_trap( *this ); here.creature_in_field( *this ); - } } +} void npc::move_to_next() From 9a3a9715fd7cb37aeebcc0f657176ac57fd8f345 Mon Sep 17 00:00:00 2001 From: fairyarmadillo <94415528+fairyarmadillo@users.noreply.github.com> Date: Tue, 19 Dec 2023 12:26:02 -0800 Subject: [PATCH 18/30] linting --- data/json/effects.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/data/json/effects.json b/data/json/effects.json index f8280de7f4ce9..0bb313c6008e3 100644 --- a/data/json/effects.json +++ b/data/json/effects.json @@ -4661,4 +4661,4 @@ }, "show_in_info": true } -] \ No newline at end of file +] From 13a1f9737033f29faf1a16d4231c1c8c612c401f Mon Sep 17 00:00:00 2001 From: fairyarmadillo <94415528+fairyarmadillo@users.noreply.github.com> Date: Tue, 19 Dec 2023 12:33:01 -0800 Subject: [PATCH 19/30] linting2 --- data/json/vehicleparts/vehicle_parts.json | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/data/json/vehicleparts/vehicle_parts.json b/data/json/vehicleparts/vehicle_parts.json index 53e8e51c1bb15..21dd52439a678 100644 --- a/data/json/vehicleparts/vehicle_parts.json +++ b/data/json/vehicleparts/vehicle_parts.json @@ -189,7 +189,16 @@ "repair": { "skills": [ [ "fabrication", 1 ] ], "time": "5 m", "using": [ [ "repair_welding_standard", 1 ] ] } }, "breaks_into": [ { "item": "scrap", "count": [ 4, 6 ] } ], - "flags": [ "ENGINE", "BOARDABLE", "E_STARTS_INSTANTLY", "ANIMAL_CTRL", "HARNESS_human", "STEERABLE", "UNMOUNT_ON_DAMAGE", "HUGE_OK" ], + "flags": [ + "ENGINE", + "BOARDABLE", + "E_STARTS_INSTANTLY", + "ANIMAL_CTRL", + "HARNESS_human", + "STEERABLE", + "UNMOUNT_ON_DAMAGE", + "HUGE_OK" + ], "damage_reduction": { "all": 2 }, "variants": [ { "symbols": "-", "symbols_broken": "~" } ] }, From ed9f50234034015b99007167a56b423a408b0df1 Mon Sep 17 00:00:00 2001 From: fairyarmadillo <94415528+fairyarmadillo@users.noreply.github.com> Date: Tue, 19 Dec 2023 15:20:04 -0800 Subject: [PATCH 20/30] one last bugfix --- src/character.cpp | 2 +- src/monmove.cpp | 23 +++++++++----------- src/monster.cpp | 52 ++++++++++++++++++++++++++++++++++++++++++++ src/veh_interact.cpp | 4 ++-- 4 files changed, 65 insertions(+), 16 deletions(-) diff --git a/src/character.cpp b/src/character.cpp index 584009c8c31b5..88fdce214503e 100644 --- a/src/character.cpp +++ b/src/character.cpp @@ -8004,7 +8004,7 @@ bool Character::move_in_vehicle( Creature *c, const tripoint &dest_loc ) const } const optional_vpart_position vp = m.veh_at( dest_loc ); // Sufficiently gigantic characters aren't comfortable in stock seats, roof or no. - if( get_size() == creature_size::huge && !vp.part_with_feature( "AISLE", true ) && + if( in_vehicle && get_size() == creature_size::huge && !vp.part_with_feature( "AISLE", true ) && !vp.part_with_feature( "HUGE_OK", true ) && !has_effect( effect_cramped_space ) ) { add_msg_if_player( m_warning, _( "You barely fit in this tiny human vehicle." ) ); add_msg_if_npc( m_warning, _( "%s has to really cram their huge body to fit." ), c->disp_name() ); diff --git a/src/monmove.cpp b/src/monmove.cpp index ff8a1e34ded0e..ee1983f3b8643 100644 --- a/src/monmove.cpp +++ b/src/monmove.cpp @@ -170,13 +170,10 @@ static bool z_is_valid( int z ) bool monster::monster_move_in_vehicle( const tripoint &p ) const { map &m = get_map(); - const tripoint_abs_ms this_spot; - creature_tracker &creatures = get_creature_tracker(); - monster *const critter = creatures.creature_at( this_spot ); - const optional_vpart_position vp_there = m.veh_at( p ); + monster critter = *this; const optional_vpart_position vp = m.veh_at( p ); - if( vp_there ) { - vehicle &veh = vp_there->vehicle(); + if( vp ) { + vehicle &veh = vp->vehicle(); units::volume capacity = 0_ml; units::volume free_cargo = 0_ml; auto cargo_parts = veh.get_parts_at( p, "CARGO", part_status_flag::any ); @@ -210,17 +207,17 @@ bool monster::monster_move_in_vehicle( const tripoint &p ) const ( get_volume() > 850000_ml && !vp.part_with_feature( "HUGE_OK", true ) ) ) { return false; // Return false if there's just no room whatsoever. Anything over 850 liters will simply never fit in a vehicle part that isn't specifically made for it. // I'm sorry but you can't let a kaiju ride shotgun. - if( ( type->bodytype == "snake" || type->bodytype == "blob" || type->bodytype == "fish" || - has_flag( mon_flag_PLASTIC ) || has_flag( mon_flag_SMALL_HIDER ) ) ) { - return true; // Return true if we're wiggly enough to be fine with cramped space. - } - critter->add_effect( effect_cramped_space, 2_turns, true ); - return true; // Otherwise we add the effect and return true. } + if( ( type->bodytype == "snake" || type->bodytype == "blob" || type->bodytype == "fish" || + has_flag( mon_flag_PLASTIC ) || has_flag( mon_flag_SMALL_HIDER ) ) ) { + return true; // Return true if we're wiggly enough to be fine with cramped space. + } + critter.add_effect( effect_cramped_space, 2_turns, true ); + return true; // Otherwise we add the effect and return true. } if( size == creature_size::huge && !vp.part_with_feature( "AISLE", true ) && !vp.part_with_feature( "HUGE_OK", true ) ) { - critter->add_effect( effect_cramped_space, 2_turns, true ); + critter.add_effect( effect_cramped_space, 2_turns, true ); return true; // Sufficiently gigantic creatures have trouble in stock seats, roof or no. } } diff --git a/src/monster.cpp b/src/monster.cpp index d25d2146a74ba..abaa3d9b589de 100644 --- a/src/monster.cpp +++ b/src/monster.cpp @@ -64,6 +64,9 @@ #include "trap.h" #include "type_id.h" #include "units.h" +#include "veh_type.h" +#include "vehicle.h" +#include "vpart_position.h" #include "viewer.h" #include "weakpoint.h" #include "weather.h" @@ -82,6 +85,7 @@ static const efftype_id effect_beartrap( "beartrap" ); static const efftype_id effect_bleed( "bleed" ); static const efftype_id effect_blind( "blind" ); static const efftype_id effect_bouldering( "bouldering" ); +static const efftype_id effect_cramped_space( "cramped_space" ); static const efftype_id effect_critter_underfed( "critter_underfed" ); static const efftype_id effect_critter_well_fed( "critter_well_fed" ); static const efftype_id effect_crushed( "crushed" ); @@ -3336,6 +3340,54 @@ void monster::process_effects() } } + // Apply or remove the cramped_space effect, which needs specific information about the monster's surroundings. + map &here = get_map(); + const tripoint z_pos = pos(); + const optional_vpart_position vp = here.veh_at( z_pos ); + if( vp ) { + vehicle &veh = vp->vehicle(); + units::volume capacity = 0_ml; + units::volume free_cargo = 0_ml; + auto cargo_parts = veh.get_parts_at( z_pos, "CARGO", part_status_flag::any ); + for( auto &part : cargo_parts ) { + vehicle_stack contents = veh.get_items( *part ); + const vpart_info &vpinfo = part->info(); + if( !vp.part_with_feature( "CARGO_PASSABLE", true ) ) { + capacity += vpinfo.size; + free_cargo += contents.free_volume(); + } + } + const creature_size size = get_size(); + if( capacity > 0_ml ) { + // Open-topped vehicle parts have more room, and are always free space for fliers. + if( !veh.enclosed_at( z_pos ) ) { + free_cargo *= 1.2; + if( flies() ) { + remove_effect( effect_cramped_space ); + return; + } + } + if( ( size == creature_size::tiny && free_cargo < 15625_ml ) || + ( size == creature_size::small && free_cargo < 31250_ml ) || + ( size == creature_size::medium && free_cargo < 62500_ml ) || + ( size == creature_size::large && free_cargo < 125000_ml ) || + ( size == creature_size::huge && free_cargo < 250000_ml ) ) { + if( !has_effect( effect_cramped_space ) ) { + add_effect( effect_cramped_space, 2_turns, true ); + } + return; + } + } + if( get_size() == creature_size::huge && !vp.part_with_feature( "AISLE", true ) && + !vp.part_with_feature( "HUGE_OK", true ) ) { + if( !has_effect( effect_cramped_space ) ) { + add_effect( effect_cramped_space, 2_turns, true ); + } + return; + } + remove_effect( effect_cramped_space ); + } + Creature::process_effects(); } diff --git a/src/veh_interact.cpp b/src/veh_interact.cpp index 606dc591b0633..de0cd73e660e8 100644 --- a/src/veh_interact.cpp +++ b/src/veh_interact.cpp @@ -2930,8 +2930,8 @@ void veh_interact::display_details( const vpart_info *part ) } // line 5 [vertical/hybrid] flags - std::vector flags = { { "OPAQUE", "OPENABLE", "BOARDABLE", "CARGO_PASSABLE" } }; - std::vector flag_labels = { { _( "opaque" ), _( "openable" ), _( "boardable" ), _( "secure storage" ) } }; + std::vector flags = { { "OPAQUE", "OPENABLE", "BOARDABLE" } }; + std::vector flag_labels = { { _( "opaque" ), _( "openable" ), _( "boardable" ) } }; std::string label; for( size_t i = 0; i < flags.size(); i++ ) { if( part->has_flag( flags[i] ) ) { From bb9775a93969a767a3b1b2f81867f331a88f924c Mon Sep 17 00:00:00 2001 From: fairyarmadillo <94415528+fairyarmadillo@users.noreply.github.com> Date: Tue, 19 Dec 2023 15:52:54 -0800 Subject: [PATCH 21/30] just kidding. Now it's ready. --- src/monmove.cpp | 2 +- src/monster.cpp | 5 ++++- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/src/monmove.cpp b/src/monmove.cpp index ee1983f3b8643..c5fd0b6b86756 100644 --- a/src/monmove.cpp +++ b/src/monmove.cpp @@ -172,7 +172,7 @@ bool monster::monster_move_in_vehicle( const tripoint &p ) const map &m = get_map(); monster critter = *this; const optional_vpart_position vp = m.veh_at( p ); - if( vp ) { + if( vp.has_value() ) { vehicle &veh = vp->vehicle(); units::volume capacity = 0_ml; units::volume free_cargo = 0_ml; diff --git a/src/monster.cpp b/src/monster.cpp index abaa3d9b589de..2eb67fd20a827 100644 --- a/src/monster.cpp +++ b/src/monster.cpp @@ -3344,7 +3344,10 @@ void monster::process_effects() map &here = get_map(); const tripoint z_pos = pos(); const optional_vpart_position vp = here.veh_at( z_pos ); - if( vp ) { + if( has_effect( effect_cramped_space ) && !vp.has_value() ) { + remove_effect( effect_cramped_space ); + } + if( vp.has_value() ) { vehicle &veh = vp->vehicle(); units::volume capacity = 0_ml; units::volume free_cargo = 0_ml; From f7321ea56960e83105d1a89c4dafc23e7c44c7f7 Mon Sep 17 00:00:00 2001 From: fairyarmadillo <94415528+fairyarmadillo@users.noreply.github.com> Date: Tue, 19 Dec 2023 17:27:28 -0800 Subject: [PATCH 22/30] Update vehicle_parts.json --- data/json/vehicleparts/vehicle_parts.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/data/json/vehicleparts/vehicle_parts.json b/data/json/vehicleparts/vehicle_parts.json index 21dd52439a678..fc66af13eb98a 100644 --- a/data/json/vehicleparts/vehicle_parts.json +++ b/data/json/vehicleparts/vehicle_parts.json @@ -2253,7 +2253,7 @@ }, "repair": { "skills": [ [ "mechanics", 2 ] ], "time": "20 m", "using": [ [ "repair_welding_standard", 12 ] ] } }, - "flags": [ "BOARDABLE", "CARGO", "COVERED", "CAPTURE_MONSTER_VEH", "HUGE_OK", "BED" ], + "flags": [ "BOARDABLE", "CARGO", "COVERED", "CAPTURE_MONSTER_VEH", "HUGE_OK", "BED", "BELTABLE" ], "breaks_into": [ { "item": "steel_lump", "count": [ 6, 8 ] }, { "item": "steel_chunk", "count": [ 6, 8 ] }, From b181ca34bee9e57146522ebfca1a38cd58eabe4e Mon Sep 17 00:00:00 2001 From: fairyarmadillo <94415528+fairyarmadillo@users.noreply.github.com> Date: Wed, 20 Dec 2023 13:25:23 -0800 Subject: [PATCH 23/30] make tests happy --- src/character.cpp | 4 ++-- src/character.h | 2 +- src/monmove.cpp | 2 +- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/src/character.cpp b/src/character.cpp index 88fdce214503e..7ccbe360a4dae 100644 --- a/src/character.cpp +++ b/src/character.cpp @@ -7970,7 +7970,7 @@ bool Character::move_in_vehicle( Creature *c, const tripoint &dest_loc ) const units::volume capacity = 0_ml; units::volume free_cargo = 0_ml; auto cargo_parts = veh.get_parts_at( dest_loc, "CARGO", part_status_flag::any ); - for( auto &part : cargo_parts ) { + for( vehicle_part * &part : cargo_parts ) { vehicle_stack contents = veh.get_items( *part ); const vpart_info &vpinfo = part->info(); const optional_vpart_position vp = m.veh_at( dest_loc ); @@ -10920,7 +10920,7 @@ void Character::process_effects() units::volume capacity = 0_ml; units::volume free_cargo = 0_ml; auto cargo_parts = veh.get_parts_at( your_pos, "CARGO", part_status_flag::any ); - for( auto &part : cargo_parts ) { + for( vehicle_part * &part : cargo_parts ) { vehicle_stack contents = veh.get_items( *part ); const vpart_info &vpinfo = part->info(); const optional_vpart_position vp = here.veh_at( your_pos ); diff --git a/src/character.h b/src/character.h index cf7a669f4b5b1..f0fe1f7279fd0 100644 --- a/src/character.h +++ b/src/character.h @@ -1387,7 +1387,7 @@ class Character : public Creature, public visitable void forced_dismount(); /** Attempt to enter a tile in a vehicle */ - bool move_in_vehicle( Creature *source, const tripoint &dest_loc ) const; + bool move_in_vehicle( Creature *c, const tripoint &dest_loc ) const; bool is_deaf() const; bool is_mute() const; diff --git a/src/monmove.cpp b/src/monmove.cpp index c5fd0b6b86756..198bca68d3884 100644 --- a/src/monmove.cpp +++ b/src/monmove.cpp @@ -177,7 +177,7 @@ bool monster::monster_move_in_vehicle( const tripoint &p ) const units::volume capacity = 0_ml; units::volume free_cargo = 0_ml; auto cargo_parts = veh.get_parts_at( p, "CARGO", part_status_flag::any ); - for( auto &part : cargo_parts ) { + for( vehicle_part * &part : cargo_parts ) { vehicle_stack contents = veh.get_items( *part ); const vpart_info &vpinfo = part->info(); if( !vp.part_with_feature( "CARGO_PASSABLE", true ) ) { From ee6753a43b549e957896a48ee7d2087d6021a266 Mon Sep 17 00:00:00 2001 From: fairyarmadillo <94415528+fairyarmadillo@users.noreply.github.com> Date: Wed, 20 Dec 2023 13:54:31 -0800 Subject: [PATCH 24/30] astyle --- src/character.cpp | 4 ++-- src/monmove.cpp | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/src/character.cpp b/src/character.cpp index 7ccbe360a4dae..861ed33c42fa3 100644 --- a/src/character.cpp +++ b/src/character.cpp @@ -7970,7 +7970,7 @@ bool Character::move_in_vehicle( Creature *c, const tripoint &dest_loc ) const units::volume capacity = 0_ml; units::volume free_cargo = 0_ml; auto cargo_parts = veh.get_parts_at( dest_loc, "CARGO", part_status_flag::any ); - for( vehicle_part * &part : cargo_parts ) { + for( vehicle_part*&part : cargo_parts ) { vehicle_stack contents = veh.get_items( *part ); const vpart_info &vpinfo = part->info(); const optional_vpart_position vp = m.veh_at( dest_loc ); @@ -10920,7 +10920,7 @@ void Character::process_effects() units::volume capacity = 0_ml; units::volume free_cargo = 0_ml; auto cargo_parts = veh.get_parts_at( your_pos, "CARGO", part_status_flag::any ); - for( vehicle_part * &part : cargo_parts ) { + for( vehicle_part*&part : cargo_parts ) { vehicle_stack contents = veh.get_items( *part ); const vpart_info &vpinfo = part->info(); const optional_vpart_position vp = here.veh_at( your_pos ); diff --git a/src/monmove.cpp b/src/monmove.cpp index 198bca68d3884..4ac4891331424 100644 --- a/src/monmove.cpp +++ b/src/monmove.cpp @@ -177,7 +177,7 @@ bool monster::monster_move_in_vehicle( const tripoint &p ) const units::volume capacity = 0_ml; units::volume free_cargo = 0_ml; auto cargo_parts = veh.get_parts_at( p, "CARGO", part_status_flag::any ); - for( vehicle_part * &part : cargo_parts ) { + for( vehicle_part*&part : cargo_parts ) { vehicle_stack contents = veh.get_items( *part ); const vpart_info &vpinfo = part->info(); if( !vp.part_with_feature( "CARGO_PASSABLE", true ) ) { From dcc5ddca3897ea1f8f3ae7237c7a00680ef8db51 Mon Sep 17 00:00:00 2001 From: fairyarmadillo <94415528+fairyarmadillo@users.noreply.github.com> Date: Wed, 20 Dec 2023 14:09:32 -0800 Subject: [PATCH 25/30] Update src/character.cpp Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com> --- src/character.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/character.cpp b/src/character.cpp index 861ed33c42fa3..a1db2988f9e52 100644 --- a/src/character.cpp +++ b/src/character.cpp @@ -7970,7 +7970,7 @@ bool Character::move_in_vehicle( Creature *c, const tripoint &dest_loc ) const units::volume capacity = 0_ml; units::volume free_cargo = 0_ml; auto cargo_parts = veh.get_parts_at( dest_loc, "CARGO", part_status_flag::any ); - for( vehicle_part*&part : cargo_parts ) { + for( vehicle_part *&part : cargo_parts ) { vehicle_stack contents = veh.get_items( *part ); const vpart_info &vpinfo = part->info(); const optional_vpart_position vp = m.veh_at( dest_loc ); From 3f88c6b80187aa6446066bbe11fdaa2c06d1f142 Mon Sep 17 00:00:00 2001 From: fairyarmadillo <94415528+fairyarmadillo@users.noreply.github.com> Date: Wed, 20 Dec 2023 14:09:37 -0800 Subject: [PATCH 26/30] Update src/character.cpp Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com> --- src/character.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/character.cpp b/src/character.cpp index a1db2988f9e52..8797308b8c0d6 100644 --- a/src/character.cpp +++ b/src/character.cpp @@ -10920,7 +10920,7 @@ void Character::process_effects() units::volume capacity = 0_ml; units::volume free_cargo = 0_ml; auto cargo_parts = veh.get_parts_at( your_pos, "CARGO", part_status_flag::any ); - for( vehicle_part*&part : cargo_parts ) { + for( vehicle_part *&part : cargo_parts ) { vehicle_stack contents = veh.get_items( *part ); const vpart_info &vpinfo = part->info(); const optional_vpart_position vp = here.veh_at( your_pos ); From fcdcd5c18cf1833e7a0919aceac7e2b0d01700bd Mon Sep 17 00:00:00 2001 From: fairyarmadillo <94415528+fairyarmadillo@users.noreply.github.com> Date: Wed, 20 Dec 2023 14:09:42 -0800 Subject: [PATCH 27/30] Update src/monmove.cpp Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com> --- src/monmove.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/monmove.cpp b/src/monmove.cpp index 4ac4891331424..c131eb56becee 100644 --- a/src/monmove.cpp +++ b/src/monmove.cpp @@ -177,7 +177,7 @@ bool monster::monster_move_in_vehicle( const tripoint &p ) const units::volume capacity = 0_ml; units::volume free_cargo = 0_ml; auto cargo_parts = veh.get_parts_at( p, "CARGO", part_status_flag::any ); - for( vehicle_part*&part : cargo_parts ) { + for( vehicle_part *&part : cargo_parts ) { vehicle_stack contents = veh.get_items( *part ); const vpart_info &vpinfo = part->info(); if( !vp.part_with_feature( "CARGO_PASSABLE", true ) ) { From eb4da6d9cb758445a83c546085ca9568a19ad534 Mon Sep 17 00:00:00 2001 From: fairyarmadillo <94415528+fairyarmadillo@users.noreply.github.com> Date: Wed, 20 Dec 2023 17:31:31 -0800 Subject: [PATCH 28/30] tests --- src/monmove.cpp | 4 ++-- src/monster.cpp | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/src/monmove.cpp b/src/monmove.cpp index c131eb56becee..af0891254dadc 100644 --- a/src/monmove.cpp +++ b/src/monmove.cpp @@ -114,8 +114,8 @@ static const mon_flag_str_id mon_flag_RIDEABLE_MECH( "RIDEABLE_MECH" ); static const mon_flag_str_id mon_flag_SEES( "SEES" ); static const mon_flag_str_id mon_flag_SHORTACIDTRAIL( "SHORTACIDTRAIL" ); static const mon_flag_str_id mon_flag_SLUDGETRAIL( "SLUDGETRAIL" ); -static const mon_flag_str_id mon_flag_SMALL_HIDER( "SMALL_HIDER" ); static const mon_flag_str_id mon_flag_SMALLSLUDGETRAIL( "SMALLSLUDGETRAIL" ); +static const mon_flag_str_id mon_flag_SMALL_HIDER( "SMALL_HIDER" ); static const mon_flag_str_id mon_flag_SMELLS( "SMELLS" ); static const mon_flag_str_id mon_flag_STUMBLES( "STUMBLES" ); static const mon_flag_str_id mon_flag_SUNDEATH( "SUNDEATH" ); @@ -190,7 +190,7 @@ bool monster::monster_move_in_vehicle( const tripoint &p ) const if( !veh.enclosed_at( p ) ) { free_cargo *= 1.2; } - if( ( !veh.enclosed_at( p ) && flies() ) ) { + if( !veh.enclosed_at( p ) && flies() ) { return true; // No amount of cargo will block a flying monster if there's no roof. } const creature_size size = get_size(); diff --git a/src/monster.cpp b/src/monster.cpp index 2eb67fd20a827..e8d09e465e42c 100644 --- a/src/monster.cpp +++ b/src/monster.cpp @@ -3352,7 +3352,7 @@ void monster::process_effects() units::volume capacity = 0_ml; units::volume free_cargo = 0_ml; auto cargo_parts = veh.get_parts_at( z_pos, "CARGO", part_status_flag::any ); - for( auto &part : cargo_parts ) { + for( vehicle_part * &part : cargo_parts ) { vehicle_stack contents = veh.get_items( *part ); const vpart_info &vpinfo = part->info(); if( !vp.part_with_feature( "CARGO_PASSABLE", true ) ) { From 1663c8e32d43a2a6d3bbc503567798b88dabd9b8 Mon Sep 17 00:00:00 2001 From: fairyarmadillo <94415528+fairyarmadillo@users.noreply.github.com> Date: Thu, 21 Dec 2023 06:06:51 -0800 Subject: [PATCH 29/30] Update src/monster.cpp Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com> --- src/monster.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/monster.cpp b/src/monster.cpp index e8d09e465e42c..6c96044f0bcac 100644 --- a/src/monster.cpp +++ b/src/monster.cpp @@ -3352,7 +3352,7 @@ void monster::process_effects() units::volume capacity = 0_ml; units::volume free_cargo = 0_ml; auto cargo_parts = veh.get_parts_at( z_pos, "CARGO", part_status_flag::any ); - for( vehicle_part * &part : cargo_parts ) { + for( vehicle_part*&part : cargo_parts ) { vehicle_stack contents = veh.get_items( *part ); const vpart_info &vpinfo = part->info(); if( !vp.part_with_feature( "CARGO_PASSABLE", true ) ) { From 0212875b89241ce439f814ab357f0e65a4bae2bd Mon Sep 17 00:00:00 2001 From: fairyarmadillo <94415528+fairyarmadillo@users.noreply.github.com> Date: Thu, 21 Dec 2023 06:44:44 -0800 Subject: [PATCH 30/30] Update src/monster.cpp Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com> --- src/monster.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/monster.cpp b/src/monster.cpp index 6c96044f0bcac..bb2ea56357524 100644 --- a/src/monster.cpp +++ b/src/monster.cpp @@ -3352,7 +3352,7 @@ void monster::process_effects() units::volume capacity = 0_ml; units::volume free_cargo = 0_ml; auto cargo_parts = veh.get_parts_at( z_pos, "CARGO", part_status_flag::any ); - for( vehicle_part*&part : cargo_parts ) { + for( vehicle_part *&part : cargo_parts ) { vehicle_stack contents = veh.get_items( *part ); const vpart_info &vpinfo = part->info(); if( !vp.part_with_feature( "CARGO_PASSABLE", true ) ) {