Advertisement
Guest User

Untitled

a guest
Apr 20th, 2018
68
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Ruby 1.20 KB | None | 0 0
  1. # Adding portion for modular room changes
  2. @Maaghara_proc_find = 'move dir'
  3. @Maaghara_room_title = 'Maaghara'
  4. @Mag_room_list = []
  5. @skip_changes = "You have made contact"
  6. #@skip_changes = "zzz"
  7. @Mag_changes = {
  8.   "; loop " => "; if (bounty? =~ /^You have made contact with the child/);child = GameObj.npcs.find { |npc| npc.noun == 'child' }; else; child = nil; end; loop ",
  9.   "move dir" => "move dir; 50.times { break if GameObj.npcs.any? { |npc| npc.id == child.id }; sleep 0.1 } if child",
  10. }
  11.  
  12. def update_waytos(room_to_change_id, wayto_changes)
  13.   Map[room_to_change_id].wayto.each { |wayto_destination_id, current_wayto|
  14.     if current_wayto.class == Proc
  15.       new_wayto = current_wayto._dump
  16.       wayto_changes.each do |search_string, replace_string|
  17.         new_wayto.gsub!(/#{search_string}/, replace_string)
  18.       end
  19.       Room[room_to_change_id].wayto[wayto_destination_id] = StringProc.new(%{#{new_wayto}})
  20.     end
  21.   }
  22. end
  23.  
  24. Map.list.each {|room|
  25.   @Mag_room_list << room.id if (room.wayto.inspect =~ /#{@Maaghara_proc_find}/ and room.title.inspect =~ /#{@Maaghara_room_title}/ and room.wayto.inspect !~ /#{@skip_changes}/)
  26. }
  27.  
  28. @Mag_room_list.each {|room|
  29.   update_waytos(room, @Mag_changes)
  30. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement