Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- # Adding portion for modular room changes
- @Maaghara_proc_find = 'move dir'
- @Maaghara_room_title = 'Maaghara'
- @Mag_room_list = []
- @skip_changes = "You have made contact"
- #@skip_changes = "zzz"
- @Mag_changes = {
- "; loop " => "; if (bounty? =~ /^You have made contact with the child/);child = GameObj.npcs.find { |npc| npc.noun == 'child' }; else; child = nil; end; loop ",
- "move dir" => "move dir; 50.times { break if GameObj.npcs.any? { |npc| npc.id == child.id }; sleep 0.1 } if child",
- }
- def update_waytos(room_to_change_id, wayto_changes)
- Map[room_to_change_id].wayto.each { |wayto_destination_id, current_wayto|
- if current_wayto.class == Proc
- new_wayto = current_wayto._dump
- wayto_changes.each do |search_string, replace_string|
- new_wayto.gsub!(/#{search_string}/, replace_string)
- end
- Room[room_to_change_id].wayto[wayto_destination_id] = StringProc.new(%{#{new_wayto}})
- end
- }
- end
- Map.list.each {|room|
- @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}/)
- }
- @Mag_room_list.each {|room|
- update_waytos(room, @Mag_changes)
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement