Skip to content

Commit

Permalink
Merge pull request #6945 from Tirost/master
Browse files Browse the repository at this point in the history
[scripts][safe-room]Add support for custom healing plants
  • Loading branch information
MahtraDR authored Oct 30, 2024
2 parents 8eca738 + 8f205bc commit eede990
Show file tree
Hide file tree
Showing 3 changed files with 25 additions and 4 deletions.
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
15 changes: 11 additions & 4 deletions safe-room.lic
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,11 @@ class SafeRoom
@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 +213,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

0 comments on commit eede990

Please sign in to comment.