From b1d864dd818a93685ae9222e743a6360a87d07ab Mon Sep 17 00:00:00 2001
From: DarkGod <darkgod@net-core.org>
Date: Fri, 5 Jun 2020 18:52:36 +0200
Subject: [PATCH] plopupdate

---
 game/engines/default/engine/Birther.lua       |  4 ++--
 .../modules/tome/data/quests/love-melinda.lua |  2 +-
 game/modules/tome/dialogs/Birther.lua         | 22 ++++++++++---------
 3 files changed, 15 insertions(+), 13 deletions(-)

diff --git a/game/engines/default/engine/Birther.lua b/game/engines/default/engine/Birther.lua
index f9a140286b..35a87b6ca0 100644
--- a/game/engines/default/engine/Birther.lua
+++ b/game/engines/default/engine/Birther.lua
@@ -356,7 +356,7 @@ end
 
 --- Tries to apply all birth options to the actor. Should only be called once, at the end of creation
 -- 
-function _M:apply()
+function _M:apply(self_contained)
 	self.actor.descriptor = {}
 	local stats, inc_stats = {}, {}
 	for i, d in ipairs(self.descriptors) do
@@ -421,7 +421,7 @@ function _M:apply()
 			self.actor.body = d.body
 			self.actor:initBody()
 		end
-		if self.applyingDescriptor then self:applyingDescriptor(i, d) end
+		if self.applyingDescriptor then self:applyingDescriptor(i, d, self_contained) end
 	end
 
 	-- Apply stats now to not be overridden by other things
diff --git a/game/modules/tome/data/quests/love-melinda.lua b/game/modules/tome/data/quests/love-melinda.lua
index b4630137af..5cfd694066 100644
--- a/game/modules/tome/data/quests/love-melinda.lua
+++ b/game/modules/tome/data/quests/love-melinda.lua
@@ -102,7 +102,7 @@ function melindaCompanion(self, who, c, sc)
 	birth:setDescriptor("class", c)
 	birth:setDescriptor("subclass", sc)
 	birth.actor = melinda
-	birth:apply()
+	birth:apply(true)
 	melinda.image = "player/cornac_female_redhair.png"
 	melinda.moddable_tile_base = "base_redhead_01.png"
 	melinda.moddable_tile_ornament = {female="braid_redhead_01"}
diff --git a/game/modules/tome/dialogs/Birther.lua b/game/modules/tome/dialogs/Birther.lua
index f3929194b9..efcd531e1d 100644
--- a/game/modules/tome/dialogs/Birther.lua
+++ b/game/modules/tome/dialogs/Birther.lua
@@ -252,7 +252,7 @@ function _M:checkNew(fct)
 	end
 end
 
-function _M:applyingDescriptor(i, d)
+function _M:applyingDescriptor(i, d, self_contained)
 	if d.unlockable_talents_types then
 		for t, v in pairs(d.unlockable_talents_types) do
 			if profile.mod.allow_build[v[3]] then
@@ -267,17 +267,19 @@ function _M:applyingDescriptor(i, d)
 			end
 		end
 	end
-	if d.party_copy then
-		local copy = table.clone(d.party_copy, true)
-		-- Append array part
-		while #copy > 0 do
-			local f = table.remove(copy)
-			table.insert(game.party, f)
+	if not self_contained then
+		if d.party_copy then
+			local copy = table.clone(d.party_copy, true)
+			-- Append array part
+			while #copy > 0 do
+				local f = table.remove(copy)
+				table.insert(game.party, f)
+			end
+			-- Copy normal data
+			table.merge(game.party, copy, true)
 		end
-		-- Copy normal data
-		table.merge(game.party, copy, true)
+		self:applyGameState(d)
 	end
-	self:applyGameState(d)
 end
 
 function _M:applyGameState(d)
-- 
GitLab