5858function GetMarriageSummary (source )
5959 local familystate = " "
6060
61- if source .relations . spouse_id ~= - 1 then
62- if dfhack .units .isSane (df .unit .find (source .relations . spouse_id )) then
63- familystate = dfhack .TranslateName (source .name ).. " has a spouse (" .. dfhack .TranslateName (df .unit .find (source .relations . spouse_id ).name ).. " )"
61+ if source .spouse_id ~= - 1 then
62+ if dfhack .units .isSane (df .unit .find (source .spouse_id )) then
63+ familystate = dfhack .TranslateName (source .name ).. " has a spouse (" .. dfhack .TranslateName (df .unit .find (source .spouse_id ).name ).. " )"
6464 end
65- if dfhack .units .isSane (df .unit .find (source .relations . spouse_id )) == false then
65+ if dfhack .units .isSane (df .unit .find (source .spouse_id )) == false then
6666 familystate = dfhack .TranslateName (source .name ).. " 's spouse is dead or not sane, would you like to choose a new one?"
6767 end
6868 end
6969
70- if source .relations . spouse_id == - 1 and source . relations .lover_id ~= - 1 then
71- if dfhack .units .isSane (df .unit .find (source .relations . lover_id )) then
72- familystate = dfhack .TranslateName (source .name ).. " already has a lover (" .. dfhack .TranslateName (df .unit .find (source .relations . spouse_id ).name ).. " )"
70+ if source .spouse_id == - 1 and source .lover_id ~= - 1 then
71+ if dfhack .units .isSane (df .unit .find (source .lover_id )) then
72+ familystate = dfhack .TranslateName (source .name ).. " already has a lover (" .. dfhack .TranslateName (df .unit .find (source .spouse_id ).name ).. " )"
7373 end
74- if dfhack .units .isSane (df .unit .find (source .relations . lover_id )) == false then
74+ if dfhack .units .isSane (df .unit .find (source .lover_id )) == false then
7575 familystate = dfhack .TranslateName (source .name ).. " 's lover is dead or not sane, would you like that love forgotten?"
7676 end
7777 end
7878
79- if source .relations . spouse_id == - 1 and source . relations .lover_id == - 1 then
79+ if source .spouse_id == - 1 and source .lover_id == - 1 then
8080 familystate = dfhack .TranslateName (source .name ).. " is not involved in romantic relationships with anyone"
8181 end
8282
83- if source .relations . pregnancy_timer > 0 then
83+ if source .pregnancy_timer > 0 then
8484 familystate = familystate .. " \n She is pregnant."
85- local father = df .historical_figure .find (source .relations . pregnancy_spouse )
85+ local father = df .historical_figure .find (source .pregnancy_spouse )
8686 if father then
8787 familystate = familystate .. " The father is " .. dfhack .TranslateName (father .name ).. " ."
8888 end
@@ -92,7 +92,7 @@ function GetMarriageSummary (source)
9292end
9393
9494function GetSpouseData (source )
95- local spouse = df .unit .find (source .relations . spouse_id )
95+ local spouse = df .unit .find (source .spouse_id )
9696 local spouse_hf
9797 if spouse then
9898 spouse_hf = df .historical_figure .find (spouse .hist_figure_id )
@@ -101,7 +101,7 @@ function GetSpouseData (source)
101101end
102102
103103function GetLoverData (source )
104- local lover = df .unit .find (source .relations . spouse_id )
104+ local lover = df .unit .find (source .spouse_id )
105105 local lover_hf
106106 if lover then
107107 lover_hf = df .historical_figure .find (lover .hist_figure_id )
@@ -124,19 +124,19 @@ function Divorce (source)
124124 local spouse ,spouse_hf = GetSpouseData (source )
125125 local lover ,lover_hf = GetLoverData (source )
126126
127- source .relations . spouse_id = - 1
128- source .relations . lover_id = - 1
127+ source .spouse_id = - 1
128+ source .lover_id = - 1
129129
130130 if source_hf then
131131 EraseHFLinksLoverSpouse (source_hf )
132132 end
133133 if spouse then
134- spouse .relations . spouse_id = - 1
135- spouse .relations . lover_id = - 1
134+ spouse .spouse_id = - 1
135+ spouse .lover_id = - 1
136136 end
137137 if lover then
138- spouse .relations . spouse_id = - 1
139- spouse .relations . lover_id = - 1
138+ spouse .spouse_id = - 1
139+ spouse .lover_id = - 1
140140 end
141141 if spouse_hf then
142142 EraseHFLinksLoverSpouse (spouse_hf )
156156function Marriage (source ,target )
157157 local source_hf = df .historical_figure .find (source .hist_figure_id )
158158 local target_hf = df .historical_figure .find (target .hist_figure_id )
159- source .relations . spouse_id = target .id
160- target .relations . spouse_id = source .id
159+ source .spouse_id = target .id
160+ target .spouse_id = source .id
161161
162162 local new_link = df .histfig_hf_link_spousest :new () -- adding hf link to source
163163 new_link .target_hf = target_hf .id
@@ -178,7 +178,7 @@ function ChooseNewSpouse (source)
178178 if not dfhack .units .isAdult (source ) then
179179 ErrorPopup (" target is too young" ) return
180180 end
181- if not (source .relations . spouse_id == - 1 and source . relations .lover_id == - 1 ) then
181+ if not (source .spouse_id == - 1 and source .lover_id == - 1 ) then
182182 ErrorPopup (" target already has a spouse or a lover" )
183183 qerror (" source already has a spouse or a lover" )
184184 return
@@ -191,8 +191,8 @@ function ChooseNewSpouse (source)
191191 if dfhack .units .isCitizen (v )
192192 and v .race == source .race
193193 and v .sex ~= source .sex
194- and v .relations . spouse_id == - 1
195- and v .relations . lover_id == - 1
194+ and v .spouse_id == - 1
195+ and v .lover_id == - 1
196196 and dfhack .units .isAdult (v )
197197 then
198198 table.insert (choicelist ,dfhack .TranslateName (v .name ).. ' , ' .. dfhack .units .getProfessionName (v ))
@@ -224,7 +224,7 @@ function MainDialog (source)
224224 local on_select = {}
225225
226226 local adult = dfhack .units .isAdult (source )
227- local single = source .relations . spouse_id == - 1 and source . relations .lover_id == - 1
227+ local single = source .spouse_id == - 1 and source .lover_id == - 1
228228 local ready_for_marriage = single and adult
229229
230230 if adult then
0 commit comments