diff --git a/blastmud_game/src/message_handler/user_commands/movement.rs b/blastmud_game/src/message_handler/user_commands/movement.rs index 5da13a6..b1e4745 100644 --- a/blastmud_game/src/message_handler/user_commands/movement.rs +++ b/blastmud_game/src/message_handler/user_commands/movement.rs @@ -35,8 +35,8 @@ use crate::{ dynzone::{dynzone_by_type, DynzoneType, ExitTarget as DynExitTarget}, npc::check_for_instant_aggro, room::{ - self, check_for_enter_action, check_for_exit_action, Direction, ExitClimb, ExitType, - MaterialType, + self, check_for_enter_action, check_for_exit_action, room_map_by_code, Direction, + ExitClimb, ExitType, MaterialType, }, species::species_info_map, }, @@ -375,6 +375,29 @@ pub async fn reverse_climb( } } +// Calculates the impact of movement, in 1/100ths of a percentage point impact on thirst. +fn movement_thirst_impact(into_room: &str) -> u16 { + const DEFAULT_IMPACT: u16 = 30; + let (r_type, r_code) = match into_room.split_once("/") { + None => return DEFAULT_IMPACT, + Some(v) => v, + }; + if r_type != "room" { + return DEFAULT_IMPACT; + } + let room = match room_map_by_code().get(r_code) { + None => return DEFAULT_IMPACT, + Some(r) => r, + }; + let temp_room_hundredths: f64 = room.environment.temperature as f64; + // Apply the S-shaped logistic function calibrated as follows: + // Minimum -> 5, 2000 (20.0 deg C) -> 10, 3700 (37.0 deg C) -> 80, Maximum -> 100 + let thirst_factor = 95.0 + / (1.0 + (-2.4777221163991086E-3 * (temp_room_hundredths - 3166.543955339416)).exp()) + + 5.0; + (thirst_factor * 3.0) as u16 +} + // Returns true if the move is either complete or still in progress. // Returns false if the move failed. pub async fn attempt_move_immediate( @@ -694,7 +717,7 @@ pub async fn attempt_move_immediate( recalculate_urge_growth(ctx.trans, &mut ctx.item).await?; if let Some(urges) = ctx.item.urges.as_mut() { urges.thirst.last_value = urges.thirst.value; - urges.thirst.value = (urges.thirst.value + 10).min(10000); + urges.thirst.value = (urges.thirst.value + movement_thirst_impact(&new_loc)).min(10000); thirst_changed(&ctx.trans, &ctx.item).await?; } diff --git a/blastmud_game/src/models/item.rs b/blastmud_game/src/models/item.rs index 5521757..eac3428 100644 --- a/blastmud_game/src/models/item.rs +++ b/blastmud_game/src/models/item.rs @@ -180,7 +180,7 @@ impl LiquidType { match self { LiquidType::Water => Some(EatData { hunger_impact: 0, - thirst_impact: -20, // 0.2% per mL + thirst_impact: -8, // 0.08% per mL }), } } diff --git a/blastmud_game/src/services/spawn.rs b/blastmud_game/src/services/spawn.rs index de226a3..84cc58e 100644 --- a/blastmud_game/src/services/spawn.rs +++ b/blastmud_game/src/services/spawn.rs @@ -138,6 +138,18 @@ fn spawn_list() -> &'static BTreeMap<&'static str, SpawnDistribution> { ], }, ), + ( + "fixed_item/northrad_oasis_billabong", + SpawnDistribution::SpawnOne { + pvec: vec![( + 1.0, + Box::new(SpawnDistribution::SpawnLiquid { + what: LiquidType::Water, + how_much: 1000000, + }), + )], + }, + ), ] .into_iter() .collect() diff --git a/blastmud_game/src/static_content/fixed_item.rs b/blastmud_game/src/static_content/fixed_item.rs index 6e0e732..4f7e0d4 100644 --- a/blastmud_game/src/static_content/fixed_item.rs +++ b/blastmud_game/src/static_content/fixed_item.rs @@ -2,7 +2,7 @@ use super::{possession_type::PossessionData, StaticItem}; use crate::{ models::item::{Item, ItemStaticSpecialData, LocationActionType, Pronouns}, - static_content::room::{computer_museum, melbs}, + static_content::room::{computer_museum, melbs, northern_radfields}, }; use ansi::ansi; use once_cell::sync::OnceCell; @@ -63,6 +63,7 @@ fn fixed_item_list() -> &'static Vec { ].into_iter() .chain(computer_museum::fixed_items().into_iter()) .chain(melbs::fixed_items().into_iter()) + .chain(northern_radfields::fixed_items().into_iter()) .collect() }) } diff --git a/blastmud_game/src/static_content/room.rs b/blastmud_game/src/static_content/room.rs index a191025..461f6ef 100644 --- a/blastmud_game/src/static_content/room.rs +++ b/blastmud_game/src/static_content/room.rs @@ -579,12 +579,16 @@ impl Default for Room { #[derive(Serialize, Deserialize, Clone)] #[serde(default)] pub struct RoomEnvironment { - pub radiation: u64, // mSv/10s tick + pub radiation: u64, // mSv/10s tick + pub temperature: u16, // in 100ths of degrees celsius. } impl Default for RoomEnvironment { fn default() -> Self { - Self { radiation: 0 } + Self { + radiation: 0, + temperature: 2000, // 20 degrees celsius + } } } diff --git a/blastmud_game/src/static_content/room/northern_radfields.rs b/blastmud_game/src/static_content/room/northern_radfields.rs index 0ee5470..ff452dc 100644 --- a/blastmud_game/src/static_content/room/northern_radfields.rs +++ b/blastmud_game/src/static_content/room/northern_radfields.rs @@ -1,4 +1,7 @@ +use crate::static_content::fixed_item::FixedItem; + use super::{Room, SimpleRoom}; +use ansi::ansi; use serde_yaml::from_str as from_yaml_str; pub fn room_list() -> Vec { @@ -8,3 +11,17 @@ pub fn room_list() -> Vec { .map(|r| r.into()) .collect() } + +pub fn fixed_items() -> Vec { + vec![ + FixedItem { + code: "northrad_oasis_billabong".to_owned(), + name: "billabong".to_owned(), + description: ansi!("A small body of water of clean-looking fresh water that seems to have been cut into the red earth by an ancient, now gone river. A spring seems to be bubbling away, slowly replenishing the cooling water, leaving the area cooler than the surrounding environment, and creating a relatively green patch of land amongst the scorched desert [Try drink from billabong or, if you have a suitable container, fill container from billabong].").to_owned(), + location: "room/northrad_i5".to_owned(), + proper_noun: false, + aliases: vec!["watering hole".to_owned(), "lake".to_owned(), "spring".to_owned()], + ..Default::default() + }, + ] +} diff --git a/blastmud_game/src/static_content/room/northern_radfields.yaml b/blastmud_game/src/static_content/room/northern_radfields.yaml index 8d06a4d..45c2f49 100644 --- a/blastmud_game/src/static_content/room/northern_radfields.yaml +++ b/blastmud_game/src/static_content/room/northern_radfields.yaml @@ -120,6 +120,8 @@ exit_climb: height: 10 difficulty: 8 + environment: + temperature: 1600 - zone: northern_radfields code: northrad_n5_deep name: Beneath the gorge River @@ -131,6 +133,8 @@ z: -1 description: "Beneath the cold deep water you can see the rocky bottom of the gorge. You notice parts of a broken bridge lying on the river bed. An occasional silvery fish swims past" material_type: !Underwater + environment: + temperature: 1000 exits: - direction: up - zone: northern_radfields @@ -166,7 +170,9 @@ your skin" down relentlessly, casting long shadows across the sand. The air is filled with the grit and dust kicked up by the wind, stinging your eyes and coating your skin" - radiation: 100 + environment: + radiation: 100 + temperature: 3000 exits: - direction: north - direction: south @@ -180,7 +186,9 @@ your skin" y: 6 z: 0 description: A large rocky outcrop juts out of the desert, its jagged grey edges casting long shadows over the surrounding red sands. It smells vaguely of smoke here. To the southeast you can vaguely make out a structure - radiation: 120 + environment: + radiation: 120 + temperature: 4130 exits: - direction: east - direction: southeast @@ -195,7 +203,9 @@ your skin" y: 6 z: 0 description: A narrow rocky passage winds its way through the desert here, offering some shelter from the relentless sun and wind. It smells dusty here. To the south you can barely make out a building of some kind - radiation: 120 + environment: + radiation: 120 + temperature: 4310 exits: - direction: east - direction: southeast @@ -212,7 +222,9 @@ your skin" y: 6 z: 0 description: The desert is comparatively flat here, but the wind is whipping up the dust, reducing your visibility, and giving a faint reddish haze in all directions. It smells dusty here. To the southwest you can barely make out a building of some kind shrouded in dusty haze - radiation: 120 + environment: + radiation: 120 + temperature: 4550 exits: - direction: east - direction: southeast @@ -229,7 +241,9 @@ your skin" y: 6 z: 0 description: Mountains of bleached bones of long-dead animals, each bone scratched as if by the talon of some creature of extraordinary size, lie scattered across the desert here, adding an eerie silence to the otherwise monotonous surroundings. Despite there being no chance of a sea anywhere near here, it smells faintly like a beach. To the west you see a reddish haze - radiation: 120 + environment: + radiation: 120 + temperature: 4360 exits: - direction: east - direction: southeast @@ -246,7 +260,9 @@ your skin" y: 6 z: 0 description: Lying oddly in the middle of the desert is a huge reddish pillar, easily five metres in diameter and towering up into the sky, its surface reddish like dirt, the surface chipped and oddly shaped. It is unclear whether this is a natural phenomenom or a human creation, but fortunately, despite its foreboding shadow, it can easily be traversed - radiation: 120 + environment: + radiation: 120 + temperature: 4180 exits: - direction: south - direction: southwest @@ -261,7 +277,9 @@ your skin" y: 7 z: 0 description: A rather uneventful flat section of rusty red desert, the only real feature of note close by being a dilapidated attempt at a high dingo fence blocking the way to the west. Rusty wire mesh, now riddled with holes, is strung between high metal poles that have been driven into the ground. In the distance to the east, you see some kind of structure that has been erected in the desert - radiation: 120 + environment: + radiation: 120 + temperature: 3990 exits: - direction: north - direction: northeast @@ -277,7 +295,9 @@ your skin" y: 7 z: 0 description: A narrow rocky passage winds its way through the desert here, offering some shelter from the relentless sun and wind. It smells dusty here. To the south you can barely make out a building of some kind - radiation: 120 + environment: + radiation: 120 + temperature: 4210 exits: - direction: north - direction: northeast @@ -296,7 +316,9 @@ your skin" y: 7 z: 0 description: The desert is comparatively flat here, but the wind is whipping up the dust, reducing your visibility, and giving a faint reddish haze in all directions. It smells dusty here. To the southwest you can barely make out a building of some kind shrouded in dusty haze - radiation: 120 + environment: + radiation: 120 + temperature: 4380 exits: - direction: north - direction: northeast @@ -315,7 +337,9 @@ your skin" y: 7 z: 0 description: Mountains of bleached bones of long-dead animals, each bone scratched as if by the talon of some creature of extraordinary size, lie scattered across the desert here, adding an eerie silence to the otherwise monotonous surroundings. Despite there being no chance of a sea anywhere near here, it smells faintly like a beach. To the west you see a reddish haze - radiation: 120 + environment: + radiation: 120 + temperature: 4200 exits: - direction: east - direction: southeast @@ -332,7 +356,9 @@ your skin" y: 7 z: 0 description: Lying oddly in the middle of the desert is a huge reddish pillar, easily five metres in diameter and towering up into the sky, its surface reddish like dirt, the surface chipped and oddly shaped. It is unclear whether this is a natural phenomenom or a human creation, but fortunately, despite its foreboding shadow, it can easily be traversed - radiation: 120 + environment: + radiation: 120 + temperature: 4050 exits: - direction: south - direction: southwest @@ -347,7 +373,9 @@ your skin" y: 8 z: 0 description: A rather uneventful flat section of rusty red desert, the only real feature of note close by being a tall wall, evidently of great age, constructed by fitting stones together, blocking the way to the west. The stones are now covered in green moss, one of the few things to survive in this harsh climate - radiation: 120 + environment: + radiation: 120 + temperature: 3860 exits: - direction: north - direction: northeast @@ -364,7 +392,9 @@ your skin" y: 8 z: 0 description: The desert here is covered with small shrubs, except that there are multiple large rings of red soil where no plants grow. To the north, you see a structure that looks like some kind of house - radiation: 80 + environment: + radiation: 80 + temperature: 4120 exits: - direction: north - direction: northeast @@ -384,7 +414,9 @@ your skin" y: 8 z: 0 description: The reddish-brown sands of the desert here are spotted with clumps of wallaby grass. An occasional kangaroo hops by, grazing on the plants. To the south, you see the shimmer of what is either a body of water or a mirage - radiation: 60 + environment: + radiation: 60 + temperature: 4290 exits: - direction: north - direction: northeast @@ -404,7 +436,9 @@ your skin" y: 8 z: 0 description: Here you can see nothing but red sand for a significant distance - radiation: 120 + environment: + radiation: 120 + temperature: 4120 exits: - direction: north - direction: northeast @@ -424,7 +458,9 @@ your skin" y: 8 z: 0 description: There is a lot of empty red sand here in the hot desert. To the east you see a towering sheer cliff, surely impassable even to the most experienced climber - radiation: 120 + environment: + radiation: 120 + temperature: 3900 exits: - direction: north - direction: south @@ -441,7 +477,9 @@ your skin" y: 9 z: 0 description: Beyond a rusted chain-link fence to your east, the landscape is a patchwork of reddish sand dunes and rocky outcroppings. A sense of unease lingers in the stillness; there's an unsettling tranquility to this forsaken place. Scattered among the sands are remnants of what appear to be shredded scraps of cloth and torn metal, hinting at a past presence long forgotten. The silence is broken occasionally by the distant, faintly melancholic howls of far-off creatures. - radiation: 120 + environment: + radiation: 120 + temperature: 3770 exits: - direction: north - direction: northeast @@ -458,7 +496,9 @@ your skin" y: 9 z: 0 description: The land slopes downwards from either side here, a wind-worn depression in the desert, the banks providing some respite from the relentless hot sun. Apart from the odd tuft of tussock grass that clings bravely to the banks, the valley is entirely composed of sandy red dust - radiation: 80 + environment: + radiation: 80 + temperature: 4040 exits: - direction: north - direction: northeast @@ -477,7 +517,9 @@ your skin" y: 9 z: 0 description: Here there are far more signs of life than anywhere around. A spring of clear water runs down a rock, filling a billabong. Insects buzz through the air, while the odd kookaburra or cockatoo stops by the water's edge to drink, filling the air with song and laughter. Small plants of various kinds cover the comparatively well-watered land nearby, while a few gum trees grow near the water's edge, dropping leaves which swirl in the billabong - radiation: 20 + environment: + radiation: 20 + temperature: 2460 exits: - direction: north - direction: northeast @@ -497,7 +539,9 @@ your skin" y: 9 z: 0 description: Here, a large termite mound juts from the red sand, as termites busily scurry across the land - radiation: 120 + environment: + radiation: 120 + temperature: 4020 exits: - direction: north - direction: northeast @@ -517,7 +561,9 @@ your skin" y: 9 z: 0 description: There is a lot of empty red sand here in the hot desert. To the east you see a towering sheer cliff, surely impassable even to the most experienced climber - radiation: 120 + environment: + radiation: 120 + temperature: 3840 exits: - direction: north - direction: south @@ -534,7 +580,9 @@ your skin" y: 10 z: 0 description: The sun beats down relentlessly on this side of the land, and there's barely any trace of life apart from a few hardy cacti clinging to existence. To the west is a steep, impassable gully - radiation: 120 + environment: + radiation: 120 + temperature: 3750 exits: - direction: north - direction: northeast @@ -551,7 +599,9 @@ your skin" y: 10 z: 0 description: A soot-seared firepit made of a circle of stones lies in the desert, surrounded by small tattered bits of carelessly discarded camping gear, one of the few scars of human life left in the vast expanses of red sand beneath the unrelenting hot sun - radiation: 80 + environment: + radiation: 80 + temperature: 3930 exits: - direction: north - direction: northeast @@ -571,7 +621,9 @@ your skin" y: 10 z: 0 description: The sandalwood trees here grow tall and strong, their thick trunks offering protection from the harsh elements of this forsaken land. To the north, you see a lush oasis filled with vibrant colors and life-giving water - radiation: 60 + environment: + radiation: 60 + temperature: 4080 exits: - direction: north - direction: northeast @@ -591,7 +643,9 @@ your skin" y: 10 z: 0 description: The sun beats down mercilessly on the land, as swirling winds whip up the red sand in a cone around you. A few hardy plants cling to existence, but otherwise the land is barren - radiation: 120 + environment: + radiation: 120 + temperature: 3920 exits: - direction: north - direction: northeast @@ -611,7 +665,9 @@ your skin" y: 10 z: 0 description: The cacti here grow so thick that you cannot see any way to go further east. Their sharp thorns provide a warning against intruders, and the sun beats down mercilessly on this side of the land, making survival a challenge even for these hardy plants - radiation: 120 + environment: + radiation: 120 + temperature: 3700 exits: - direction: north - direction: south @@ -628,7 +684,9 @@ your skin" y: 11 z: 0 description: Steep cliffs of rock to the south of west with barren hot red sand underfoot create the impression that you are in something akin to the corner of a giant sandpit - radiation: 120 + environment: + radiation: 120 + temperature: 3590 exits: - direction: north - direction: northeast @@ -643,7 +701,9 @@ your skin" y: 11 z: 0 description: The unusual geography here has made for something of a trap for the various tumbleweeds that blow across the scorching red sand. Mountains of them pile up against the sheer cliff face to the south - radiation: 80 + environment: + radiation: 80 + temperature: 3850 exits: - direction: north - direction: northeast @@ -660,7 +720,9 @@ your skin" y: 11 z: 0 description: The climate shifts noticably here from the wetter, more temperate environment to the south to harsh, dry, desert like conditions. A few tufted plants cling for life, but the main thing you see is vast quantities of hot dry red sand, stretching monotonously for as far as the eye can see - radiation: 60 + environment: + radiation: 60 + temperature: 3970 exits: - direction: north - direction: northeast @@ -678,7 +740,9 @@ your skin" y: 11 z: 0 description: The sun beats down relentlessly on the hot dry red sand of this desert. To the south, a rusty fence made of razor wire, stained at various points with the long-browned blood of animals unfortunate enough to have walked into it - radiation: 120 + environment: + radiation: 120 + temperature: 3840 exits: - direction: north - direction: northeast @@ -695,7 +759,9 @@ your skin" y: 11 z: 0 description: This seems to be the corner of the rusted razor-wire fence. Here, the hot dry red sand gives way to a patchwork of scrubland and low, thorny bushes. The fence stretches out to the horizon in both directions, its barbed wires glinting ominously in the harsh sunlight - radiation: 120 + environment: + radiation: 120 + temperature: 3570 exits: - direction: north - direction: west