Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Water camouflage: Make fish not visible from unrealistically far away (…
…CleverRaven#50785) * Start adding WATER_CAMOUFLAGE WATER_CAMOUFLAGE is a flag meant to reflect that it is currently unrealistically easy in CDDA to see many things, including most fish, underwater. This first iteration does not have any changes re is_divable. * Scrap is_divable for creature::sees map::is_divable() checks for not only DEEP_WATER, but SWIMMABLE. It is not reasonable for visibility underwater to be lessened by a liquid being swimmable by a human. Moreover, the check for DEEP_WATER likely predates the use of Z-levels in water (as per @ralreegorganon on discord); Z-levels should be taken into account, although DEEP_WATER is unfortunately still used for various terrain. So rule out visibility from out of the water to underwater if at least 2 of the following are true: has WATER_CAMOUFLAGE; terrain position has DEEP_WATER; Z-levels are different. * Add WATER_CAMOUFLAGE to fish.json; misc cleanup This adds the new `WATER_CAMOUFLAGE` flag to appropriate critters in fish.json (those with the `fish` faction, at least to start; game balance will need to be considered before adding to members of less-neutral factions). It also removes `WARM` from inappropriate fish/shellfish (too small to be warm due to retained heat alone) and puts in `ARTHROPOD_BLOOD` in a couple of places it was missing (e.g., non-mutant crayfish). * Document WATER_CAMOUFLAGE flag Provide (in JSON_FLAGS.md) documentation for the new WATER_CAMOUFLAGE flag. (Mostly a copy-and-pase from the CAMOUFLAGE flag, but with some additions.) * Sanity check; remove one auto This puts a sanity check into `MonsterGenerator::check_monster_definitions()` so that monsters that can't submerge will generate a debug message if they're tagged with WATER_CAMOUFLAGE. It also changes an `auto` into the actual type, mtype, to be clearer about what is happening. Use mon.id, not mon: `monster( thingy )` wants an mtype_id thingy, not mtype. * Water camouflage for 1 DinoMod, 1 DSA critter This adds the WATER_CAMOUFLAGE to the most appropriate monster from each of DinoMod and Dark Skies Above; both are AQUATIC (as well as SWIMS). For the first, I added it to the mosasaurus hatchling, which is rather defenseless otherwise. For the second, I added it to the (non-sewer) lurker (it is more described as waiting such that it is hard to see). * Get water_camouflage working better is_underwater() appears to be somewhat pickier than I had thought regarding whether something is actually in water. Checking for _either_ is_underwater _or_ terrain being swimmable; may need to extend to second check also, but this unfortunately does mean that at least some non-water liquids are getting excluded. Should not matter yet, but may for Aftershock, say. * Extend use of TFLAG_SWIMMABLE/SHALLOW/DEEP Get around apparent limits of is_underwater(). * Take into account AQUATIC re SWIMMABLE After experiments revealed that is_underwater() is not reliable, @Venera3 pointed out (thanks!) that AQUATIC's implementation of not going on land is actually checking for SWIMMABLE, and suggested using SWIMMABLE for more. Allowing AQUATIC + SWIMMABLE to indicate being underwater even if is_underwater() is false. For WATER_CAMOUFLAGE, also accepting SHALLOW_WATER (although may need size check, since that is defined as water not deep enough to cover a human) or DEEP_WATER. * Code cleanup Move checking for likely being underwater (either is_underwater or AQUATIC and on SWIMMABLE terrain) into a function. Also add helper function majority_rule as suggested by @jbytheway on discord. * Add WATER_CAMOUFLAGE to more; size; flag fixes This adds WATER_CAMOUFLAGE to several more appropriate species, including the dragonfly nymph/naiad, beaver (but not zombeaver - brown camouflage is going to be disrupted by red/pink/white ribs being visible), otter, jawed terror, and the two more-evolved swimmer zombies (the mancroc and non-base swimmer zombie; the latter is noted as "glistening"). However, SHALLOW_WATER will no longer count for distance-based WATER_CAMOUFLAGE for anything human-size or bigger, since SHALLOW_WATER is insufficient to cover a human being. I also added CLIMBS to the grey fox (specifically noted as doing so) and SWIMS to the mink (mentioned as semi-aquatic, for instance). Comment re LOUDMOVES and INSECT_FLYING * Add WATER_CAMOUFLAGE to vinebeast; typo correct This adds WATER_CAMOUFLAGE to the (triffid) vinebeast (not the creeper vine, which is immobile), which has SWIMS. Also slight copyediting on one description. * Change to ter_furn_flag:: Update terrain flags to ter_furn_flag::* use. Co-authored-by: actual-nh <[email protected]>
- Loading branch information