RunUO Community

This is a sample guest message. Register a free account today to become a member! Once signed in, you'll be able to participate on this site by adding your own topics and posts, as well as connect with other members through your own private inbox!

Placing item on custom houses the OSI way

darkaxf

Sorceror
Hello gents, if you ever happened to play on OSI servers you may have noticed how you can place stuff on low walls and (if memory doesn't fail me) under the arch tiles, I tried to reproduce the same behaviour, so here I am pasting the changes I made to Item.cs from rev 663, I'd like some feedback to see if it's proper or if I should seek another way.

So, here's what to change:
Item.cs

1)@3969
Change:
Code:
                int checkZ = tile.Z;
                int checkTop = checkZ + id.CalcHeight;

                if ( checkTop == checkZ && !id.Surface )
                    ++checkTop;
To:
Rich (BB code):
                int checkZ = tile.Z;
                int checkTop = checkZ + id.CalcHeight;

                if ( !id.Impassable && ( id.Flags & TileFlag.Wall ) != 0 )
                    checkTop = checkZ;

                if ( checkTop == checkZ && !id.Surface )
                    ++checkTop;
This should help the item get the right z when being placed on walls you can walk through, like arches.

2)@4064,
Change:
Code:
                if ( checkTop > z && (z + height) > checkZ )
                    return false;
                else if ( (id.Surface || id.Impassable) && checkTop > surfaceZ && (z + height) > checkZ )
                    return false;
To:
Rich (BB code):
                if ( id.Impassable && checkTop > z && (z + height) > checkZ ) // To place items under arches or whatever
                    return false;
                else if ( (id.Surface) && checkTop > surfaceZ && (z + height) > checkZ ) // To place items on low walls & co
                    return false;

Now, what's bothering me is that I don't remember exactly the arch thing, if it was legit and if there was a shorter limit to how many items you could stack on it, I did this test 4-5 years ago... so can anyone up-to-date verify this ?

I tried running around placing item here and there, and it seemed to work right... but being a rookie at runuo devving I'd rather listen to an expert opinion.
 

Lokai

Knight
This is the type of post that would go over the heads of most people here - me included for the most part. I'm the type of scripter that enjoys this stuff, but unfortunately I do not have a system to test or verify what you have done. Just realize that it might be a while before you get a response.
 

TheNorthStar

Sorceror
Sorry, I'm terrible about trying out code and forgetting to comment back. I haven't played on OSI in many years, so I couldn't speak for how many things could stack on arches. Everything else works as well as I remember it, though. Thank you for sharing.
 

kegmeister

Sorceror
At first glance i see a couple problems. Non-impassable walls can be arches but they can also be other things so you need to make more specific exceptions. You also need to check for something like a maximum z displacement, otherwise you'll be able to drop items onto weird places such as embedded into walls between floors of a multi-level building.
 

darkaxf

Sorceror
A friend let me test a few things on the OSI TC, and well, I couldn't place anything under passable walls (bummer), which is weird because he'd confirmed me it was possible (maybe not in the tc ? I'll have to ask him again). In my opinion, if you can walk on it, you have the holy friggin' right to drop whatever you want on it, thing that would lift decorators from the burden of walking there with a full backpack, crafting a crate which drops at their feet, putting items inside, and axing it.

@Kegmeister: the maximum z displacement is always the standard one, the changes only make so the passable wall gets ignored in the calculation.
 
Top