Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
R
rjw
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package Registry
Container Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Hazzardous
rjw
Commits
c0caf057
Commit
c0caf057
authored
2 years ago
by
Ed86
Browse files
Options
Downloads
Patches
Plain Diff
added fix for pregnancy last name generation with non humans
parent
0e387748
No related branches found
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
1.4/Source/Harmony/patch_pregnancy.cs
+65
-43
65 additions, 43 deletions
1.4/Source/Harmony/patch_pregnancy.cs
with
65 additions
and
43 deletions
1.4/Source/Harmony/patch_pregnancy.cs
+
65
−
43
View file @
c0caf057
...
...
@@ -355,6 +355,30 @@ namespace rjw
}
[
HarmonyPatch
(
typeof
(
PregnancyUtility
),
"RandomLastName"
)]
static
class
Patch_PregnancyUtility_RandomLastName
{
public
static
bool
Prefix
(
ref
Pawn
geneticMother
,
ref
Pawn
birthingMother
,
ref
Pawn
father
)
{
if
(
geneticMother
!=
null
)
if
(
geneticMother
.
Name
==
null
||
!
xxx
.
is_human
(
geneticMother
))
{
geneticMother
=
null
;
}
if
(
father
!=
null
)
if
(
father
.
Name
==
null
||
!
xxx
.
is_human
(
father
))
{
father
=
null
;
}
if
(
birthingMother
!=
null
)
if
(
birthingMother
.
Name
==
null
||
!
xxx
.
is_human
(
birthingMother
))
{
birthingMother
=
null
;
}
return
true
;
}
}
// Fixes CompEggLayer and mating for humanlikes.
// Note that this involves skipping over a check for the Biotech DLC, but as of build 1.4.3534 this doesn't unlock
// any Biotech-only features or anything like that.
...
...
@@ -464,49 +488,47 @@ namespace rjw
}
}
[
HarmonyPatch
(
typeof
(
PawnColumnWorker_Pregnant
),
"GetIconFor"
)]
public
class
PawnColumnWorker_Patch_Icon
{
public
static
void
Postfix
(
Pawn
pawn
,
ref
Texture2D
__result
)
{
if
(
pawn
.
IsVisiblyPregnant
())
__result
=
ContentFinder
<
Texture2D
>.
Get
(
"UI/Icons/Animal/Pregnant"
,
true
);
}
}
[
HarmonyPatch
(
typeof
(
PawnColumnWorker_Pregnant
),
"GetTooltipText"
)]
public
class
PawnColumnWorker_Patch_Tooltip
{
public
static
bool
Prefix
(
Pawn
pawn
,
ref
string
__result
)
{
float
gestationProgress
=
PregnancyHelper
.
GetPregnancy
(
pawn
).
Severity
;
// no multipregnancy support
int
num
=
(
int
)(
pawn
.
RaceProps
.
gestationPeriodDays
*
GenDate
.
TicksPerDay
);
int
numTicks
=
(
int
)(
gestationProgress
*
(
float
)
num
);
__result
=
"PregnantIconDesc"
.
Translate
(
numTicks
.
ToStringTicksToDays
(
"F0"
),
num
.
ToStringTicksToDays
(
"F0"
));
return
false
;
}
}
[
HarmonyPatch
(
typeof
(
TransferableUIUtility
),
"DoExtraIcons"
)]
public
class
TransferableUIUtility_Patch_Icon
{
//private static readonly Texture2D PregnantIcon = ContentFinder<Texture2D>.Get("UI/Icons/Animal/Pregnant", true);
public
static
void
Postfix
(
Transferable
trad
,
Rect
rect
,
ref
float
curX
,
Texture2D
___PregnantIcon
)
{
Pawn
pawn
=
trad
.
AnyThing
as
Pawn
;
if
(
pawn
?.
health
?.
hediffSet
!=
null
&&
pawn
.
IsVisiblyPregnant
())
{
Rect
rect3
=
new
Rect
(
curX
-
24f
,
(
rect
.
height
-
24f
)
/
2f
,
24f
,
24f
);
curX
-=
24f
;
if
(
Mouse
.
IsOver
(
rect3
))
{
TooltipHandler
.
TipRegion
(
rect3
,
PawnColumnWorker_Pregnant
.
GetTooltipText
(
pawn
));
}
GUI
.
DrawTexture
(
rect3
,
___PregnantIcon
);
}
}
}
[
HarmonyPatch
(
typeof
(
PawnColumnWorker_Pregnant
),
"GetIconFor"
)]
public
class
PawnColumnWorker_Patch_Icon
{
public
static
void
Postfix
(
Pawn
pawn
,
ref
Texture2D
__result
)
{
if
(
pawn
.
IsVisiblyPregnant
())
__result
=
ContentFinder
<
Texture2D
>.
Get
(
"UI/Icons/Animal/Pregnant"
,
true
);
}
}
[
HarmonyPatch
(
typeof
(
PawnColumnWorker_Pregnant
),
"GetTooltipText"
)]
public
class
PawnColumnWorker_Patch_Tooltip
{
public
static
bool
Prefix
(
Pawn
pawn
,
ref
string
__result
)
{
float
gestationProgress
=
PregnancyHelper
.
GetPregnancy
(
pawn
).
Severity
;
// no multipregnancy support
int
num
=
(
int
)(
pawn
.
RaceProps
.
gestationPeriodDays
*
GenDate
.
TicksPerDay
);
int
numTicks
=
(
int
)(
gestationProgress
*
(
float
)
num
);
__result
=
"PregnantIconDesc"
.
Translate
(
numTicks
.
ToStringTicksToDays
(
"F0"
),
num
.
ToStringTicksToDays
(
"F0"
));
return
false
;
}
}
[
HarmonyPatch
(
typeof
(
TransferableUIUtility
),
"DoExtraIcons"
)]
public
class
TransferableUIUtility_Patch_Icon
{
//private static readonly Texture2D PregnantIcon = ContentFinder<Texture2D>.Get("UI/Icons/Animal/Pregnant", true);
public
static
void
Postfix
(
Transferable
trad
,
Rect
rect
,
ref
float
curX
,
Texture2D
___PregnantIcon
)
{
Pawn
pawn
=
trad
.
AnyThing
as
Pawn
;
if
(
pawn
?.
health
?.
hediffSet
!=
null
&&
pawn
.
IsVisiblyPregnant
())
{
Rect
rect3
=
new
Rect
(
curX
-
24f
,
(
rect
.
height
-
24f
)
/
2f
,
24f
,
24f
);
curX
-=
24f
;
if
(
Mouse
.
IsOver
(
rect3
))
{
TooltipHandler
.
TipRegion
(
rect3
,
PawnColumnWorker_Pregnant
.
GetTooltipText
(
pawn
));
}
GUI
.
DrawTexture
(
rect3
,
___PregnantIcon
);
}
}
}
//[HarmonyPatch(typeof(AutoSlaughterManager))]
//public class AutoSlaughterManager_AnimalsToSlaughter_rjw_preg
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment