Skip to content

Commit 0fdd363

Browse files
committed
lineage option
1 parent dea3ea0 commit 0fdd363

File tree

5 files changed

+12
-8
lines changed

5 files changed

+12
-8
lines changed

MouseDrag/Hooks.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -106,10 +106,10 @@ static void RainWorldGameRawUpdateHook(On.RainWorldGame.orig_RawUpdate orig, Rai
106106
Tools.DeleteObjects(self.cameras[0]?.room, false);
107107

108108
if (Options.killOneKey?.Value != null && Input.GetKeyDown(Options.killOneKey.Value))
109-
Tools.KillCreature();
109+
Tools.KillCreature(self);
110110

111111
if (Options.killAllCreaturesKey?.Value != null && Input.GetKeyDown(Options.killAllCreaturesKey.Value))
112-
Tools.KillCreatures(self.cameras[0]?.room);
112+
Tools.KillCreatures(self, self.cameras[0]?.room);
113113

114114
if (Options.reviveOneKey?.Value != null && Input.GetKeyDown(Options.reviveOneKey.Value))
115115
Tools.ReviveCreature();

MouseDrag/MenuManager.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,7 @@ public static void Update(RainWorldGame game)
6262
switch (pressedIdx)
6363
{
6464
case 0: Tools.TogglePauseObject(menu.followChunk?.owner); break; //pauseOneKey
65-
case 1: Tools.KillCreature(menu.followChunk?.owner); break; //killOneKey
65+
case 1: Tools.KillCreature(game, menu.followChunk?.owner); break; //killOneKey
6666
case 2: Tools.ReviveCreature(menu.followChunk?.owner); break; //reviveOneKey
6767
case 3: Tools.TameCreature(game, menu.followChunk?.owner); break; //tameOneKey
6868
case 4: Tools.DuplicateObject(menu.followChunk?.owner); break; //duplicateOneKey
@@ -73,7 +73,7 @@ public static void Update(RainWorldGame game)
7373
{
7474
case 0: Tools.PauseObjects(game.cameras[0]?.room, true); break; //pauseRoomCreaturesKey
7575
case 1: Tools.UnpauseAll(); break; //unpauseAllKey
76-
case 2: Tools.KillCreatures(game.cameras[0]?.room); break; //killAllCreaturesKey
76+
case 2: Tools.KillCreatures(game, game.cameras[0]?.room); break; //killAllCreaturesKey
7777
case 3: Tools.ReviveCreatures(game.cameras[0]?.room); break; //reviveAllCreaturesKey
7878
case 4: Tools.DeleteObjects(game.cameras[0]?.room, true); break; //deleteAllCreaturesKey
7979
case 5: Tools.DeleteObjects(game.cameras[0]?.room, false); break; //deleteAllObjectsKey

MouseDrag/Options.cs

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ public class Options : OptionInterface
99
public static Configurable<string> activateType;
1010
public static Configurable<KeyCode> activateKey;
1111
public static Configurable<bool> menuRMB, menuFollows;
12-
public static Configurable<bool> forceMouseVisible, undoMouseVisible, releaseGraspsPaused;
12+
public static Configurable<bool> forceMouseVisible, undoMouseVisible, releaseGraspsPaused, lineageKill;
1313
public static Configurable<bool> updateLastPos, copyID, exitGameOverMode, exceptSlugNPC, tameIncreasesRep;
1414
public static Configurable<KeyCode> menuOpen, pauseOneKey, pauseRoomCreaturesKey, unpauseAllKey;
1515
public static Configurable<KeyCode> deleteOneKey, deleteAllCreaturesKey, deleteAllObjectsKey;
@@ -38,6 +38,7 @@ public Options()
3838
forceMouseVisible = config.Bind("forceMouseVisible", defaultValue: true, new ConfigurableInfo("Makes Windows mouse pointer always be visible in-game when tools are active.", null, "", "Force mouse visible"));
3939
undoMouseVisible = config.Bind("undoMouseVisible", defaultValue: false, new ConfigurableInfo("Hides Windows mouse pointer in-game when tools become inactive.", null, "", "Hide mouse after"));
4040
releaseGraspsPaused = config.Bind("releaseGraspsPaused", defaultValue: true, new ConfigurableInfo("When creature is paused, all grasps (creatures/items) are released.", null, "", "Pausing releases grasps"));
41+
lineageKill = config.Bind("lineageKill", defaultValue: false, new ConfigurableInfo("When killing creatures using tools, set killTag to first player so creatures can lineage.\nDeleting creatures without killing them does not affect lineage.", null, "", "Lineage when killed"));
4142

4243
updateLastPos = config.Bind("updateLastPos", defaultValue: true, new ConfigurableInfo("Reduces visual bugs when object is paused, but slightly affects drag behavior.", null, "", "Update BodyChunk.lastPos"));
4344
copyID = config.Bind("copyID", defaultValue: true, new ConfigurableInfo("Creates an exact copy of the previous object when duplicating.", null, "", "Copy ID duplicate"));
@@ -91,6 +92,7 @@ public override void Initialize()
9192
AddCheckbox(forceMouseVisible, new Vector2(x, y -= 40f));
9293
AddCheckbox(undoMouseVisible, new Vector2(x, y -= 40f));
9394
AddCheckbox(releaseGraspsPaused, new Vector2(x, y -= 40f));
95+
AddCheckbox(lineageKill, new Vector2(x, y -= 40f));
9496

9597
x += 250;
9698
y = startHeight;

MouseDrag/Tools.Health.cs

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,12 +2,14 @@
22
{
33
static partial class Tools
44
{
5-
public static void KillCreature(PhysicalObject obj = null)
5+
public static void KillCreature(RainWorldGame game, PhysicalObject obj = null)
66
{
77
if (obj == null)
88
obj = dragChunk?.owner;
99
if (!(obj is Creature))
1010
return;
11+
if (Options.lineageKill?.Value == true && game?.Players?.Count > 0)
12+
(obj as Creature).SetKillTag(game.Players[0]);
1113

1214
(obj as Creature).Die();
1315
if ((obj as Creature).abstractCreature?.state is HealthState)
@@ -16,14 +18,14 @@ public static void KillCreature(PhysicalObject obj = null)
1618

1719

1820
//kill all creatures in room
19-
public static void KillCreatures(Room room)
21+
public static void KillCreatures(RainWorldGame game, Room room)
2022
{
2123
Plugin.Logger.LogDebug("KillCreatures");
2224
for (int i = 0; i < room?.physicalObjects?.Length; i++)
2325
for (int j = 0; j < room.physicalObjects[i].Count; j++)
2426
if (!(room.physicalObjects[i][j] is Player && //don't kill when: creature is player and player is not SlugNPC (optional)
2527
(Options.exceptSlugNPC?.Value != false || !(room.physicalObjects[i][j] as Player).isNPC)))
26-
KillCreature(room.physicalObjects[i][j]);
28+
KillCreature(game, room.physicalObjects[i][j]);
2729
}
2830

2931

Binary file not shown.

0 commit comments

Comments
 (0)