Projectiles bounding boxes not functioning in Developer Help
|
|
Code:
obj/_projectile density = 1 var mob/owner base_damage max_damage damage crit_probability
default_while = 1 angle vel_x vel_y acc_x = 0 acc_y = 0 x_init = 0 y_init = 0 x_offset = 0 y_offset = 0 vel_multiplier = 8 direction move_counter move_limit
New(mob/o, _angle, _acc_x, _acc_y) owner = o direction = owner.dir angle = _angle acc_x = _acc_x acc_y = _acc_y var/own_bh = round(owner.bound_height/2) var/own_bw = round(owner.bound_width/2) var/bh = round(bound_height/2) var/bw = round(bound_width/2)
y_init = owner.step_y + own_bh - bh x_init = owner.step_x + own_bw - bw
switch(direction) if(NORTH) y_init += own_bh
if(SOUTH) angle += 180
y_init += -own_bh y_offset = -y_offset
acc_x = -acc_x acc_y = -acc_y
if(EAST || SOUTHEAST || NORTHEAST) angle -= 90
x_init += own_bw
x_offset += y_offset y_offset = x_offset - y_offset x_offset -= y_offset
acc_x += acc_y acc_y = acc_x - acc_y acc_x -= acc_y
if(WEST || SOUTHWEST || NORTHWEST) angle += 90
x_init += -own_bw
x_offset += y_offset y_offset = x_offset - y_offset x_offset -= y_offset
x_offset = -x_offset
acc_x += acc_y acc_y = acc_x - acc_y acc_x -= acc_y
acc_x = -acc_x
vel_x = cos(angle) * vel_multiplier vel_y = sin(angle) * vel_multiplier Create()
proc/Create() loc = owner.loc
step_x = x_init + x_offset step_y = y_init + y_offset
if(default_while) while(src) move_counter ++ if(move_counter > move_limit) del src sleep(world.tick_lag)
step_x += vel_x + acc_x step_y += vel_y + acc_y
fireball density = 1 icon = 'fireball_test.dmi' bound_width = 16 bound_height = 16 y_offset = 10 vel_multiplier = 3 move_limit = 999
|
Problem description:
No matter what I do, when I create one of these projectiles, their bounding boxes are not functioning. They go through everything and exit the map. I'm not sure what the problem is here. I've tried changing them to mobs. I've tried using the Cross() proc but nothing is picked up.
(Note that I am NOT using Forum_Account's Pixel Movement)
|
Otherwise, you'll have to do obounds() to search for dense things, but that gets complicated and doesn't take advantage of the built-in pixel movement support (it's a lot of pre-native-pixel-movement calculation that not many people are used to).
Also, vel_multiplier is also called "speed".