ID:2010405
 
(See the best response by Ter13.)
Just fuchxin feed me man.
Best response
Wetness is the essence of moisture, and moisture is the essence of beauty.

obj
ore_node
var
min_chunks = 1
max_chunks = 4
ore_type = /obj/item/diamond
proc
Crush()
var/chunks = rand(min_chunks,max_chunks)
var/obj/item/i
//get the pixel center of the current object.
var/cx = round(x*TILE_WIDTH + step_x + bound_x + bound_width)
var/cy = round(y*TILE_HEIGHT + step_y + bound_y + bound_height)

var/angle, dist, ox, oy, turf/t
for(var/count in 1 to chunks)
i = new ore_type()
angle = rand()*360
dist = rand(0,32)
//use cos/sin based on angle a to generate the new center coordinate of the ore item.
ox = cx + cos(angle) * dist - i.bound_width/2
oy = cy + sin(angle) * dist - i.bound_height/2
t = locate(ox/TILE_WIDTH,oy/TILE_HEIGHT,z)
//Move() the item in place. You will need to handle failure or out of map bounds locations.
i.Move(t,0,ox%TILE_WIDTH,oy%TILE_WIDTH)

Click()
Crush()


That's the gist of it.
Yes more.
Just don't call out specific users for help in the future like this. It's rude.
More.
I'm stuck on the round function, I'm examining its parameters & I see 'TILE' (I dunno htf that got there), or what step_x is returning the width of an icon? bound, I'm looking up now.

I know TILE_WIDTH is a variable, atoms are presumably 1 tile & bound calculates the... okay I get it.

Now we've got angle, dist and 'ox' (is this like the objects 'thrust' within a tile?)
And turf/t (wth is that doing there?)

count in 1 to... idg it
'to' isn't in the reference (i can't find it)

i = new ore_type() //is that ore_type() a function or just syntax of 'new' ?

angle is good
distance is good

the rest was too complex didn't wanna have a psychotic episode, so I just ignored it hoping you'd elaborate.

var/cx = round(x*TILE_WIDTH + step_x + bound_x + bound_width)
var/cy = round(y*TILE_HEIGHT + step_y + bound_y + bound_height)

and all of this

ox = cx + cos(angle) * dist - i.bound_width/2
oy = cy + sin(angle) * dist - i.bound_height/2
t = locate(ox/TILE_WIDTH,oy/TILE_HEIGHT,z)
//Move() the item in place. You will need to handle failure or out of map bounds locations.
i.Move(t,0,ox%TILE_WIDTH,oy%TILE_WIDTH)
You should read the DM guide as a starter, and an introduction to computer science.

None of this was particularly complex. This is all 9th-10th grade math.
Got it. I'll give it a shot.

And the maths is making more sense, I fell asleep man.