Thread Rating:
  • 5 Vote(s) - 5 Average
  • 1
  • 2
  • 3
  • 4
  • 5
[Bug] Surgical tray change
The movable surgical tray is a really cool idea, I've always liked it, but it never seemed to work consistently. mbc showed me the code a while ago and essentially what it did was physically move each object in the world whenever the tray moved. 

This change takes advantage of the vis_contents feature of 512.14 (or something like that). Now adding a item to a surgical tray adds that item to the tray's contents AND vis_contents so that it is displayed on the tray's sprite.

In order to keep the functionality of only allowing a certain amount of items on the tray. I've added a line in proc/move that checks if the tray's contents is over the maximum amount (10). Then there is a chance for an item to fall off. (stole that part from disposals ejectors)


- For anyone who decides to merge this, it might take a bit more effort than normal despite the small change. For one thing, it uses features of the modern codebase like (iswrenchingtool and the proc for placement at cursor coordinates.) I either commented these sections out like with the wrenching tool, or hacked it in like with the placement (which is used by regular table objects).


- This is really more of a bug with how throw-at works than anything I've done. If you attempt to throw something by clicking on an object that is in the contents of another object, then it attempts to throw at location (0,0). It's noticeable here because you might click on one of those objects to throw it at the table, and it goes off course.
Cool change

It occurred to me to test if pulling an item off of the tray with the pull verb might break my change. And it does, so I decided to fix it. My fix for this also fixes the commonly experienced bug where you can use the pull-click to pull mobs or items out of the morgue or genetics scanners. Sorry. I thought about not fixing it and just making it so that you can pull items off the tray, but that would mean making 3 changes to for a single object's special use. Much better to make 3 changes to fix a bug, even if some people use it for fun.

Basically I just added a check for if the object being pull-clicked's loc is an object and if they're in that object's contents. This is in turf/simulated, turf/unsimulated, and turf/space. You'll need to add it to turf/oshan_floor or whatever itc called. I suppose I am redundantly checking to see if the pulled object is in the container object's contents. But I didn't know or care enough to say if there's an edge case so better safe than sorry...

Edit: Fixed that original bug with the throwing at objects. Had to add a check in proc/throw_at . You can take or leave it, it's only in the very last commit:
(02-20-2019, 12:25 AM)kyle2143 Wrote: this also fixes the commonly experienced bug where you can use the pull-click to pull mobs or items out of the morgue or genetics scanners.

Oh my Budda, that bug has been bugging me so much. 5/5 if only for this!

Forum Jump:

Users browsing this thread: 1 Guest(s)