Fix camp placement and enforce camp access flow
This commit is contained in:
1 parent
b920fe9bf5
commit
3189092af2
9 files changed
+538
-15
No files matched your search
@@ -1997,19 +1997,23 @@ module LonaCraft
|
||||
nil
|
||||
end
|
||||
|
||||
# (x, y) is open ground: passable from all 4 sides, no water or bush.
|
||||
# Grass carries the bush flag but is still usable ground. Wilderness camp
|
||||
# tiles need one walkable approach; sewer geometry keeps its stricter rule.
|
||||
# A tile showing one of our faces is judged by the map file's own tiles.
|
||||
def self.ground_ok?(map, pieces, x, y)
|
||||
return false if map.water_floor?(x, y)
|
||||
return false if named_map?(map) && map.bush?(x, y)
|
||||
if face_at(pieces, map, x, y).nil?
|
||||
return false if map.water_floor?(x, y) || map.bush?(x, y)
|
||||
return [2, 4, 6, 8].all?{|d| map.passable?(x, y, d) }
|
||||
directions = [2, 4, 6, 8]
|
||||
return named_map?(map) ? directions.all?{|d| map.passable?(x, y, d) } :
|
||||
directions.any?{|d| map.passable?(x, y, d) }
|
||||
end
|
||||
orig = original_data(map)
|
||||
return false if orig.nil?
|
||||
flags = map.tileset.flags
|
||||
tiles = [orig[x, y, 2], orig[x, y, 1], orig[x, y, 0]]
|
||||
return false if tiles.any?{|t| flags[t] & 0x40 != 0 }
|
||||
[1, 2, 4, 8].all?{|bit|
|
||||
return false if tiles.any?{|t| flags[t] & 0x100 != 0 }
|
||||
check = lambda{|bit|
|
||||
res = false
|
||||
tiles.each{|t|
|
||||
f = flags[t]
|
||||
@@ -2019,6 +2023,8 @@ module LonaCraft
|
||||
}
|
||||
res
|
||||
}
|
||||
bits = [1, 2, 4, 8]
|
||||
named_map?(map) ? bits.all?{|bit| check.call(bit) } : bits.any?{|bit| check.call(bit) }
|
||||
end
|
||||
|
||||
# Where a door may stand (A4 walls): in the FACE row under a wall that runs
|
||||
@@ -3709,12 +3715,30 @@ class Game_Interpreter
|
||||
def call_msg(*args)
|
||||
msg = args[0]
|
||||
rec = nil
|
||||
if msg.is_a?(String) && msg =~ /\AOvermapEvents:World\/Region\d+\z/ && $game_map && $game_map.isOverMap
|
||||
rec = LonaCraft::Bases.record_at_player
|
||||
if rec
|
||||
original = $game_text[msg].to_s
|
||||
label = LonaCraft::Bases.name_of(rec).gsub(LonaCraft::Bases::NAME_DROP, '')
|
||||
title = original.sub(/\A(\\cg\[[^\]]+\])?[^\r\n]*/) do |line|
|
||||
graphic = line[/\A\\cg\[[^\]]+\]/].to_s
|
||||
graphic + label
|
||||
end
|
||||
new_args = args.dup
|
||||
new_args[0] = LonaCraft::RuntimeText.key('Bases', 'rt_camp_region', title)
|
||||
return call_msg_lonacraft_bases(*new_args)
|
||||
end
|
||||
end
|
||||
if msg.is_a?(String) && msg.include?("\\optB[") && $game_map && $game_map.isOverMap
|
||||
start = $game_text["OvermapEvents:World/Region_option_start"].to_s
|
||||
rec = LonaCraft::Bases.record_at_player if !start.empty? && msg.start_with?(start)
|
||||
end
|
||||
return call_msg_lonacraft_bases(*args) if rec.nil?
|
||||
got = LonaCraft::Homes.extend_menu(msg, LonaCraft::Bases.menu_labels(rec), nil) if defined?(LonaCraft::Homes)
|
||||
return call_msg_lonacraft_bases(*args) unless LonaCraft::Bases.manageable?(rec)
|
||||
labels = LonaCraft::Bases.menu_labels(rec)
|
||||
access_option = rec['lc_shared'] && LonaCraft::OnlineSync.ready?
|
||||
labels << 'Доступ к лагерю' if access_option
|
||||
got = LonaCraft::Homes.extend_menu(msg, labels, nil) if defined?(LonaCraft::Homes)
|
||||
return call_msg_lonacraft_bases(*args) if got.nil?
|
||||
new_args = args.dup
|
||||
new_args[0] = got[0]
|
||||
@@ -3725,6 +3749,9 @@ class Game_Interpreter
|
||||
elsif $game_temp.choice == got[1] + 1
|
||||
$game_temp.choice = -1
|
||||
LonaCraft::Bases.cycle_danger(rec) # R10
|
||||
elsif access_option && $game_temp.choice == got[1] + 2
|
||||
$game_temp.choice = -1
|
||||
lonacraft_base_access_menu(rec) if respond_to?(:lonacraft_base_access_menu)
|
||||
end
|
||||
result
|
||||
rescue => e
|
||||
|
||||
Reference in new issue
Block a user