Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[scripts][safe-room]Add support for custom healing plants #6945

Merged
merged 8 commits into from
Oct 30, 2024
Merged
Show file tree
Hide file tree
Changes from 7 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions profiles/base-empty.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -130,3 +130,5 @@ empty_values:
zombie: {}
script_watch_ignored_scripts: []
custom_clerk_tools: {}
healing_plant_adjectives: []
healing_plant_nouns: []
12 changes: 12 additions & 0 deletions profiles/base.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -638,6 +638,18 @@ performance_while_healing: false
# use tome.lic while waiting for healing / being healed
# assumes you have tome setup properly
tome_while_healing: false
# Adjectives and nouns for safe-room healing plants
healing_plant_adjectives:
- vela'tohr
- swaying

healing_plant_nouns:
- briar
- bush
- plant
- shrub
- thicket
- thornbush

# override the repair location to use instead of hometown
force_repair_town:
Expand Down
17 changes: 13 additions & 4 deletions safe-room.lic
Original file line number Diff line number Diff line change
Expand Up @@ -15,15 +15,20 @@ class SafeRoom

args = parse_args(arg_definitions)
settings = get_settings
@plant_adjectives = settings['healing_plant_adjective_regex']
@plant_nouns = settings['healing_plant_noun_regex']
Tirost marked this conversation as resolved.
Show resolved Hide resolved
@health_threshold = settings.saferoom_health_threshold
@withdraw_amount = settings.safe_room_withdraw_amount
@keep_bank_amount = settings.safe_room_keep_bank_amount
@performance_while_healing = settings.performance_while_healing
@stop_performance_after_heal = false
@tome_while_healing = settings.tome_while_healing
@stop_tome_after_heal = false

@plant_regex = /vela'tohr (briar|bush|plant|shrub|thicket|thornbush)/
@plant_adjectives = settings.healing_plant_adjectives
@plant_nouns = settings.healing_plant_nouns
@adjectives_regex = Regexp.union(settings.healing_plant_adjectives)
@noun_regex = Regexp.union(settings.healing_plant_nouns)
@plant_regex = Regexp.new("#{@adjectives_regex} #{@noun_regex}")

return unless args.force || need_healing?

Expand Down Expand Up @@ -210,8 +215,12 @@ class SafeRoom

DRC.release_invisibility

if /.*vela.tohr (\w+)/ =~ DRRoom.room_objs.grep(@plant_regex).to_s
fput("touch #{Regexp.last_match(1)}")
# Match room objects against the full regex to find and capture the noun
if /#{@adjectives_regex} (\w+)/ =~ DRRoom.room_objs.grep(@plant_regex).to_s
plant_type = Regexp.last_match(1)

# Send touch command for the captured noun
fput("touch #{plant_type}") if @plant_nouns.include?(plant_type)
end

# check for safe-room idle thing to do
Expand Down
Loading