diff --git a/data/json/furniture_and_terrain/furniture-plumbing.json b/data/json/furniture_and_terrain/furniture-plumbing.json index 196d944b4a3e1..16ace533eb9d7 100644 --- a/data/json/furniture_and_terrain/furniture-plumbing.json +++ b/data/json/furniture_and_terrain/furniture-plumbing.json @@ -90,7 +90,8 @@ "move_cost_mod": 2, "coverage": 30, "required_str": -1, - "flags": [ "TRANSPARENT", "FLAMMABLE_HARD", "MOUNTABLE", "LIQUIDCONT", "TOILET_WATER" ], + "liquid_source": { "id": "water", "count": 24 }, + "flags": [ "TRANSPARENT", "FLAMMABLE_HARD", "MOUNTABLE", "LIQUIDCONT" ], "examine_action": "finite_water_source", "bash": { "str_min": 8, diff --git a/data/json/furniture_and_terrain/terrain-bridges-docks.json b/data/json/furniture_and_terrain/terrain-bridges-docks.json index 618eba78a69b9..1a94096527d47 100644 --- a/data/json/furniture_and_terrain/terrain-bridges-docks.json +++ b/data/json/furniture_and_terrain/terrain-bridges-docks.json @@ -42,6 +42,7 @@ "move_cost": 8, "flags": [ "TRANSPARENT", "LIQUID", "SWIMMABLE", "DEEP_WATER", "FISHABLE" ], "connect_groups": "WATER", + "liquid_source": { "id": "water" }, "examine_action": "water_source", "deconstruct": { "ter_set": "t_water_moving_dp", "items": [ { "item": "spike", "count": 4 }, { "item": "wood_beam", "count": 1 } ] }, "looks_like": "t_column", diff --git a/data/json/furniture_and_terrain/terrain-liquids.json b/data/json/furniture_and_terrain/terrain-liquids.json index 3755176131a1e..b769ee1dda38f 100644 --- a/data/json/furniture_and_terrain/terrain-liquids.json +++ b/data/json/furniture_and_terrain/terrain-liquids.json @@ -10,6 +10,7 @@ "flags": [ "TRANSPARENT", "LIQUID", "NO_SCENT", "SWIMMABLE", "FISHABLE", "SHALLOW_WATER" ], "connect_groups": "WATER", "connects_to": "WATER", + "liquid_source": { "id": "water" }, "examine_action": "water_source" }, { @@ -26,6 +27,7 @@ "flags": [ "TRANSPARENT", "LIQUID", "NO_SCENT", "SWIMMABLE", "FISHABLE", "INDOORS", "SHALLOW_WATER" ], "connect_groups": [ "INDOORFLOOR", "WATER" ], "connects_to": "WATER", + "liquid_source": { "id": "water" }, "examine_action": "water_source" }, { @@ -40,6 +42,7 @@ "flags": [ "TRANSPARENT", "LIQUID", "NO_SCENT", "SWIMMABLE", "DEEP_WATER", "FISHABLE", "NO_FLOOR_WATER", "EMPTY_SPACE" ], "connect_groups": "WATER", "connects_to": "WATER", + "liquid_source": { "id": "water" }, "examine_action": "water_source" }, { @@ -56,6 +59,7 @@ "flags": [ "TRANSPARENT", "LIQUID", "NO_SCENT", "SWIMMABLE", "DEEP_WATER", "FISHABLE", "INDOORS", "EMPTY_SPACE" ], "connect_groups": [ "INDOORFLOOR", "WATER" ], "connects_to": "WATER", + "liquid_source": { "id": "water" }, "examine_action": "water_source" }, { @@ -67,9 +71,10 @@ "color": "light_blue", "looks_like": "t_water_sh", "move_cost": 5, - "flags": [ "TRANSPARENT", "LIQUID", "NO_SCENT", "SWIMMABLE", "FISHABLE", "SHALLOW_WATER", "MURKY" ], + "flags": [ "TRANSPARENT", "LIQUID", "NO_SCENT", "SWIMMABLE", "FISHABLE", "SHALLOW_WATER" ], "connect_groups": "WATER", "connects_to": "WATER", + "liquid_source": { "id": "water_murky" }, "examine_action": "water_source" }, { @@ -83,9 +88,10 @@ "looks_like": "t_water_sh", "move_cost": 5, "roof": "t_rock_roof", - "flags": [ "TRANSPARENT", "LIQUID", "NO_SCENT", "SWIMMABLE", "FISHABLE", "INDOORS", "SHALLOW_WATER", "MURKY" ], + "flags": [ "TRANSPARENT", "LIQUID", "NO_SCENT", "SWIMMABLE", "FISHABLE", "INDOORS", "SHALLOW_WATER" ], "connect_groups": [ "INDOORFLOOR", "WATER" ], "connects_to": "WATER", + "liquid_source": { "id": "water_murky" }, "examine_action": "water_source" }, { @@ -100,6 +106,7 @@ "flags": [ "TRANSPARENT", "LIQUID", "NO_SCENT", "SWIMMABLE", "FISHABLE", "CURRENT", "SHALLOW_WATER" ], "connect_groups": "WATER", "connects_to": "WATER", + "liquid_source": { "id": "water" }, "examine_action": "water_source" }, { @@ -116,6 +123,7 @@ "flags": [ "TRANSPARENT", "LIQUID", "NO_SCENT", "SWIMMABLE", "FISHABLE", "CURRENT", "INDOORS", "SHALLOW_WATER" ], "connect_groups": [ "INDOORFLOOR", "WATER" ], "connects_to": "WATER", + "liquid_source": { "id": "water" }, "examine_action": "water_source" }, { @@ -130,6 +138,7 @@ "flags": [ "TRANSPARENT", "LIQUID", "NO_SCENT", "SWIMMABLE", "DEEP_WATER", "FISHABLE", "CURRENT", "EMPTY_SPACE" ], "connect_groups": "WATER", "connects_to": "WATER", + "liquid_source": { "id": "water" }, "examine_action": "water_source" }, { @@ -146,6 +155,7 @@ "flags": [ "TRANSPARENT", "LIQUID", "NO_SCENT", "SWIMMABLE", "DEEP_WATER", "FISHABLE", "CURRENT", "INDOORS", "EMPTY_SPACE" ], "connect_groups": [ "INDOORFLOOR", "WATER" ], "connects_to": "WATER", + "liquid_source": { "id": "water" }, "examine_action": "water_source" }, { @@ -157,7 +167,8 @@ "looks_like": "t_water_sh", "color": "light_blue", "move_cost": 5, - "flags": [ "TRANSPARENT", "LIQUID", "NO_SCENT", "SWIMMABLE", "SALT_WATER", "FISHABLE", "SHALLOW_WATER" ], + "liquid_source": { "id": "salt_water", "min_temp": 2.2 }, + "flags": [ "TRANSPARENT", "LIQUID", "NO_SCENT", "SWIMMABLE", "FISHABLE", "SHALLOW_WATER" ], "connect_groups": "WATER", "connects_to": "WATER", "examine_action": "water_source" @@ -173,7 +184,8 @@ "looks_like": "t_swater_sh", "move_cost": 5, "roof": "t_rock_roof", - "flags": [ "TRANSPARENT", "LIQUID", "NO_SCENT", "SWIMMABLE", "SALT_WATER", "FISHABLE", "INDOORS", "SHALLOW_WATER" ], + "liquid_source": { "id": "salt_water", "min_temp": 2.2 }, + "flags": [ "TRANSPARENT", "LIQUID", "NO_SCENT", "SWIMMABLE", "FISHABLE", "INDOORS", "SHALLOW_WATER" ], "connect_groups": [ "INDOORFLOOR", "WATER" ], "connects_to": "WATER", "examine_action": "water_source" @@ -187,7 +199,8 @@ "looks_like": "t_water_dp", "color": "blue", "move_cost": 8, - "flags": [ "TRANSPARENT", "LIQUID", "NO_SCENT", "SWIMMABLE", "SALT_WATER", "DEEP_WATER", "FISHABLE", "EMPTY_SPACE" ], + "liquid_source": { "id": "salt_water", "min_temp": 2.2 }, + "flags": [ "TRANSPARENT", "LIQUID", "NO_SCENT", "SWIMMABLE", "DEEP_WATER", "FISHABLE", "EMPTY_SPACE" ], "connect_groups": "WATER", "connects_to": "WATER", "examine_action": "water_source" @@ -203,7 +216,8 @@ "looks_like": "t_swater_dp", "move_cost": 8, "roof": "t_rock_roof", - "flags": [ "TRANSPARENT", "LIQUID", "NO_SCENT", "SWIMMABLE", "SALT_WATER", "DEEP_WATER", "FISHABLE", "INDOORS", "EMPTY_SPACE" ], + "liquid_source": { "id": "salt_water", "min_temp": 2.2 }, + "flags": [ "TRANSPARENT", "LIQUID", "NO_SCENT", "SWIMMABLE", "DEEP_WATER", "FISHABLE", "INDOORS", "EMPTY_SPACE" ], "connect_groups": [ "INDOORFLOOR", "WATER" ], "connects_to": "WATER", "examine_action": "water_source" @@ -217,9 +231,10 @@ "color": "cyan", "looks_like": "t_swater_sh", "move_cost": 4, + "liquid_source": { "id": "salt_water", "min_temp": 2.2 }, "connect_groups": [ "SAND", "WATER" ], "connects_to": [ "SAND", "SANDMOUND", "SANDGLASS", "WATER" ], - "flags": [ "TRANSPARENT", "LIQUID", "NO_SCENT", "SWIMMABLE", "SALT_WATER", "DIGGABLE", "FLAT" ], + "flags": [ "TRANSPARENT", "LIQUID", "NO_SCENT", "SWIMMABLE", "DIGGABLE", "FLAT" ], "examine_action": "water_source" }, { @@ -234,6 +249,7 @@ "flags": [ "TRANSPARENT", "LIQUID", "NO_SCENT", "SWIMMABLE", "INDOORS", "DEEP_WATER", "EMPTY_SPACE" ], "connect_groups": [ "INDOORFLOOR", "POOLWATER" ], "connects_to": "POOLWATER", + "liquid_source": { "id": "water" }, "examine_action": "water_source" }, { @@ -248,6 +264,7 @@ "flags": [ "TRANSPARENT", "LIQUID", "NO_SCENT", "SWIMMABLE", "INDOORS", "SHALLOW_WATER" ], "connect_groups": [ "INDOORFLOOR", "POOLWATER" ], "connects_to": "POOLWATER", + "liquid_source": { "id": "water" }, "examine_action": "water_source" }, { @@ -262,6 +279,7 @@ "flags": [ "TRANSPARENT", "LIQUID", "NO_SCENT", "SWIMMABLE", "DEEP_WATER", "EMPTY_SPACE" ], "connect_groups": "POOLWATER", "connects_to": "POOLWATER", + "liquid_source": { "id": "water" }, "examine_action": "water_source" }, { @@ -276,6 +294,7 @@ "flags": [ "TRANSPARENT", "LIQUID", "NO_SCENT", "SWIMMABLE", "SHALLOW_WATER" ], "connect_groups": "POOLWATER", "connects_to": "POOLWATER", + "liquid_source": { "id": "water" }, "examine_action": "water_source" }, { @@ -287,6 +306,7 @@ "looks_like": "t_water_murky", "color": "light_green", "move_cost": 6, + "liquid_source": { "id": "water_sewage" }, "flags": [ "TRANSPARENT", "SWIMMABLE", "SHALLOW_WATER" ], "examine_action": "water_source" }, @@ -316,6 +336,7 @@ "flags": [ "TRANSPARENT", "LIQUID", "NO_SCENT", "SWIMMABLE", "DEEP_WATER", "WATER_CUBE", "NO_FLOOR_WATER", "EMPTY_SPACE" ], "connect_groups": "WATER", "connects_to": "WATER", + "liquid_source": { "id": "water" }, "examine_action": "water_source" }, { @@ -326,17 +347,8 @@ "symbol": "~", "color": "blue", "move_cost": 8, - "flags": [ - "TRANSPARENT", - "LIQUID", - "NO_SCENT", - "SWIMMABLE", - "DEEP_WATER", - "SALT_WATER", - "WATER_CUBE", - "NO_FLOOR_WATER", - "EMPTY_SPACE" - ], + "liquid_source": { "id": "salt_water", "min_temp": 2.2 }, + "flags": [ "TRANSPARENT", "LIQUID", "NO_SCENT", "SWIMMABLE", "DEEP_WATER", "WATER_CUBE", "NO_FLOOR_WATER", "EMPTY_SPACE" ], "connect_groups": "WATER", "connects_to": "WATER", "examine_action": "water_source" @@ -354,6 +366,7 @@ "flags": [ "TRANSPARENT", "LIQUID", "NO_SCENT", "SWIMMABLE", "DEEP_WATER", "WATER_CUBE" ], "connect_groups": "WATER", "connects_to": "WATER", + "liquid_source": { "id": "water" }, "examine_action": "water_source" }, { @@ -369,6 +382,7 @@ "flags": [ "TRANSPARENT", "LIQUID", "NO_SCENT", "SWIMMABLE", "DEEP_WATER", "GOES_UP" ], "connect_groups": "WATER", "connects_to": "WATER", + "liquid_source": { "id": "water" }, "examine_action": "water_source" }, { @@ -384,6 +398,7 @@ "flags": [ "TRANSPARENT", "LIQUID", "NO_SCENT", "SWIMMABLE", "DEEP_WATER", "GOES_UP", "MINEABLE" ], "connect_groups": "WATER", "connects_to": "WATER", + "liquid_source": { "id": "water" }, "examine_action": "water_source" }, { @@ -431,6 +446,7 @@ }, "connect_groups": "WATER", "connects_to": "WATER", + "liquid_source": { "id": "water" }, "examine_action": "water_source" }, { @@ -453,6 +469,7 @@ }, "connect_groups": "WATER", "connects_to": "WATER", + "liquid_source": { "id": "water" }, "examine_action": "water_source" }, { @@ -467,6 +484,7 @@ "flags": [ "TRANSPARENT", "LIQUID", "NO_SCENT", "SWIMMABLE", "SHALLOW_WATER" ], "connect_groups": "WATER", "connects_to": "WATER", + "liquid_source": { "id": "water_murky" }, "examine_action": "water_source" }, { @@ -478,7 +496,8 @@ "symbol": "~", "color": "light_blue", "move_cost": 3, - "flags": [ "TRANSPARENT", "LIQUIDCONT", "SPAWN_WITH_WATER", "MURKY" ], + "liquid_source": { "id": "water_murky", "count": [ 40, 240 ] }, + "flags": [ "TRANSPARENT", "LIQUIDCONT" ], "examine_action": "finite_water_source" }, { @@ -491,7 +510,8 @@ "color": "light_blue", "move_cost": 3, "connect_groups": "INDOORFLOOR", - "flags": [ "TRANSPARENT", "LIQUIDCONT", "SPAWN_WITH_WATER", "MURKY", "INDOORS" ], + "liquid_source": { "id": "water_murky", "count": [ 40, 240 ] }, + "flags": [ "TRANSPARENT", "LIQUIDCONT", "INDOORS" ], "examine_action": "finite_water_source" }, { @@ -508,6 +528,7 @@ "flags": [ "TRANSPARENT", "LIQUID", "NO_SCENT", "SWIMMABLE", "INDOORS", "SHALLOW_WATER" ], "connect_groups": [ "INDOORFLOOR", "WATER" ], "connects_to": "WATER", + "liquid_source": { "id": "water" }, "examine_action": "water_source" } ] diff --git a/data/json/furniture_and_terrain/terrain-manufactured.json b/data/json/furniture_and_terrain/terrain-manufactured.json index 648f2d7e9488d..b0eeba5eefc15 100644 --- a/data/json/furniture_and_terrain/terrain-manufactured.json +++ b/data/json/furniture_and_terrain/terrain-manufactured.json @@ -770,6 +770,7 @@ { "item": "pipe", "count": [ 0, 2 ] } ] }, + "liquid_source": { "id": "water" }, "examine_action": "water_source" }, { @@ -795,6 +796,7 @@ "ter_set": "t_covered_well", "items": [ { "item": "string_6", "count": [ 0, 18 ] }, { "item": "splinter", "count": [ 0, 24 ] } ] }, + "liquid_source": { "id": "water" }, "examine_action": "water_source" }, { @@ -807,7 +809,8 @@ "color": "light_gray", "move_cost": 6, "coverage": 40, - "flags": [ "TRANSPARENT", "THIN_OBSTACLE", "SALT_WATER" ], + "liquid_source": { "id": "salt_water", "min_temp": 2.2 }, + "flags": [ "TRANSPARENT", "THIN_OBSTACLE" ], "deconstruct": { "ter_set": "t_covered_well", "items": [ { "item": "well_pump", "count": 1 }, { "item": "pipe", "count": [ 1, 6 ] } ] }, "bash": { "str_min": 15, @@ -835,6 +838,7 @@ "move_cost": 0, "coverage": 40, "flags": [ "TRANSPARENT", "LIQUIDCONT" ], + "liquid_source": { "id": "water_clean", "count": [ 40, 240 ] }, "bash": { "str_min": 15, "str_max": 80, diff --git a/data/mods/MindOverMatter/furniture_and_terrain/terrain_alien.json b/data/mods/MindOverMatter/furniture_and_terrain/terrain_alien.json index acd7ba2e33a3f..2fb329ac32117 100644 --- a/data/mods/MindOverMatter/furniture_and_terrain/terrain_alien.json +++ b/data/mods/MindOverMatter/furniture_and_terrain/terrain_alien.json @@ -20,7 +20,8 @@ "color": "black", "move_cost": 6, "emissions": [ "emit_cold_nether_water" ], - "flags": [ "TRANSPARENT", "LIQUID", "NO_SCENT", "SWIMMABLE", "MURKY" ], + "//liquid_source": { "id": "water_murky" }, + "flags": [ "TRANSPARENT", "LIQUID", "NO_SCENT", "SWIMMABLE" ], "connect_groups": "WATER", "connects_to": "WATER" }, @@ -34,7 +35,8 @@ "color": "black", "move_cost": 10, "emissions": [ "emit_cold_deep_nether_water" ], - "flags": [ "TRANSPARENT", "LIQUID", "NO_SCENT", "SWIMMABLE", "DEEP_WATER", "MURKY" ], + "//liquid_source": { "id": "water_murky" }, + "flags": [ "TRANSPARENT", "LIQUID", "NO_SCENT", "SWIMMABLE", "DEEP_WATER" ], "connect_groups": "WATER", "connects_to": "WATER" }, diff --git a/data/mods/My_Sweet_Cataclysm/sweet_mapgen/sweet_terrain.json b/data/mods/My_Sweet_Cataclysm/sweet_mapgen/sweet_terrain.json index d2bc99097fd29..4c70124b7360b 100644 --- a/data/mods/My_Sweet_Cataclysm/sweet_mapgen/sweet_terrain.json +++ b/data/mods/My_Sweet_Cataclysm/sweet_mapgen/sweet_terrain.json @@ -7,7 +7,8 @@ "symbol": "~", "color": "light_blue", "move_cost": 5, - "flags": [ "TRANSPARENT", "LIQUID", "NO_SCENT", "SWIMMABLE", "FISHABLE", "SHALLOW_WATER", "CHOCOLATE" ], + "liquid_source": { "id": "liquid_cacao", "min_temp": 4.4 }, + "flags": [ "TRANSPARENT", "LIQUID", "NO_SCENT", "SWIMMABLE", "FISHABLE", "SHALLOW_WATER" ], "connect_groups": "WATER", "connects_to": "WATER", "examine_action": "water_source" @@ -20,7 +21,8 @@ "symbol": "~", "color": "light_blue", "move_cost": 5, - "flags": [ "TRANSPARENT", "LIQUID", "NO_SCENT", "SWIMMABLE", "FISHABLE", "CHOCOLATE" ], + "liquid_source": { "id": "liquid_cacao", "min_temp": 4.4 }, + "flags": [ "TRANSPARENT", "LIQUID", "NO_SCENT", "SWIMMABLE", "FISHABLE" ], "connect_groups": "WATER", "connects_to": "WATER", "examine_action": "water_source" diff --git a/doc/EXAMINE.md b/doc/EXAMINE.md index a8b4aa3f2167c..6cfd74ab582e4 100644 --- a/doc/EXAMINE.md +++ b/doc/EXAMINE.md @@ -16,7 +16,7 @@ The examine actors are specified as JSON objects with a `type` corresponding to - ```controls_gate``` Controls the attached gate. - ```dirtmound``` Plant seeds and plants. - ```elevator``` Use the elevator to change floors. -- ```finite_water_source``` Drink or get water from a water source. Unlike ordinary `water_source`, terrain with this examine action will get liquid from a finite source (liquid is placed on that tile as an item during the mapgen) and will stop functioning if said liquid if exhausted on that tile. +- ```finite_water_source``` Drink or get liquid from this terrain/furniture. Unlike ordinary `water_source`, terrain with this examine action will get liquid from a finite source (liquid is placed on that tile as an item during the mapgen) and will stop functioning if said liquid if exhausted on that tile. Should be used in pair with `liquid_source` - ```flower_poppy``` Pick the mutated poppy. - ```fswitch``` Flip the switch and the rocks will shift. - ```fungus``` Release spores as the terrain crumbles away. @@ -37,8 +37,7 @@ The examine actors are specified as JSON objects with a `type` corresponding to - ```shrub_marloss``` Pick a Marloss bush. - ```shrub_wildveggies``` Pick a wild veggies shrub. - ```slot_machine``` Gamble. -- ```toilet``` Either drink or get water out of the toilet. -- ```water_source``` Drink or get water from a water source. +- ```water_source``` Drink or get liquid from a furniture/terrain. Should be used in pair with `liquid_source` ## Examine Actors diff --git a/doc/JSON_FLAGS.md b/doc/JSON_FLAGS.md index c28d168c0870b..8d2c276adb2bf 100644 --- a/doc/JSON_FLAGS.md +++ b/doc/JSON_FLAGS.md @@ -606,7 +606,6 @@ List of known flags, used in both `furniture` and `terrain`. Some work for both - ```BUTCHER_EQ``` Butcher's equipment - required for full butchery of corpses. - ```CAN_SIT``` Furniture the player can sit on. Player sitting near furniture with the `FLAT_SURF` tag will get mood bonus for eating. - ```CHIP``` Used in construction menu to determine if wall can have paint chipped off. -- ```CHOCOLATE``` Made of delicious chocolate. Used by the My Sweet Cataclysm mod. - ```CLIMBABLE``` You can climb on this obstacle. - ```CLIMB_SIMPLE``` You never fail climbing on this obstacle. - ```COLLAPSES``` Has a roof that can collapse. @@ -649,7 +648,6 @@ List of known flags, used in both `furniture` and `terrain`. Some work for both - ```LOCKED``` Is locked, requiring either external control or lockpicking to open. - ```MINEABLE``` Can be mined with a pickaxe/jackhammer. - ```MOUNTABLE``` Suitable for guns with the `MOUNTED_GUN` flag. -- ```MURKY``` Liquid taken from tiles with this flag is badly poisoned (almost on par with sewage). - ```NANOFAB_TABLE``` This is a nanofabricator, and it can generate items out of specific blueprints. Hardcoded - ```NOCOLLIDE``` Feature that simply doesn't collide with vehicles at all. - ```NOITEM``` Items cannot be added here but may overflow to adjacent tiles. See also `DESTROY_ITEM`. @@ -680,7 +678,6 @@ List of known flags, used in both `furniture` and `terrain`. Some work for both - ```ROUGH``` May hurt the player's feet. - ```RUBBLE``` Furniture behaves like rubble: it can be cleared by the `CLEAR_RUBBLE` item action. Can be applied to terrain, but it "clears up the nothing". - ```RUG``` Enables the `Remove Carpet` Construction entry. -- ```SALT_WATER``` Source of salt water (works for terrains with examine action "water_source"). - ```SEALED``` Can't use e to retrieve items; must smash them open first. - ```SEEN_FROM_ABOVE``` Visible from a higher level (provided the tile above has no floor). - ```SHALLOW_WATER``` This is water that is not deep enough to submerge the player. @@ -697,7 +694,6 @@ List of known flags, used in both `furniture` and `terrain`. Some work for both - ```SWIMMABLE``` Player and monsters can swim through it. - ```THIN_OBSTACLE``` ```SPEAR``` attacks can go through this to hit something on the other side. - ```TINY``` Feature too short to collide with vehicle undercarriage. Vehicles drive over them with no damage, unless a wheel hits them. -- ```TOILET_WATER``` Liquid taken from tiles with this flag is rather dirty and may poison you. - ```TRANSLOCATOR``` Tile is a translocator gate, for purposes of the `translocator` examine action. - ```TRANSPARENT_FLOOR``` This terrain allows light to the z-level below. - ```TRANSPARENT``` Players and monsters can see through/past it. Also sets ter_t.transparent. diff --git a/doc/JSON_INFO.md b/doc/JSON_INFO.md index 0ffc65de3d97a..cd0518b60fb1e 100644 --- a/doc/JSON_INFO.md +++ b/doc/JSON_INFO.md @@ -5234,6 +5234,7 @@ Strength required to move the furniture around. Negative values indicate an unmo { "seasons": [ "spring", "autumn" ], "id": "burdock_harv" }, { "seasons": [ "summer" ], "id": "burdock_summer_harv" } ], + "liquid_source": { "id": "water", "min_temp": 7.8, "count": [ 24, 48 ] }, "roof": "t_roof", "examine_action": "pit", "boltcut": { @@ -5444,6 +5445,19 @@ Example: "harvest_by_season": [ { "seasons": [ "spring", "summer", "autumn", "winter" ], "id": "blackjack_harv" } ], ``` +#### `liquid_source` + +(Optional) Object, that contain liquids this terrain or furniture can give + +Example: +```c++ +"liquid_source": { + "id": "water", // id of a liquid given by ter/furn + "min_temp": 7.8, // liquid picked from here can't go below this temperature, in centigrade; Used only by "water_source" examine action + "count": [ 24, 48 ] // if source is finite, how much there should be of it. Omit if it need to have infinite amount of liquid. Accepts either single number, or array of two numbers. Used only by "finite_water_source" examine action +} +``` + #### `roof` (Optional) The terrain of the terrain on top of this (the roof). diff --git a/src/iexamine.cpp b/src/iexamine.cpp index 729fe1d09764c..bbb875dd8bbe5 100644 --- a/src/iexamine.cpp +++ b/src/iexamine.cpp @@ -4708,7 +4708,7 @@ void iexamine::part_con( Character &you, tripoint_bub_ms const &examp ) void iexamine::water_source( Character &, const tripoint &examp ) { map &here = get_map(); - item water = here.water_from( examp ); + item water = here.liquid_from( examp ); liquid_handler::handle_liquid( water, nullptr, 0, &examp ); } diff --git a/src/inventory.cpp b/src/inventory.cpp index 6e27d7dd1bf3c..5955dadc55e3f 100644 --- a/src/inventory.cpp +++ b/src/inventory.cpp @@ -578,7 +578,7 @@ void inventory::form_from_map( map &m, std::vector pts, const Characte } } // Handle any water from map sources. - item water = m.water_from( p ); + item water = m.liquid_from( p ); if( !water.is_null() ) { add_item( water ); } @@ -866,7 +866,7 @@ void inventory::rust_iron_items() elem_stack_iter.base_volume().value() ) / 250 ) ) ) ) && // ^season length ^14/5*0.75/pi (from volume of sphere) //Freshwater without oxygen rusts slower than air - here.water_from( player_character.pos_bub() ).typeId() == itype_salt_water ) { + here.liquid_from( player_character.pos_bub() ).typeId() == itype_salt_water ) { // rusting never completely destroys an item, so no need to handle return value elem_stack_iter.inc_damage(); add_msg( m_bad, _( "Your %s is damaged by rust." ), elem_stack_iter.tname() ); diff --git a/src/map.cpp b/src/map.cpp index 7860fba09280a..7dd71e7447d20 100644 --- a/src/map.cpp +++ b/src/map.cpp @@ -148,8 +148,6 @@ static const item_group_id Item_spawn_data_default_zombie_items( "default_zombie static const itype_id itype_battery( "battery" ); static const itype_id itype_nail( "nail" ); -static const itype_id itype_water( "water" ); -static const itype_id itype_water_murky( "water_murky" ); static const material_id material_glass( "glass" ); @@ -188,7 +186,6 @@ static const ter_str_id ter_t_reb_cage( "t_reb_cage" ); static const ter_str_id ter_t_rock( "t_rock" ); static const ter_str_id ter_t_rock_floor( "t_rock_floor" ); static const ter_str_id ter_t_rootcellar( "t_rootcellar" ); -static const ter_str_id ter_t_sewage( "t_sewage" ); static const ter_str_id ter_t_soil( "t_soil" ); static const ter_str_id ter_t_stump( "t_stump" ); static const ter_str_id ter_t_tree_birch( "t_tree_birch" ); @@ -2440,12 +2437,10 @@ bool map::ter_set( const tripoint_bub_ms &p, const ter_id &new_terrain, bool avo set_seen_cache_dirty( p ); } - if( new_t.has_flag( "SPAWN_WITH_WATER" ) ) { - itype_id water_type = new_t.has_flag( ter_furn_flag::TFLAG_MURKY ) ? itype_water_murky : - itype_water; - item water( water_type, calendar::start_of_cataclysm ); - // TODO: Move all numeric values to json - water.charges = rng( 40, 240 ); + if( !new_t.liquid_source_item_id.empty() && new_t.liquid_source_count != std::make_pair( 0, 0 ) ) { + + item water( new_t.liquid_source_item_id, calendar::start_of_cataclysm ); + water.charges = rng( new_t.liquid_source_count.first, new_t.liquid_source_count.second ); add_item( p, water ); } @@ -5758,43 +5753,22 @@ item &map::add_item( const tripoint_bub_ms &p, item new_item, int copies ) } // NOLINTNEXTLINE(readability-make-member-function-const) -item map::water_from( const tripoint &p ) +item map::liquid_from( const tripoint &p ) { - return map::water_from( tripoint_bub_ms( p ) ); + return map::liquid_from( tripoint_bub_ms( p ) ); } -item map::water_from( const tripoint_bub_ms &p ) const +item map::liquid_from( const tripoint_bub_ms &p ) const { weather_manager &weather = get_weather(); - if( has_flag( ter_furn_flag::TFLAG_SALT_WATER, p ) ) { - item ret( "salt_water", calendar::turn, item::INFINITE_CHARGES ); - ret.set_item_temperature( std::max( weather.get_temperature( p.raw() ), - temperatures::cold ) ); - return ret; - } + ter_t source_terrain = ter( p ).obj(); - if( has_flag( ter_furn_flag::TFLAG_CHOCOLATE, p ) ) { - item ret( "liquid_cacao", calendar::turn, item::INFINITE_CHARGES ); - ret.set_item_temperature( std::max( weather.get_temperature( p.raw() ), - temperatures::cold ) ); - return ret; - } - - const ter_id terrain_id = ter( p ); - if( terrain_id == ter_t_sewage ) { - item ret( "water_sewage", calendar::turn, item::INFINITE_CHARGES ); - ret.set_item_temperature( std::max( weather.get_temperature( p.raw() ), - temperatures::cold ) ); - return ret; - } + if( !source_terrain.liquid_source_item_id.empty() && + source_terrain.liquid_source_count == std::make_pair( 0, 0 ) ) { - // iexamine::water_source requires a valid liquid from this function. - if( terrain_id->has_examine( iexamine::water_source ) || - furn( p )->has_examine( iexamine::water_source ) ) { - itype_id liquid_id = has_flag( ter_furn_flag::TFLAG_MURKY, p ) ? itype_water_murky : itype_water; - item ret( liquid_id, calendar::turn, item::INFINITE_CHARGES ); + item ret( source_terrain.liquid_source_item_id, calendar::turn, item::INFINITE_CHARGES ); ret.set_item_temperature( std::max( weather.get_temperature( p.raw() ), - temperatures::cold ) ); + units::from_celsius( source_terrain.liquid_source_min_temp ) ) ); return ret; } return item(); @@ -6263,7 +6237,7 @@ std::list map::use_amount_square( const tripoint_bub_ms &p, const itype_id { std::list ret; // Handle infinite map sources. - item water = water_from( p ); + item water = liquid_from( p ); if( water.typeId() == type && water.charges == item::INFINITE_CHARGES ) { ret.push_back( water ); quantity = 0; @@ -6460,7 +6434,7 @@ std::list map::use_charges( const std::vector &reachable_ // first for( const tripoint_bub_ms &p : reachable_pts ) { // Handle infinite map sources. - item water = water_from( p ); + item water = liquid_from( p ); if( water.typeId() == type && water.charges == item::INFINITE_CHARGES ) { water.charges = quantity; ret.push_back( water ); diff --git a/src/map.h b/src/map.h index 0df0e2ed38265..684c18b7219da 100644 --- a/src/map.h +++ b/src/map.h @@ -1501,8 +1501,8 @@ class map return i_at( tripoint_bub_ms( p, abs_sub.z() ) ); } // TODO: Get rid of untyped overload. - item water_from( const tripoint &p ); - item water_from( const tripoint_bub_ms &p ) const; + item liquid_from( const tripoint &p ); + item liquid_from( const tripoint_bub_ms &p ) const; // TODO: Get rid of untyped overload. void i_clear( const tripoint &p ); void i_clear( const tripoint_bub_ms &p ); diff --git a/src/mapdata.cpp b/src/mapdata.cpp index d74430bcec3d2..f93b89fda3315 100644 --- a/src/mapdata.cpp +++ b/src/mapdata.cpp @@ -258,7 +258,6 @@ std::string enum_to_string( ter_furn_flag data ) case ter_furn_flag::TFLAG_MURKY: return "MURKY"; case ter_furn_flag::TFLAG_AMMOTYPE_RELOAD: return "AMMOTYPE_RELOAD"; case ter_furn_flag::TFLAG_TRANSPARENT_FLOOR: return "TRANSPARENT_FLOOR"; - case ter_furn_flag::TFLAG_TOILET_WATER: return "TOILET_WATER"; case ter_furn_flag::TFLAG_ELEVATOR: return "ELEVATOR"; case ter_furn_flag::TFLAG_ACTIVE_GENERATOR: return "ACTIVE_GENERATOR"; case ter_furn_flag::TFLAG_TRANSLUCENT: return "TRANSLUCENT"; @@ -865,6 +864,19 @@ void map_data_common_t::load( const JsonObject &jo, const std::string &src ) } } + if( jo.has_object( "liquid_source" ) ) { + JsonObject liquid_source = jo.get_object( "liquid_source" ); + mandatory( liquid_source, was_loaded, "id", liquid_source_item_id ); + optional( liquid_source, was_loaded, "min_temp", liquid_source_min_temp ); + if( liquid_source.has_int( "count" ) ) { + mandatory( liquid_source, was_loaded, "count", liquid_source_count.first ); + mandatory( liquid_source, was_loaded, "count", liquid_source_count.second ); + } else if( liquid_source.has_array( "count" ) ) { + JsonArray ja = liquid_source.get_array( "count" ); + liquid_source_count = { ja.get_int( 0 ), ja.get_int( 1 ) }; + } + } + mandatory( jo, was_loaded, "description", description ); optional( jo, was_loaded, "curtain_transform", curtain_transform ); diff --git a/src/mapdata.h b/src/mapdata.h index 917fd4afcdb83..26dbb688b5042 100644 --- a/src/mapdata.h +++ b/src/mapdata.h @@ -319,7 +319,6 @@ enum class ter_furn_flag : int { TFLAG_MURKY, TFLAG_AMMOTYPE_RELOAD, TFLAG_TRANSPARENT_FLOOR, - TFLAG_TOILET_WATER, TFLAG_ELEVATOR, TFLAG_ACTIVE_GENERATOR, TFLAG_SMALL_HIDE, @@ -515,6 +514,10 @@ struct map_data_common_t { // Maximal volume of items that can be stored in/on this furniture units::volume max_volume = DEFAULT_TILE_VOLUME; + std::string liquid_source_item_id; // id of a liquid this tile provides + double liquid_source_min_temp = 4; // in centigrades, cold water as default value + std::pair liquid_source_count = { 0, 0 }; // charges of liquid, if it's finite source + translation description; // The color the sym will draw in on the GUI.