[1.0](WIP) What The Hack?! - Mechanoid hacking

Started by Roolo, May 31, 2018, 04:03:57 PM

Previous topic - Next topic

rawrfisher

#225
Quote from: Madman666 on August 17, 2018, 02:24:18 PM
Yeep, i just really don't like everything being uber-needy. Its enough of a pain that colonists are whining about each and every small thing for every other game entity to also require constant flow of something. I was content when turrets were power hungry and needed periodic component replacement via breakdown event, but constant steel eating is tad much. Hell, I probably made myself quite famous whining everywhere on this forum about maintance mechanics being annoying. It really does depend on playstyle a lot, on this i couldn't agree more. Since a big portion of players doesn't mind or even likes that mechanic, as it requires more resource micromanagement, forces you to venture out more (deep drilling being nerfed into oblivion) etc. Sadly i just don't belong to that big portion.
Theres a mod on steam that address's the snowflake mentality to a degree.  Also Quarry is updated and working on current version so you can use that for mining instead of derping around with caravans and what not.  Camps are a thing too but it seems that the animals in trade caravans from other factions also count tword your colony wealth

https://steamcommunity.com/profiles/76561198042020973/screenshots/#scrollTop=0
Assuming this is the right link it should show the wealth graph on the colony I started when alien framework broke
Professional jerk
Want something broken let me know

Madman666

Yeah, i know, i check mods on my b18 modlist quite often to see when they ll be up for b19 and quarry along with set up camp is among them. Its truly a wonderful thing, that mods can more or less tailor the game to be whatever you want it to be.

rawrfisher

#227
Finally pinned down the cause of the wealth inflation bug. 
Was a poorly executed terreforming mod

Haplo pushed a new update for misc robots and now the robots use the mech stands and can have their missing parts regenerated

Would you consider a cap on the number of colony mechs?  While I personally think it's a downright stupid idea It seems Tyran has it so any creatures add to the colony wealth regardless of faction/condition as long as they are not hostle or wild animals

In reguards to how the mechs are healed what would work better in your opinion,  All damaged parts being repaired at the same time then missing parts being replaced or having everything repaired 1 part at a time?
Professional jerk
Want something broken let me know

Roolo

#228
Inspired by my Giddy-up mod, I experimented a bit with trying to mount turrets on mechs as an idea for a new type of mech upgrade. After a short while, I had something rough working, which got me excited. However, getting it working properly proved to be a lot of work. But after having seen the potential in the rough concept version, I just couldn't give up, so I pushed trough and probably spent a bit too much time on it. But it works now, with the update I just released, this is possible:


Mini turrets are a nice addition to your Centipedes :)


You can also install mortars on mechs, but they still need a pawn to be operated.


The cool thing is that it also works for any non-vanilla turret (the image shows a turret added by More Vanilla Turrets).

And of course it also works with Run and Gun, so mounted gun turrets (not mortars) can shoot while the mech is moving (if you have that mod installed of course)  :).

Here are the update notes:

