Mod item request: shield hanger/hook

If I may intrude with my non-coding (lack) of abilities, I’d say you’re approaching the shield hanger wrongly :smiley:

It can be done in a much simpler and code-free way:
Create a wall decoration that is just the hook.
Give it a destination region that is tall enough to be accessed from the ground and then add the storage component to it. In the storage component there’s an option called “render_contents” or something like this.
Set it to true, choose the storage size to be 1 and make it an input_box.

You’ll then create an input_box filter for it, make the filter only accept shields (via material tags) and then create an animation with a single item hook that is the shield hanging and that’s it :smiley:

Hearthlings will come and hang a shield on it and whenever a footman needs that shield they’ll come and pick it up :merry:

1 Like

Yeaaaaaah, that was my first thought too, the only problems are:

  1. The material tags on a (for example, bronze) shield are "bronze armor heavy_armor stockpile_equipment". Notice the lack of… you know… shield
  2. Its important that the player be able to set which shield they want to use, as this is a piece of decoration. Just having the hearthlings throw up any shield kinda defeats the point, you don’t want to hang up the wooden buckler while the Dragon Shield lies in a stockpile (although I do want to have that as an option too, since you might have a lot of these. Player freedom and all that)
  3. I want to have this work for modded shields too, so while I could hand write a filter which is just a list of all the URIs for the 8 or so shields in the base game, I want to actually display anything which is any kind of off-hand armor from any mod (currently got the Glassworks mod for testing this)
  4. I also do not want all shield in the game displayed here, only the ones in the inventory (much like the market stall shelves). This is because I feel like the two legendary shields, as well as shields that may come from mods, fall into “spoiler” territory, and I don’t want to spoil them in mods

One might argue that these points are me being too perfectionist with such a tiny mod… and the proverbial one might be right, but hey ho

1 Like

Hmmm, fair points. As a non-coder tho, let me list how I’d go around them:

  1. I’d mixinto all the in-game shields to add the shield tag to their materials. Honestly, this would actually be a “fix” to the game as the lack of a shield definition in their tags is somewhat an overlooking by the Devs. Adding ‘shield’ to shields’ material tags would be the start of a good policy that would, hopefully be continued by other mods.

2,3,4. That can already be done with input_box filters. You can have a “Any shield” filter, a “special shields” filter (for legendary shields without spoilers, for example) and then a second category called “specific shields” for example with all the unique shields listed. Mods with new shields can mix into that filter list for their shields to be there as well should they wish

But yeah, this is the “hacking around” approach - of course one could come up with a much better and proper system for it but - like I said - I look for the non-coding solution :smiley:

1 Like

This could be a good thing with a coordinated effort, maybe an ACE-Y thing (Although, at that point I would rather just rewrite the zone issue I have in the first place so custom zones can be written without overrides)

Assuming the above coordinated effort doesn’t get organized, this just won’t happen though. Not a chance in a million that a random modder will go through their mod to ensure it has the right tags for Kai’s hook mod. Heck, I wouldn’t even bother putting in the tags, and its my mod!

This while certainly not removing any of those issues, does reduce their impact a bit, thanks :slight_smile:

1 Like

What if you use the same idea that the market stalls do? It only allows you to select one item from your inventory, and is not based on tags, it displays the actual items you have

That’s what i assumed would be possible. Copy all that code, add in a line that says .filter(i => i.slot === "offhand" && i.tags.indexOf("armor") !== -1) and then I’m done

Unfortunately the code which handles that part of the UI, the part of the code which handles players and NPCs buying and selling market stall items, and that general zone list I copy pasted a few messages ago are all mixed together in an unhelpful way which means I can’t see exactly where I can extend it.

Right now the thing I am most tempted to do is make a generic “display hook” as a wall mounted any item displayer, and then monkey-patch the market stall component to make sure no one can buy anything from items on my hooks…

Why not create a new component based on that one but without the parts you don’t want? (like the buying/selling)

Because the way the game knows which GUI to show (i.e. the one listing all items in the inventory) is hard-coded to look for the player_market_stall component, so creating a new component puts me back at square one

1 Like

Oh, and also I have spent like an hour digging around this point of code, and just the tiniest amount too much is in C++ for me to fully grasp it, but there is one “problem” which is that ideally i would show the non-iconic version of the item, but no where in the lua part of the code is it explicitly stated that the iconic version is to be rendered

