code:
Extended family mode (mod)

In short, extended family mode replaces the old .relation + .relationTarget system with a completely new system capable of handling a limitless number of relatives. Or at least until your game crashes from trying to handle it all. Fully incompatable with the old system and fully functional with ng+.

The backbone of the system: .father and .mother

Everything about a slave's family can be gathered by looking into her mother and father. Beyond the obvious mother-daughter relation, you can check two seperate slaves' parents to see if they are related to each other, allowing for sisters, half-sisters, and with a .birthWeek check, twins with little effort.
The following values are used with .mother and .father:
Valid slave IDs (in other words, a value > 0) - Serves as both a target for checks and as a check itself to see if effort should be expended to search for the parent.
0 - Slave has no known parent. A slave with a parent value of 0 is capable of having a parent added via reRelativeRecruiter
MissingParentIDs (in other words, a value < -2) - Serves as a placeholder to preserve sibling relations in the case of a parent being sold or lost. Outside of extreme cases, this value will never be restored to its' previous value. $missingParentID starts at -10000 and decrements after application. On NG+, positive values are incremented the same as a normal slave and checked for validity. Should it be invalid, it will be replaced with $missingParentID. Negative values, on the other hand, are decremented by 1200000. Values of -1 and -2 are ignored by the JS, so don't use them. Also -9999 through -9994 are used by hero slaves to preserve their sibling status no matter when they are purchased or obtained during the same game.

The limiters: .sisters and .daughters
Extended family mode is VERY for loop intensive, and as such, has limiters to prevent it from needlessly looping. A value greater than 0 for either of these slave variables signals that slave has a sibling/daughter for various checks. Furthermore, the value of .sisters and .daughters accurately tracks the number of sisters and daughters, particularly for checks that require all of them to be found. You'll learn to hate these, but on the plus side, they can safely be recalculated with no side effects. Nearly entirely handled by <<AddSlave>> and removeActiveSlave, you do not understand how huge of a plus this is.

The recruiting check: .canRecruit

Checked by reRelativeRecruiter to see if a slave is eligible to have relatives added. Hero slaves, special slaves, and often event slaves are ineligible for recruiting. Gets disabled if the slave is called into the recruiting event but fails to qualify for additional relatives due to unaddable slots or too many existing relatives.

A quick list of the JS that gets things done and various useful JS calls:

sameDad(slave1, slave2) - checks if the slaves share the same father and returns true/false.
sameMom(slave1, slave2) - checks if the slaves share the same mother and returns true/false.
sameTParent(slave1, slave2) - an exception catcher that handles such things as "slave1 knocked up slave2 and got impregnated by slave2, their children will be sisters" and returns the sister variable (0 - not related, 1 - twins, 2 - sisters, 3 - half-sisters). (subJS, never call on its own)
areTwins(slave1, slave2) - checks if the slaves are twins and returns true/false.
areSisters(slave1, slave2) - combines all of the above and returns the sister variable (0 - not related, 1 - twins, 2 - sisters, 3 - half-sisters). A widely used check to identify sister relatives. Generally gated by a .sisters check. Recommended to use in a <<switch>> macro instead of calling it for each outcome.

totalRelatives(slave) - returns how many relatives a slave has as an integer. Useful both as a check and for its value. Recommended to use as a check in instances where you want a relative, but don't care what it is.

mutualChildren(slave1, slave2, slaves) - checks the slave array for children shared by the two slave arguements and returns the number of mutual children as an integer. Currently used solely to encourage two slaves into a relationship if they have kids together.

The utility JS, courtesy of FCGudder. This JS should only be called if you know it will find something, use your limiters! These will always return the only relative if only one outcome is possible, so technically they can be used creatively. randomAvailable JS should be followed with random JS as a fallback for circumstances where you must find something, but would prefer it to be sensible if possible.
randomRelatedSlave(slave, filterFunction) - returns a random related slave to the slave passed into it. filterFunction is called in the following JS but not needed if you just want a random relative.
randomRelatedAvailableSlave(slave) - returns a random available related slave.
randomSister(slave) - returns a random sister.
randomTwinSister(slave) - returns a random twin.
randomAvailableSister(slave) - returns a random available sister.
randomAvailableTwinSister(slave) - returns a random available twin.
randomDaughter(slave) - returns a random daughter.
randomAvailableDaughter(slave) - returns a random available daughter.
randomParent(slave) - returns a random parent.
randomAvailableParent(slave) - returns a random available parent.

