Skip to content

Commit

Permalink
Merge pull request CleverRaven#77770 from GuardianDll/vision_stuff
Browse files Browse the repository at this point in the history
enchantify special vision [1/2]
  • Loading branch information
Night-Pryanik authored Nov 21, 2024
2 parents 3fbadf1 + e8dde65 commit 4dc15d0
Show file tree
Hide file tree
Showing 33 changed files with 619 additions and 136 deletions.
2 changes: 1 addition & 1 deletion data/json/bionics.json
Original file line number Diff line number Diff line change
Expand Up @@ -1106,7 +1106,7 @@
"description": "Your range of vision extends into the infrared, allowing you to see warm-blooded creatures in the dark or through smoke.",
"occupied_bodyparts": [ [ "eyes", 1 ] ],
"flags": [ "BIONIC_TOGGLED" ],
"active_flags": [ "INFRARED" ],
"enchantments": [ "THERMAL_VISION_GOOD" ],
"act_cost": "5 J",
"react_cost": "5 J",
"time": "1 s"
Expand Down
8 changes: 8 additions & 0 deletions data/json/effects.json
Original file line number Diff line number Diff line change
Expand Up @@ -846,6 +846,14 @@
"limb_score_mods": [ { "limb_score": "balance", "modifier": 0.8 }, { "limb_score": "reaction", "modifier": 0.75 } ],
"flags": [ "EFFECT_LIMB_SCORE_MOD" ]
},
{
"type": "effect_type",
"id": "mech_recon_vision",
"//": "is applied when you ride a mech. Ideally should be jsonified in some way",
"name": [ "" ],
"desc": [ "." ],
"enchantments": [ "THERMAL_VISION_GOOD_PASSIVE", "nvg_great_mech" ]
},
{
"type": "effect_type",
"id": "onfire",
Expand Down
121 changes: 121 additions & 0 deletions data/json/enchantments.json
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,127 @@
"condition": "ALWAYS",
"values": [ { "value": "FOOTSTEP_NOISE", "multiply": 3 } ]
},
{
"type": "enchantment",
"id": "THERMAL_VISION_GOOD",
"condition": "ACTIVE",
"has": "WORN",
"special_vision": [
{
"condition": { "and": [ "u_see_npc_loc", "npc_is_warm" ] },
"distance": 60,
"descriptions": [
{
"id": "infrared_creature_tiny",
"text_condition": { "math": [ "n_val('size') == 1" ] },
"text": "You see a tiny figure radiating heat."
},
{
"id": "infrared_creature_small",
"text_condition": { "math": [ "n_val('size') == 2" ] },
"text": "You see a small figure radiating heat."
},
{
"id": "infrared_creature_medium",
"text_condition": { "math": [ "n_val('size') == 3" ] },
"text": "You see a medium figure radiating heat."
},
{
"id": "infrared_creature_large",
"text_condition": { "math": [ "n_val('size') == 4" ] },
"text": "You see a large figure radiating heat."
},
{
"id": "infrared_creature_huge",
"text_condition": { "math": [ "n_val('size') == 5" ] },
"text": "You see a huge figure radiating heat."
},
{
"id": "infrared_creature_medium",
"text_condition": { "math": [ "true" ] },
"text": "You see a figure radiating heat."
}
]
}
]
},
{
"type": "enchantment",
"id": "THERMAL_VISION_GOOD_PASSIVE",
"condition": "ALWAYS",
"special_vision": [
{
"condition": { "and": [ "u_see_npc_loc", "npc_is_warm" ] },
"distance": 60,
"descriptions": [
{
"id": "infrared_creature_tiny",
"text_condition": { "math": [ "n_val('size') == 1" ] },
"text": "You see a tiny figure radiating heat."
},
{
"id": "infrared_creature_small",
"text_condition": { "math": [ "n_val('size') == 2" ] },
"text": "You see a small figure radiating heat."
},
{
"id": "infrared_creature_medium",
"text_condition": { "math": [ "n_val('size') == 3" ] },
"text": "You see a medium figure radiating heat."
},
{
"id": "infrared_creature_large",
"text_condition": { "math": [ "n_val('size') == 4" ] },
"text": "You see a large figure radiating heat."
},
{
"id": "infrared_creature_huge",
"text_condition": { "math": [ "n_val('size') == 5" ] },
"text": "You see a huge figure radiating heat."
},
{
"id": "infrared_creature_medium",
"text_condition": { "math": [ "true" ] },
"text": "You see a figure radiating heat."
}
]
}
]
},
{
"type": "enchantment",
"id": "THERMAL_VISION_LEAFNOSE",
"condition": {
"not": {
"or": [
{ "u_has_effect": "smoke", "bodypart": "mouth" },
{ "u_has_effect": "asthma" },
{ "u_has_effect": "tpollen" },
{ "u_has_effect": "hay_fever" },
"u_is_underwater"
]
}
},
"special_vision": [
{
"condition": { "and": [ "u_see_npc_loc", "npc_is_warm" ] },
"distance": 10,
"descriptions": [
{
"id": "infrared_creature_medium",
"text_condition": { "math": [ "true" ] },
"text": "You sense a creature with your thermal nostrils."
}
]
}
]
},
{
"type": "enchantment",
"id": "nvg_great_mech",
"condition": "ALWAYS",
"values": [ { "value": "NIGHT_VIS", "add": 14 } ]
},
{
"type": "enchantment",
"id": "nvg_great",
Expand Down
4 changes: 0 additions & 4 deletions data/json/flags.json
Original file line number Diff line number Diff line change
Expand Up @@ -1550,10 +1550,6 @@
"type": "json_flag",
"info": "This is <info>naturally sized to the body</info>."
},
{
"id": "IR_EFFECT",
"type": "json_flag"
},
{
"id": "IS_ARMOR",
"type": "json_flag"
Expand Down
4 changes: 2 additions & 2 deletions data/json/items/armor/head_attachments.json
Original file line number Diff line number Diff line change
Expand Up @@ -362,7 +362,7 @@
"default_magazine": "medium_battery_cell"
}
],
"relic_data": { "passive_effects": [ { "id": "nvg_good" } ] },
"relic_data": { "passive_effects": [ { "id": "nvg_good" }, { "id": "THERMAL_VISION_GOOD" } ] },
"flags": [ "HELMET_FRONT_ATTACHMENT", "CANT_WEAR", "OUTER", "ELECTRONIC", "MUNDANE" ],
"armor": [
{ "covers": [ "eyes" ], "coverage": 10, "encumbrance": 0, "rigid_layer_only": true },
Expand All @@ -381,7 +381,7 @@
"name": { "str_sp": "enhanced night vision goggles (on)" },
"description": "New and rare high-resolution thermal NVG device, designed to be mounted on a compatible helmet. Lets you see in the dark, and detects heat signatures emitted by (un)living organisms. It is turned on, and continually draining batteries. Use it to turn it off.",
"//": "AN/PSQ-42",
"extend": { "flags": [ "NVG_GREEN", "IR_EFFECT" ] },
"extend": { "flags": [ "NVG_GREEN" ] },
"power_draw": "320 mW",
"revert_to": "enhanced_nvg",
"use_action": {
Expand Down
2 changes: 1 addition & 1 deletion data/json/items/armor/robofac_armor.json
Original file line number Diff line number Diff line change
Expand Up @@ -365,7 +365,7 @@
"looks_like": "tac_fullhelmet",
"description": "Heavy duty hooded headwear for the true frontier explorer. The visor has been lowered over the eyes, and is drawing moderate power to provide full infra-red scanning, allowing you to see warm blooded creatures in the dark. Activate to turn the visor off again.",
"copy-from": "robofac_head_rig",
"extend": { "flags": [ "IR_EFFECT" ] },
"relic_data": { "passive_effects": [ { "id": "THERMAL_VISION_GOOD" } ] },
"power_draw": "1 W",
"revert_to": "robofac_head_rig",
"use_action": [
Expand Down
3 changes: 2 additions & 1 deletion data/json/items/tool_armor.json
Original file line number Diff line number Diff line change
Expand Up @@ -2436,6 +2436,7 @@
"warmth": 10,
"environmental_protection": 3,
"material_thickness": 2,
"relic_data": { "passive_effects": [ { "id": "THERMAL_VISION_GOOD" } ] },
"pocket_data": [
{
"pocket_type": "MAGAZINE_WELL",
Expand All @@ -2453,7 +2454,7 @@
"name": { "str": "pair of infrared goggles (on)", "str_pl": "pairs of infrared goggles (on)" },
"description": "A pair of battery-powered goggles that grant infrared vision, allowing you to see warm-blooded creatures in the dark. Use it to turn them off.",
"material": [ "plastic", "steel" ],
"flags": [ "IR_EFFECT", "FRAGILE", "TRADER_AVOID", "OUTER", "ELECTRONIC" ],
"flags": [ "FRAGILE", "TRADER_AVOID", "OUTER", "ELECTRONIC" ],
"power_draw": "1 W",
"revert_to": "goggles_ir",
"use_action": { "ammo_scale": 0, "type": "transform", "menu_text": "Turn off", "msg": "Your %s deactivates.", "target": "goggles_ir" },
Expand Down
25 changes: 3 additions & 22 deletions data/json/mutations/mutations.json
Original file line number Diff line number Diff line change
Expand Up @@ -526,29 +526,10 @@
"points": 2,
"vitamin_cost": 160,
"prereqs": [ "SLIT_NOSTRILS", "BLOODFEEDER" ],
"flags": [ "INFRARED" ],
"category": [ "CHIROPTERAN" ],
"ugliness": 3,
"description": "Your nose is upturned, ridged and flared out into a leaf shape that humans will likely find unsightly. On the plus side, thermoreceptors in your nostrils allow you to smell heat as long as you can breathe.",
"triggers": [
[
{
"condition": {
"not": {
"or": [
{ "u_has_effect": "smoke", "bodypart": "mouth" },
{ "u_has_effect": "asthma" },
{ "u_has_effect": "tpollen" },
{ "u_has_effect": "asthma" },
{ "u_has_effect": "hay_fever" },
"u_is_underwater"
]
}
},
"msg_on": { "text": "", "rating": "good" }
}
]
]
"enchantments": [ "THERMAL_VISION_LEAFNOSE" ]
},
{
"type": "mutation",
Expand Down Expand Up @@ -2488,7 +2469,7 @@
"points": 5,
"vitamin_cost": 210,
"description": "Your eyes have mutated to pick up radiation in the infrared spectrum.",
"flags": [ "INFRARED" ],
"enchantments": [ "THERMAL_VISION_GOOD_PASSIVE" ],
"prereqs": [ "NIGHTVISION3" ],
"cancels": [ "LIZ_IR" ],
"category": [ "INSECT", "TROGLOBITE", "SPIDER" ],
Expand All @@ -2515,7 +2496,7 @@
"points": 5,
"vitamin_cost": 210,
"description": "Your optic nerves and brain have mutated to catch up with your eyes, allowing you to see in the infrared spectrum.",
"flags": [ "INFRARED" ],
"enchantments": [ "THERMAL_VISION_GOOD_PASSIVE" ],
"types": [ "VISION" ],
"prereqs": [ "LIZ_EYE" ],
"category": [ "LIZARD", "RAPTOR" ]
Expand Down
2 changes: 1 addition & 1 deletion data/mods/Magiclysm/mutations/fantasy_species.json
Original file line number Diff line number Diff line change
Expand Up @@ -196,7 +196,7 @@
"points": 5,
"starting_trait": false,
"purifiable": false,
"flags": [ "INFRARED" ],
"enchantments": [ "THERMAL_VISION_GOOD_PASSIVE" ],
"category": [ "SPECIES_DWARF", "SPECIES_GOBLIN" ],
"threshreq": [ "THRESH_SPECIES_DWARF", "THRESH_SPECIES_GOBLIN" ]
},
Expand Down
2 changes: 1 addition & 1 deletion data/mods/Xedra_Evolved/mutations/mutations.json
Original file line number Diff line number Diff line change
Expand Up @@ -419,7 +419,7 @@
"valid": false,
"name": { "str": "Crimson Vision" },
"description": "Your vision has improved and now you can see flowing blood in the vein, like bright trails in the dark.",
"flags": [ "INFRARED" ]
"enchantments": [ "THERMAL_VISION_GOOD_PASSIVE" ]
},
{
"type": "mutation",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -248,7 +248,7 @@
"prereqs": [ "SALAMANDER_EYES" ],
"changes_to": [ "SALAMANDER_HEAT_EYES2" ],
"category": [ "SALAMANDER" ],
"flags": [ "INFRARED" ]
"enchantments": [ "THERMAL_VISION_GOOD_PASSIVE" ]
},
{
"type": "mutation",
Expand All @@ -259,7 +259,7 @@
"prereqs": [ "SALAMANDER_EYES" ],
"category": [ "SALAMANDER" ],
"social_modifiers": { "persuade": 10, "lie": 10 },
"flags": [ "INFRARED" ]
"enchantments": [ "THERMAL_VISION_GOOD_PASSIVE" ]
},
{
"type": "mutation",
Expand Down
89 changes: 89 additions & 0 deletions doc/EFFECT_ON_CONDITION.md
Original file line number Diff line number Diff line change
Expand Up @@ -1092,6 +1092,23 @@ NPC is dead
```json
{ "not": "npc_is_alive" }
```

### `u_is_warm``npc_is_warm`
- type: simple string
- return true if alpha or beta talker is warm-blooded (does it have WARM flag)

#### Valid talkers:

| Avatar | Character | NPC | Monster | Furniture | Item |
| ------ | --------- | --------- | ---- | ------- | --- |
| ✔️ | ✔️ | ✔️ | ✔️ |||

#### Examples

```json
"npc_is_warm"
```

### `u_exists``npc_exists`
- type: simple string
- return true if alpha or beta talker is not null
Expand Down Expand Up @@ -1331,6 +1348,78 @@ You can see selected location.
}
```

### `u_see_npc``npc_see_you`
- type: simple string
- return true if alpha talker can see beta talker, or vice versa
- require both talkers to be presented

#### Valid talkers:

| Avatar | Character | NPC | Monster | Furniture | Item |
| ------ | --------- | --------- | ---- | ------- | --- |
| ✔️ | ✔️ | ✔️ | ✔️ |||

#### Examples

```json
"u_see_npc"
```

```json
{ "not": "npc_see_you" }
```

### `u_see_npc_loc``npc_see_you_loc`
- type: simple string
- return true if beta talker' position is visible from the alpha talker position, and vice versa
- doesn't check vision condition, can return true even if one or other is blind or it is a night
- require both talkers to be presented

#### Valid talkers:

| Avatar | Character | NPC | Monster | Furniture | Item |
| ------ | --------- | --------- | ---- | ------- | --- |
| ✔️ | ✔️ | ✔️ | ✔️ |||

#### Examples

```json
"u_see_npc_loc"
```

```json
{ "not": "npc_see_you_loc" }
```

### `line_of_sight`
- Checks if two points are visible to each other
- Works at night

| Syntax | Optionality | Value | Info |
| --- | --- | --- | --- |
| "line_of_sight" | **mandatory** | int, or [variable object](#variable-object) | Distance that would be checked |
| "loc_1" | **mandatory** | [variable object](#variable-object) | One of two points of the line |
| "loc_2" | **mandatory** | [variable object](#variable-object) | Second of two points of the line |
| "with_fields" | optional | bool | If false, ignores opaque fields. Default true |

#### Examples

```json
{
"type": "effect_on_condition",
"id": "EOC_line_check",
"effect": [
{ "set_string_var": { "mutator": "u_loc_relative", "target": "(0,0,0)" }, "target_var": { "context_val": "loc_1" } },
{ "set_string_var": { "mutator": "npc_loc_relative", "target": "(0,0,0)" }, "target_var": { "context_val": "loc_2" } },
{
"if": { "line_of_sight": 60, "loc_1": { "context_val": "loc_1" }, "loc_2": { "context_val": "loc_2" } },
"then": { "u_message": "Can see each other" },
"else": { "u_message": "Cannot see each other" }
}
]
}
```

### `has_ammo`
- type: simple string
- return true if beta talker is an item and has enough ammo for at least one "shot".
Expand Down
Loading

0 comments on commit 4dc15d0

Please sign in to comment.