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
@@ -643,6 +643,12 @@ module LonaCraft
|
||||
owner = owner_name(info['owner'])
|
||||
label = LonaCraft::Bases.clean_name(info['name'])
|
||||
label = camp_name(owner) if label.empty? && !owner.empty?
|
||||
access = Array(info['access']).select do |entry|
|
||||
entry.is_a?(Hash) && entry['profile'].is_a?(Integer) && entry['profile'] > 0 &&
|
||||
entry['name'].is_a?(String) && !owner_name(entry['name']).empty?
|
||||
end.first(12).map do |entry|
|
||||
{'profile'=>entry['profile'], 'name'=>owner_name(entry['name'])}
|
||||
end
|
||||
danger = info['danger'].is_a?(Integer) && info['danger'] >= -1 && info['danger'] <= 1 ? info['danger'] : 0
|
||||
bases = LonaCraft::Bases
|
||||
root = bases.root
|
||||
@@ -663,6 +669,7 @@ module LonaCraft
|
||||
# replace its structures; fill in its shared display metadata.
|
||||
if existing['key'].to_s == key && existing['map_no'].to_i == no
|
||||
existing['owner'] = owner unless owner.empty?
|
||||
existing['lc_access'] = access
|
||||
pending_meta = @pending_camp_meta[camp_ack_key(om, id)]
|
||||
unless pending_meta
|
||||
existing['name'] = label unless label.empty?
|
||||
@@ -683,7 +690,7 @@ module LonaCraft
|
||||
return false if registered.to_i != no
|
||||
rec = {'id'=>id, 'om'=>om, 'region'=>region, 'field'=>field,
|
||||
'key'=>key, 'map_no'=>no, 'pieces'=>{}, 'made'=>bases.date_now,
|
||||
'owner'=>owner, 'name'=>label, 'danger'=>danger, 'lc_shared'=>true}
|
||||
'owner'=>owner, 'name'=>label, 'danger'=>danger, 'lc_access'=>access, 'lc_shared'=>true}
|
||||
bases.list << rec
|
||||
root['next_id'] = [root['next_id'].to_i, id + 1].max
|
||||
refresh_marker(rec) if world
|
||||
|
||||
Reference in new issue
Block a user