path: devNotes/Extended Family Mode Explained.txt


code:
Security Expansion

	10/18/17

	1

	3

	10/22/17

	5

	10/24/17

	6
	-balance adjustments
	-fixed improper name assignment
	-added renaming of units
	-reworked casualties logic
	-added statistics to arcology management screen
	-various other fixes

	10/28/17

	7
	-SFanon additions
	-fixes
	-balance

	10/29/17

	7.1
	-fixes
	-couple of balance adjustments.

	11/01/17

	7.5

	7.6
	-fixed reported issue
	-balance adjustments (run backward compatibility to apply them)

	7.7

	11/03/17

	8
	-various fixes
	-balance
	-rebellions

	11/05/17

	8.5
	-fixes
	-rebellions

	11/06/17

	Pregmod v113

	8.6
	-fixes

	8.7
	-fixed reported issue maybe pretty please?

	11/07/17

	Pregmod v114/Pregmod v114.1

	8.8
	-fixes

	9.2
	-small fixes
	-new edicts
	-new units upgrade
	-new barracks upgrade

	Pregmod v115

	9.6
	-fixes
	-loyalty work

	11/09/17

	Pregmod v119

	9.6
	-small fixes

	11/10/17

	10
	-fixes
	-weapons manufacturing
	-balance

	11/11/17

	Pregmod v121

	10.2
	-fixes

	Pregmod v122

	11
	-fixes
	-proclamations
	-balance

	11.1

	11.2
	-fixes
	-extra options

	11/12/17

	Pregmod v124

	11.5
	-fixes
	-balance

	11.6
	-fixed reported issues
	-balance

	Pregmod v125

	12
	-fixes
	-transport hub and trade
	-balance

	11/13/17

	12.3
	-fixes
	-SFanon additions
	-balance

	Pregmod v126

	12.4

	11/14/17

	Pregmod v130

	12.5
	-fixes
	-SFanon stuff
	-balance

	Pregmod v132

	12.6
	-fixes
	-anon's stuff

	12.8
	-fixes
	-balance

	12.9
	-fixes

	11/15/17

	13
	-fixes
	-balance

	11/16/17

	13.1
	-fixes
	-balance

	13.3
	-fixes

	13.4
	-fixed >>142293 (Attack value NaN during major battle)

	11/17/17

	Pregmod v135

	13.4
	-fixes
	-balance
	-difficulty settings

	Pregmod v136
	13.6
	-fixes

	11/18/17

	13.7
	-balance
	-(maybe) fix for battle terrain not showing up.

	13.8
	-(maybe) fixed >>142732

	Pregmod v137

	v13.9
	-fixes (couple of)

	Pregmod v139

	14
	-fixes
	-spell checked attack report. My god was is bad.

	14.1
	-fixes

	11/20/17

	14.2
	-fixes
	-balance
	-very satisfying version number.

repo_name: shoku/fc


code:
QuickList is built from the interaction of six parts.

1] The Quick List option enable/disable control.
2] The list context, basically if there are more than one, and the
    context is correct, the togle, the table will be available.
3] The Slave Summary Passage contains the Quick List toggle button,
    clicking it either shows or hides the quick list table.
4] The Slave Summary Passage contains the actual quick list table, which
    if shown has a button for each slave name in the list, in columns up
    to 5 wide.
5] The Slave Summary Passage contains invivisible <a> links or any other
    html element nearby or tied to each slave's name.  These are
    generated with an html attribute id set to "slave-##" where ## is the
    slave's ID.
6] The JS code to tie a scroll animation from the visible name buttons
    in the quick list table down to the invisible links/elements.

The slave summary passage is called in many strange contexts, and for
this reason, there is some serious complexity in getting consistent
results.  As it stands now, the passage sometimes calls itsefl
recursively (for facilities), but it doesn't do that for the Main
penthouse page.

The list context is duplicated, so that we can quickly loop over the
list context to get the slave names in the list, all without disturbing
the principal list context for the slave data.

If the list context has more than one slave, and is either the first
call for the Main/penthous list, or the recursive call for any other
facility, And we haven't *already* built a quick list table, then we
procede to build the quick list table.

We use special attributes on the built button to name the invisible
link to which we'll navigate, the speed that we'll animate our
navigation and an offset.