It does render the item that is inside, since you usually have stuff iconic inside containers, that’s why things are rendered in their iconic form. To have it not be iconic, you’d just have to have the shield inside it not be iconic itself; no clue how you would do that, though. I did that (by accident) with Glassworks, when some glass furniture cooled down, they would turn into their non-iconic form inside a container (which caused errors), so I had to specify them to be the iconic form. I think you can, likewise, specify the rendering to be the non-iconic form somehow; But then again, if you’re going to delve into code like that then you might as well just go for your cleaner approach :smiley:

Mhmmmh… that actually makes a lot of sense

I’m now sympathizing with the idea of a more complex/robust new system rather than a simple edited input_box.

Because you could probably expand it a lot to have fully customisable armor stands and such…

2 Likes

yeah i had that issue aswell, on my attempt i overwrote shields stuff with the world shield behind it

ah, but AFTER they put a shield on the hook, you can MOVE the hook away, and put up a new one. the item will stay on/in the hook, and people are usually not drownging in excess shields. this is not that big an issue.

filter on both armour and shield, tell shield makers to include the word shield in their keyword thingies.

edit: bugger, it only displays iconic versions when stored? bah.

I mean like, yeah, this is a solution, but its frustrating because the information is there in the JSON file, it just needs a line and a half of logic

well if you know how to write that line and a half of logic, dont let me stop you XD
its just above my skill level :confused:

@kaimonkey and @DaniAngione
note sure if you two were still simmering on a way how to make it possible, so i made it as a decorate item that just does one of my shields, to let you guys see a bit of how the payoff would look and work :wink:
(look above the door)

1 Like

im revisiting this idea again because i still think it would be a good addition to the game. ive got the imput bin, ive got the filter working. (currently only my own shields because they actually have the word shield in their tag)
so it attaches to a wall. it stores a shield for use untill needed… but how would i show the shield thats in it hanging on it?
imput bins as far as i know so far mostly show iconics, scaled down.
Q1: -can that system show the detailed version of items, instead of the iconics?
Q2: if yes,…HOW?

@kaimonkey and or @DaniAngione i suspect you guys might know :stuck_out_tongue: (since you used this system for your tanning vats dani, and more interestingly, for your large hide drying rack)

1 Like

You can look into any of the input bins in the game for the “how”. But basically:
They show it through an animation. You have to set up for items to be visible in the container json (storage component, you’ll notice a “show_contents” setup or something like that). The animation is basically a rig where you place the “hooks” (bones) where the items will be displayed. In your case, it’s just a single item - pretty straightforward, you should be able to edit. If you wish a better/single example, the Drying Rack in Trapper+ is an input_bin with a single item - with some patience and trial and error you can even edit the animation/reposition the item without having to open blender (I positioned the hide on the rack only by toying with the numbers)

As for the specific questions:

You’re not entirely wrong in your assertion, but they do not display scaled down iconics. They simply display what is inside of them - since items that have iconic forms will need to be in iconic form to be inside a container, that is why the iconic form is displayed. However if you manage to put an item not in iconic form, it will display its non-iconic form (but that might require some LUA magic). The scale is defined in the animation; although traditional input bins have scaled down models, output bins (the shelves) for example, are 1:1 items so they’re not necessarily scaled down, you set that up yourself. My hides on Trapper+ are stretched and thin because you define the scale on all 3 axis, so you can even “deform” items on display.

As Kai was trying, your best bet for this system to work very nicely would require some new coding - even if you don’t go as far as creating a new type of furniture for displaying equipment, you’d still at least a couple lines to make the displayed form not be the iconic one.
My personal approach, since I can’t LUA much, would be to work with the iconic - maybe make the iconic pretty nice looking and slightly scale it up on the input bin. Might not be perfect but it would work. Do note that there are some equipment (like some of the weapons, bone mace I think?) that have large iconics - the iconics are not restricted to 10x10x10 model-wise - so technically you could make your good looking shields be good looking still even if iconic :wink:

I can tell you from my experimentation that the scaled up icons do not look nice :wink:

2 Likes

Indeed. If a simple shape, it can be ok. But a complex/painted shield probably won’t. But then again, like I said, an iconic model can be larger than 10x10x10 so if he really wants to avoid LUA, it’s still possible to look good :3

Of course the shields would probably clip when in stockpiles… but then again, stockpiles are already ugly by themselves :smiley: