[1.3] [KV] Weapon Storage [ModSync RW]

Started by Kiame, September 05, 2017, 05:46:47 PM

Previous topic - Next topic

crusader2010

#150
Quote from: Kiame on November 29, 2018, 12:50:53 PM
Haven't seen that one... Is the weapon storage being build using a modded material? I vaguely remember either fluffys blueprints or stuff mod was having problems with modded furniture

Nope, plain wood and steel, as per the requirements. I am using Fluffy's Blueprints mod too. And StuffedFloors + StuffedFlaks.
The Blueprints mod is way above WeaponStorage in the mod list (got ~130 mods).

Should I move it further down?

EDIT: moved blueprints and stuffedflaks below weaponStorage and still the same error :(
Also attached the mod config file.

[attachment deleted due to age]
My mod pack: {A13} Mod Mega Pack

Kiame

If you disable those mods and try to build the weapons storage in a new game does it work?

crusader2010

Quote from: Kiame on November 29, 2018, 04:54:37 PM
If you disable those mods and try to build the weapons storage in a new game does it work?

Going to try it in a few days after I come back home and let you know (though i'd like to use those mods too ;D ). I remember that this happened on B19 too, but not what was causing it and how I solved it then (what I do remember is that Blueprints could be used; so gonna try disabling StuffedFlaks).
My mod pack: {A13} Mod Mega Pack

crusader2010

#153
Quote from: crusader2010 on November 29, 2018, 10:27:41 PM
Quote from: Kiame on November 29, 2018, 04:54:37 PM
If you disable those mods and try to build the weapons storage in a new game does it work?

Going to try it in a few days after I come back home and let you know (though i'd like to use those mods too ;D ). I remember that this happened on B19 too, but not what was causing it and how I solved it then (what I do remember is that Blueprints could be used; so gonna try disabling StuffedFlaks).

Tried it with the two mods disabled and still getting the same error. I can provide a saved game and an archive with all the mods if needed (it's older than what i use now, but the issue is still happening).

EDIT: here's a link to the whole log:  LOG
Does the mod conflict with ChangeDresser?

EDIT2: there are also more errors like "Config error in WeaponStorage: has components but it's thingClass is not a ThingWithComps" and "Config error in WeaponStorage: has null thingClass.".

My mod pack: {A13} Mod Mega Pack

Heymom

Hey Kiame

I use a lot of your mods, and i expecially like the storage ones.

I do have a suggestion/request tho. I tend to equip all my pawns with the same weapon (eg. sniper rifle) and always make sure i have +1 spare so that my pawns will pick it up if they lose their "own". I use simple side arms mod as well.
with your weapon storage mod, it seems that the weapon assigned is unique aka you give it a unique ID or smth, so if they drop or lose the weapon (blown up..) i have to re-assign a weapon.

tldr; would it be possible to assign a group type weapon to a pawn
if equiped(unique=false) !== sniper_rifle(id=any, quality=any)
then
equiped == sniper_rifle(id=any, quality=any)
else
equiped == sniper_rifle(id=xx)

^^ my poor attempt at psodo coding :P
Hope you get the idea behind my suggestion tho. Else i can try to elaborate further.

Cheers.

Kiame

#155
Nothing unique really with how weapons are assigned. Each pawn gets assigned a list of weapons. When a weapon is assigned to a pawn it's added to that list.

When a pawn equips the weapon, the weapon is removed from the list. Of the pawn is incapacitated the equipped weapon is added to the list so they do not lose it. Iirc when they are no longer incapacitated they will equip the last equipped weapon automatically

I have not tried this mod with simple sidearms though I do believe they do roughly the same thing. This mod allow the assignment of multiple weapons to pawns and the pawns can immeditly equip any assigned weapons.

If i understand the request, it'd be similar to how apparel is assigned. That would be a large undertaking and tbh I don't see enough benefit for the time it would take

Heymom

Quote from: Kiame on December 13, 2018, 10:36:57 AM
Nothing unique really with how weapons are assigned. Each pawn gets assigned a list of weapons. When a weapon is assigned to a pawn it's added to that list.

When a pawn equips the weapon, the weapon is removed from the list. Of the pawn is incapacitated the equipped weapon is added to the list so they do not lose it. Iirc when they are no longer incapacitated they will equip the last equipped weapon automatically

I have not tried this mod with simple sidearms though I do believe they do roughly the same thing. This mod allow the assignment of multiple weapons to pawns and the pawns can immeditly equip any assigned weapons.

If i understand the request, it'd be similar to how apparel is assigned. That would be a large undertaking and tbh I don't see enough benefit for the time it would take
Ok, i dont know the coding needed for my request. I just noticed that my pawns wont equip their weapon, after they lose it. So i thought it was due to unique ID assigned to "that" weapon or smth.
I do run a very modded game, so there could be some conflicts. But with 20+ pawns, i tend to go for a more automated management style of game. Why i always use the same gear on all pawns and just make +1 of each, if anyting goes missing.

Kiame

Sorry i typed that when i first work up and the last part was not as nice as it should have been.

I don understand it can become cumbersome having to assign weapons over and over to pawns... let me do some thinking if there might be an easy way do this other than what i was thinking before

crusader2010

Quote from: Kiame on December 13, 2018, 12:48:05 PM
Sorry i typed that when i first work up and the last part was not as nice as it should have been.

I don understand it can become cumbersome having to assign weapons over and over to pawns... let me do some thinking if there might be an easy way do this other than what i was thinking before

May I suggest showing all the pawns on the left, then all the weapons on the right side of the weapons storage window? From there it can be customized further with checkboxes to everything.

If you select more pawns, make visible another checkbox that says "list only weapons whose numbers are equal to the number of selected pawns" (for now don't put filters for quality and such, to keep it simple). Also, with multiple pawns selected and the previous checkbox checked, make visible a button to "bulk assign". It'll take each pawn and assign him one of the weapons (maybe index to index instead of writing more code for random assignment). From what I can tell, there is no chance for error this way.

PS: I managed t solve the errors with ChangeDresser and WeaponsStorage by putting them at the very bottom. Soon i'll try to see with what they conflicted and let you know.
My mod pack: {A13} Mod Mega Pack

Kiame

#159
So almost like a pool of weapons that selected pawns can pull from?

My concern with that approach is weapon quality. I like to have the best weapons go to average shooters before bad/great shooters...

Brainstorming
Maybe a new creatable thing - Shared Weapons - where you can select the weapon types that are available to be shared. Once one or more Shared Weapon groups is created, whenever any pawn is selected there is a button available to for the pawn to draw from the shared weapon group.

crusader2010

Quote from: Kiame on December 13, 2018, 01:49:04 PM
So almost like a pool of weapons that selected pawns can pull from?

My concern with that approach is weapon quality. I like to have the best weapons go to average shooters before bad/great shooters...

Brainstorming
Maybe a new creatable thing - Shared Weapons - where you can select the weapon types that are available to be shared. Once one or more Shared Weapon groups is created, whenever any pawn is selected there is a button available to for the pawn to draw from the shared weapon group.

But the pool of weapons is already there: all of the weapons that are in the weapons storage. Secondly, it wouldn't solve what a previous poster suggested - the need to assign each and every pawn his weapon. He wanted something like a bulk assign.

Another idea would be to create "views" for the weapons list and sorting for pawns based on ranged and melee skills.

Basically have something similar to outfits for the list of weapons in the storage. Default is "all weapons". Players can create new ones where they can choose the types of weapons to show, their quality range, their hitpoints range, whether they were looted from a corpse or not, etc. When we open the weapons storage window we need a button to select the "view" for the list of weapons which simply filters what is shown. Combine it with what I said in the previous post and you can have bulk assignment of whichever weapons/pawns you want (if there are enough of them, of course).

The pawn list could have 2 more columns to show ranged and melee skills and to allow sorting  by them.
My mod pack: {A13} Mod Mega Pack

Kiame

#161
Quote from: crusader2010 on December 14, 2018, 03:57:10 AM
Quote from: Kiame on December 13, 2018, 01:49:04 PM
So almost like a pool of weapons that selected pawns can pull from?

My concern with that approach is weapon quality. I like to have the best weapons go to average shooters before bad/great shooters...

Brainstorming
Maybe a new creatable thing - Shared Weapons - where you can select the weapon types that are available to be shared. Once one or more Shared Weapon groups is created, whenever any pawn is selected there is a button available to for the pawn to draw from the shared weapon group.

But the pool of weapons is already there: all of the weapons that are in the weapons storage. Secondly, it wouldn't solve what a previous poster suggested - the need to assign each and every pawn his weapon. He wanted something like a bulk assign.

Another idea would be to create "views" for the weapons list and sorting for pawns based on ranged and melee skills.

Basically have something similar to outfits for the list of weapons in the storage. Default is "all weapons". Players can create new ones where they can choose the types of weapons to show, their quality range, their hitpoints range, whether they were looted from a corpse or not, etc. When we open the weapons storage window we need a button to select the "view" for the list of weapons which simply filters what is shown. Combine it with what I said in the previous post and you can have bulk assignment of whichever weapons/pawns you want (if there are enough of them, of course).

The pawn list could have 2 more columns to show ranged and melee skills and to allow sorting  by them.

Yes that's what i'm considering with the outfits selection, just accessible via weapon storage and not turned on until the user creates one.

As for the pool of weapons, it'll actually be all weapons that match the created Shared Weapons in all storages in all maps; unless there's strong negative feedback. The weapons would stay in the storage until a pawn uses one of the weapons. When the pawn switched weapons, the previous weapon would the go through all storages on all maps and find the best one to store the weapon in (based off priority and storage settings); then dropping the weapon next to the pawn if no applicable storage was found.

Adding a pawn's ranged/melee skills has been on my todo list for a long time. I'll see about getting that added too

Kiame

#162
Update
Added shared weapons

Kiame

Update:
Storages will now collect all weapons around them on a save - no matter the filter settings. Any weapons collected this way will be put back onto the floor a few seconds after the save is complete / the save is loaded.

crusader2010

#164
Quote from: Kiame on December 17, 2018, 05:50:28 PM
Update:
Storages will now collect all weapons around them on a save - no matter the filter settings. Any weapons collected this way will be put back onto the floor a few seconds after the save is complete / the save is loaded.

Playing with the previous version with "shared weapons". The buttons from the window that open up on this action do nothing. Also getting some errors:

This line is spammed a lot (i think for every weapon inside the storage):

Building_WeaponStorage.Remove(ThingWithComp)
StackOverflowException The requested operation caused a stack overflow.
  at WeaponStorage.Building_WeaponStorage.Remove (Verse.ThingWithComps weapon, Boolean forbidden) [0x00000] in <filename unknown>:0


This is repeated over 400 times (I do NOT have that many weapons!):

Exception filling window for WeaponStorage.UI.SharedWeaponsUI: System.NullReferenceException: Object reference not set to an instance of an object
  at WeaponStorage.UI.SharedWeaponsUI.DoWindowContents (Rect inRect) [0x00000] in <filename unknown>:0
  at Verse.Window+<WindowOnGUI>c__AnonStorey0.<>m__0 (Int32 x) [0x00000] in <filename unknown>:0
Verse.Log:Error(String, Boolean)
Verse.<WindowOnGUI>c__AnonStorey0:<>m__0(Int32)
UnityEngine.GUI:CallWindowDelegate(WindowFunction, Int32, Int32, GUISkin, Int32, Single, Single, GUIStyle)


And another one that appears once:

Exception while getting gizmos for pawn Trumpet
Object reference not set to an instance of an object
  at WeaponStorage.HarmonyPatches+Patch_Pawn_DraftController_GetGizmos.Postfix (RimWorld.Pawn_DraftController __instance, IEnumerable`1& __result) [0x00000] in <filename unknown>:0
Verse.Log:Error(String, Boolean)
Verse.Log:ErrorOnce(String, Int32, Boolean)
WeaponStorage.Patch_Pawn_DraftController_GetGizmos:Postfix(Pawn_DraftController, IEnumerable`1&)
RimWorld.Pawn_DraftController:GetGizmos_Patch3(Object)
Verse.<GetGizmos>c__Iterator2:MoveNext()
System.Collections.Generic.List`1:AddEnumerable(IEnumerable`1)
System.Collections.Generic.List`1:.ctor(IEnumerable`1)
System.Linq.Enumerable:ToList(IEnumerable`1)
TD_Enhancement_Pack.StopGizmo:Postfix(IEnumerable`1&, Pawn)
Verse.Pawn:GetGizmos_Patch10(Object)
RimWorld.InspectGizmoGrid:DrawInspectGizmoGridFor_Patch0(IEnumerable`1, Gizmo&)
RimWorld.MainTabWindow_Inspect:DrawInspectGizmos()
RimWorld.InspectPaneUtility:ExtraOnGUI(IInspectPane)
RimWorld.MainTabWindow_Inspect:ExtraOnGUI()
Verse.WindowStack:WindowStackOnGUI()
RimWorld.UIRoot_Play:UIRootOnGUI()
Verse.Root:OnGUI()


EDIT: still getting the second error from above about 500+ times when I open the Shared Weapons window. The rest seem to have gone with the latest version :)

EDIT2: still getting the 3rd error too when trying to assign a weapon to a pawn. Somehow the weapon got lost, too!
I've assigned a ranged weapon to a new recruit but the button to actually equip it never showed up. So I tried dropping it (from the arrow button from Weapon Storage, that is to the right side of every weapon). Then it simply disappeared.

So right now I can't properly assign weapons to pawns (they show up as assigned in in the Assign window, but not on the pawn's gear).

EDIT3: when clicking the "Assign weapons" button, not all of them are shown. All seem to appear only after selecting a pawn.
My mod pack: {A13} Mod Mega Pack