- Added Turret module mech upgrade.  This module provides both structural support and and interface for gun turrets and mortars.
- Added gun turret mounting mech upgrade. With this, you can install any gun turret that can be installed/uninstalled on a turret module. Gun turrets draw extra power from the mech (proportional to the power usage of the turret type). The turret module can only be installed on mechs that are large enough (min body size: 2.0)
- Added mortar mounting mech upgrade. With this, you can install any mortar on a turret module. Mortars still have to be operated manually by colonists and don't draw any power from the mechanoid. This upgrade has only a few benefits compared to using traditional mortars (quicker setup when raiding, less space needed). However, having a few mortars installed on mechanoids is a good way to impress your enemies.
- Added research for the new upgrades.
- All options normally present on installed turrets can still be used by selecting the turret, including uninstalling, deconstructing, setting a forced target, setting munition etc.
- Mounted turrets work exactly like they normally do, so they need maintenance, and they have a tendency to explode.
- Turrets from any mod are compatible (report it if they're not).
- Fixed repeated error being thrown when a directly controllable mech is killed.
- Mechs now contribute to wealth.


This was quite a big update, so I wouldn't be surprised if it introduced small issues, but it's fairly well tested. The next update will be focused on polishing/bug fixing, so that won't be as exciting.

QuoteWould you consider a cap on the number of colony mechs?  While I personally think it's a downright stupid idea It seems Tyran has it so any creatures add to the colony wealth regardless of faction/condition as long as they are not hostle or wild animals

Why would I cap that?

rawrfisher

You mentioned it in your update notes :P
Then again as I mentioned i thought the cap would be a stupid idea anyway.

I didnt see anything about repairs in the notes tho
Professional jerk
Want something broken let me know

Roolo

Quote from: rawrfisher on August 20, 2018, 03:06:19 PM
You mentioned it in your update notes :P
Then again as I mentioned i thought the cap would be a stupid idea anyway.

I didnt see anything about repairs in the notes tho

I never said I was going to cap anything. I said I was considering adding maintenance, not capping.
Don't worry about the repair issue, it will be fixed soon. I didn't have time left today to put that in, and didn't want to wait another day with pushing the update.

rawrfisher

#231
Quote from: Roolo on August 20, 2018, 02:26:08 PM

QuoteWould you consider a cap on the number of colony mechs?  While I personally think it's a downright stupid idea It seems Tyran has it so any creatures add to the colony wealth regardless of faction/condition as long as they are not hostle or wild animals

Why would I cap that?

- Mechs now contribute to wealth.
Probably should be more detailed then that random spew of words I let loose
Since mechs add to colony wealth now an adjustable cap could help people keep wealth in check.  In my case I don't care about wealth once I get established enough to actually defend myself but there might be people who think there should be a hard limit since being able to turn loose 30+ mechs on an enemy raid that's stuck in a narrow corridor is a bit cheaty.  I know that sometimes there are players trying to keep wealth below a set point for the sake of the theam they are running.
Maybe on specific mech types like 4 centipedes 10 lancers and unlimited scythers?  Yes players can self enforce these limits if they want.

Would have just edited my original post but you responded a bit quicker then expected.  I sometimes go back and retype my posts after thinking about it a bit. Normally I realize I worded something poorly or am entirely wrong and just delete the post.
Sorry about being so annoying at times. I have a bad habit of that

Well may as well make this post worth reading through. 
https://git.io/fAJKy  Output log for both errors


System.Reflection.TargetInvocationException: Exception has been thrown by the target of an invocation. ---> System.NullReferenceException: Object reference not set to an instance of an object
  at Verse.VerbTracker.CreateVerbTargetCommand (Verse.Thing ownerThing, Verse.Verb verb) [0x000e8] in C:\Dev\RimWorld\Assets\Scripts\Verse\Verbs\VerbTracker.cs:109
  at (wrapper managed-to-native) System.Reflection.MonoMethod:InternalInvoke (object,object[],System.Exception&)
  at System.Reflection.MonoMethod.Invoke (System.Object obj, BindingFlags invokeAttr, System.Reflection.Binder binder, System.Object[] parameters, System.Globalization.CultureInfo culture) [0x000d0] in /Users/builduser/buildslave/mono/build/mcs/class/corlib/System.Reflection/MonoMethod.cs:222
  --- End of inner exception stack trace ---
at System.Reflection.MonoMethod.Invoke (object,System.Reflection.BindingFlags,System.Reflection.Binder,object[],System.Globalization.CultureInfo) [0x000eb] in /Users/builduser/buildslave/mono/build/mcs/class/corlib/System.Reflection/MonoMethod.cs:232
at System.Reflection.MethodBase.Invoke (object,object[]) [0x00000] in /Users/builduser/buildslave/mono/build/mcs/class/corlib/System.Reflection/MethodBase.cs:115
at CompVehicle.HarmonyCompVehicle/<GetVerbsCommands>d__43.MoveNext () <IL 0x00145, 0x002b4>
at Verse.Pawn_EquipmentTracker/<GetGizmos>c__Iterator1.MoveNext () [0x00136] in C:\Dev\RimWorld\Assets\Scripts\Verse\Pawn\Trackers\Pawn_EquipmentTracker.cs:229
at Verse.Pawn/<GetGizmos>c__Iterator2.MoveNext () [0x00291] in C:\Dev\RimWorld\Assets\Scripts\Verse\Pawn\Pawn.cs:1861
at System.Collections.Generic.List`1<Verse.Gizmo>.AddEnumerable (System.Collections.Generic.IEnumerable`1<Verse.Gizmo>) <0x000d7>
at System.Collections.Generic.List`1<Verse.Gizmo>..ctor (System.Collections.Generic.IEnumerable`1<Verse.Gizmo>) <0x000e5>
at System.Linq.Enumerable.ToList<Verse.Gizmo> (System.Collections.Generic.IEnumerable`1<Verse.Gizmo>) <0x00070>
at WhatTheHack.Harmony.Pawn_GetGizmos.Postfix (System.Collections.Generic.IEnumerable`1<Verse.Gizmo>&,Verse.Pawn) <IL 0x00002, 0x00034>
at (wrapper dynamic-method) Verse.Pawn.GetGizmos_Patch7 (object) <IL 0x00058, 0x0012d>
at (wrapper dynamic-method) RimWorld.InspectGizmoGrid.DrawInspectGizmoGridFor_Patch0 (System.Collections.Generic.IEnumerable`1<object>,Verse.Gizmo&) <IL 0x0004e, 0x0024f>

Verse.Log:Error(String, Boolean) (at C:\Dev\RimWorld\Assets\Scripts\Verse\Utility\Debug\Log\Log.cs:78)
Verse.Log:ErrorOnce(String, Int32, Boolean) (at C:\Dev\RimWorld\Assets\Scripts\Verse\Utility\Debug\Log\Log.cs:105)
RimWorld.InspectGizmoGrid:DrawInspectGizmoGridFor_Patch0(IEnumerable`1, Gizmo&)
RimWorld.MainTabWindow_Inspect:DrawInspectGizmos() (at C:\Dev\RimWorld\Assets\Scripts\RimWorld\UI\MainButtons\MainTabWindows\MainTabWindow_Inspect.cs:94)
RimWorld.InspectPaneUtility:ExtraOnGUI(IInspectPane) (at C:\Dev\RimWorld\Assets\Scripts\RimWorld\UI\MainButtons\Inspect\InspectPaneUtility.cs:128)
RimWorld.MainTabWindow_Inspect:ExtraOnGUI() (at C:\Dev\RimWorld\Assets\Scripts\RimWorld\UI\MainButtons\MainTabWindows\MainTabWindow_Inspect.cs:70)
Verse.WindowStack:WindowStackOnGUI() (at C:\Dev\RimWorld\Assets\Scripts\Verse\UI\Windows\WindowStack.cs:169)
RimWorld.UIRoot_Play:UIRootOnGUI() (at C:\Dev\RimWorld\Assets\Scripts\RimWorld\UI\UIRoot_Play.cs:91)
Verse.Root:OnGUI() (at C:\Dev\RimWorld\Assets\Scripts\Verse\Global\Root\Root.cs:164)


It tried to apply the targeting hacked but failed for some reason. The mech was just sitting there worming around clogging the table and bugging any pawn that tried to move it.  I did a restore body part on it thinking it would just get itself killed by the turret ring around the bench but it was acting like a pawn in a daze.  Had a bio tab when I clicked on it too.
Just had the first error occur again.  Seems when there's a failed hack it triggers.



Exception filling tab RimWorld.ITab_Pawn_Character: System.NullReferenceException: Object reference not set to an instance of an object
  at RimWorld.CharacterCardUtility.DrawCharacterCard (Rect rect, Verse.Pawn pawn, System.Action randomizeCallback, Rect creationRect) [0x00223] in C:\Dev\RimWorld\Assets\Scripts\RimWorld\UI\Dialogs\PortablePanes\CharacterCardUtility.cs:71
  at RimWorld.ITab_Pawn_Character.FillTab () [0x00037] in C:\Dev\RimWorld\Assets\Scripts\RimWorld\UI\MainButtons\Inspect\ITabs\ITab_Pawn_Character.cs:50
  at Verse.InspectTabBase+<DoTabGUI>c__AnonStorey0.<>m__0 () [0x0004d] in C:\Dev\RimWorld\Assets\Scripts\RimWorld\UI\MainButtons\Inspect\InspectTabBase.cs:67
Verse.Log:Error(String, Boolean) (at C:\Dev\RimWorld\Assets\Scripts\Verse\Utility\Debug\Log\Log.cs:78)
Verse.Log:ErrorOnce(String, Int32, Boolean) (at C:\Dev\RimWorld\Assets\Scripts\Verse\Utility\Debug\Log\Log.cs:105)
Verse.<DoTabGUI>c__AnonStorey0:<>m__0() (at C:\Dev\RimWorld\Assets\Scripts\RimWorld\UI\MainButtons\Inspect\InspectTabBase.cs:71)
Verse.ImmediateWindow:DoWindowContents(Rect) (at C:\Dev\RimWorld\Assets\Scripts\Verse\UI\Windows\ImmediateWindow.cs:30)
Verse.<WindowOnGUI>c__AnonStorey0:<>m__0(Int32) (at C:\Dev\RimWorld\Assets\Scripts\Verse\UI\Windows\Window.cs:202)
UnityEngine.GUI:CallWindowDelegate(WindowFunction, Int32, Int32, GUISkin, Int32, Single, Single, GUIStyle) (at C:\buildslave\unity\build\Runtime\IMGUI\Managed\GUI.cs:1817)



I think that is the error log when I clicked the bio tab

Little bit of trivia but I get the hacking successful notice when installing a repair module
Professional jerk
Want something broken let me know

Roolo

#232
@Rawfisher

Ok, you're clear about the cap now. No need to apologize, but indeed it helps if you sometimes use some extra words to explain what you mean (like you did well in your last post). I get your point, having like 30+ mechs for just parts you get from destroying mechs you have to destroy anyway seems a bit cheaty, but that's why I was considering adding a maintenance mechanic. I don't like a hard cap because that's arbitrary and too limiting. The maintenance mechanic would work more as a soft cap. If you want a lot of mechs, go for it, but you'll have to accept that it comes at a cost (parts, workload for you pawns, and a thread of your mechs going rogue if you run out of parts or pawns capable of performing maintenance). If you only have a few mechs, the maintenance mechanic should be barely noticeable, so it doesn't affect the non-excessive mech-users that much.

Thanks for reporting the errors. From the first look of it, it seems like a conflict with Jecs Tools, as the code that is called, is called from HarmonyCompVehicle, which is part of Jecs tools. I'll try to reproduce it. Can you tell me what type of mech was bugging out? Was it a vanilla one?

By the way, make sure to press ctrl+f12 after you got the error. This way the error will be captured in the log (which is cleared each time you restart the game), and also if you do that, there's no need to place the error snippets here. Sometimes other thing lead to the error, and with the full log (including the error) I'm sure I don't miss out on any information that is relevant. Sometimes the log gets too big while you play, and you can't use ctrl+f12. In that case posting snippets is the only way to go.

By the way, maybe it's better if you contact me directly on Discord or Steam with these bug reports? This way we can communicate more easily without burying the update notes too much.


rawrfisher

Quote from: Roolo on August 21, 2018, 05:09:15 AM
@Rawfisher

Ok, you're clear about the cap now. No need to apologize, but indeed it helps if you sometimes use some extra words to explain what you mean (like you did well in your last post). I get your point, having like 30+ mechs for just parts you get from destroying mechs you have to destroy anyway seems a bit cheaty, but that's why I was considering adding a maintenance mechanic. I don't like a hard cap because that's arbitrary and too limiting. The maintenance mechanic would work more as a soft cap. If you want a lot of mechs, go for it, but you'll have to accept that it comes at a cost (parts, workload for you pawns, and a thread of your mechs going rogue if you run out of parts or pawns capable of performing maintenance). If you only have a few mechs, the maintenance mechanic should be barely noticeable, so it doesn't affect the non-excessive mech-users that much.

Thanks for reporting the errors. From the first look of it, it seems like a conflict with Jecs Tools, as the code that is called, is called from HarmonyCompVehicle, which is part of Jecs tools. I'll try to reproduce it. Can you tell me what type of mech was bugging out? Was it a vanilla one?

By the way, make sure to press ctrl+f12 after you got the error. This way the error will be captured in the log (which is cleared each time you restart the game), and also if you do that, there's no need to place the error snippets here. Sometimes other thing lead to the error, and with the full log (including the error) I'm sure I don't miss out on any information that is relevant. Sometimes the log gets too big while you play, and you can't use ctrl+f12. In that case posting snippets is the only way to go.

By the way, maybe it's better if you contact me directly on Discord or Steam with these bug reports? This way we can communicate more easily without burying the update notes too much.

I currently only have vanilla mechs The ones that bugged were centipede and lancer.
As for log size I load the game its already about 5000 lines of text.  Btw I found out that 30 centipides 10 scythers and 29 lancers got tore apart with ease against a swarm of bugs.  Then the bugs proceeded to tear apart my base for the next half hour while I was waiting at 1x speed for the rest of my colonists to get back and when they get back I get 2 large mech raids back to back comming in behind them as they get into the base to kill the bugs lol
Professional jerk
Want something broken let me know

Roolo

Small update with some important fixes:

- Body parts can now only be regenerated when the mech has no damage aside from the missing parts. This is to prevent mechs from dying because of the regeneration process (their missing part is replaced by a fully damaged one, lowering the hp, potentially killing a heavily damaged mech).
- Fixed hacking failed events throwing errors and not working anymore since one of the last updates.
- Hacking success letters are now only shown for the initial hack (and not for mech upgrades/ advanced hacks).


@Rawfisher. This should fix most issues you posted recently. I only couldn't reproduce this one:
Quote
Emmi trying to hack a centipede throws this.  Errors intermittent and eventually self corrects but still just a minor nitpick 8)
https://git.io/fNhOo  output log even tho this trivial error don't really warrant more then a good laugh

Let me know when you still experience that problem after the last update. If we're lucky it's already fixed as a side effect of other fixes.

rawrfisher

You know I will. Gotta wait till i get home to get any feedback tho.  Also the error with emmi is quite rare since she has a 15.5 in hacking dispite crafting being disabled
Professional jerk
Want something broken let me know

Roolo

#236
Another update:

- Added maintenance need. Any hacked mech now has a maintenance need for which the level decreases over time (it takes around 6 days to deplete, but it depletes faster when a mechanoid is damaged). 
- If a pawn's maintenance level is below 20%, it gets a small movement and manipulation debuff.
- If a pawn's maintenance level is below 10%, it gets a larger movement, manipulation, and consciousness debuff. More importantly, the hack has a risk of breaking, letting the mech revert to its original deadly behaviour.
- Pawns with hacking assigned make sure that hacked mechs are maintained, given that there are enough mechanoid parts. Pawns with higher hacking skill do this more effectively.
- The amount of parts needed for maintenance depends on the combat power of the mechanoid.
- When a mechanoid is hacked, it now gets a "running on backup battery" hediff, reflecting that it needs to be charged at platforms.
- Added alerts for the new maintenance need.
- Added mod option to disable the maintenance decay.
- When a mech is hacked poorly, it no longer has a chance to instantly lose its hack when being used. Instead, it has a chance that its maintenance is instantly dropped to 0, still giving the player a chance to save the mech.
- Mechs are now given a random name when hacked. Existing hacked mechs are also assigned a name. (The same name pool as for the animals is used, which leads to funny situations ^^. I had a scyther called "Hamburger")
- Edit (just added): Mechanoid parts are now also sold in outlander towns.


Before this update, you could hack as many mechanoids as you wanted with little consequence, potentially making it a solution for every problem. The new maintenance mechanic ends this "free lunch". Now you have to consider how many parts you have and how many skilled hackers you have before you recklessly hack any mechanoid that crosses your path. If you don't have too many mechanoids, the mechanic should barely be noticeable, so it's mainly intended to prevent exploits. For people that don't like this change, there's a mod option to disable it, though I suggest trying it out before disabling it.

rawrfisher

#237
Basiclly me after that last string of raids I had.  Lost over 50 mechs before the enemy got chased away XD

https://git.io/fAIY6

And so the error reports start.  2 errors at the bottom
Professional jerk
Want something broken let me know

Roolo

Update: Decreased maintenance decay, now it should take around 12 days to deplete a full bar. I'll probably tune it a bit more in the future after more playtesting.

Quote from: rawrfisher on August 22, 2018, 02:48:58 PM
Basiclly me after that last string of raids I had.  Lost over 50 mechs before the enemy got chased away XD

https://git.io/fAIY6

And so the error reports start.  2 errors at the bottom
Sure you shared the right error log? Your log only seems to contain initiation errors, and the last 2 errors don't seem to be related to WhatTheHack.

Madman666

This maintenance mechanic looks actually quite balanced compared to some ridiculous stuff vanilla now has, so my compliments to you, Roolo. I won't be disabling it without trying out first for sure.