What I want: Think of it as a lawnmower attack. Players toggle horn() on and off. If toggled, should be facing in front of player at all times.
Code:
/////////////////////////////////////// trigger ////////
ATTACK5(player/p)
if(!p.horse_mode) return //if not a horse do not let use 5th attack.
if(!p.horns)
world <<"horn should appear"
p.start_attack()
p.horns = new/combat_obj/antelope/horns(p)
else
world <<"NO HORNS"
del p.horns
p.stop_attack()
/////////////////////////////////////////////////////////////////
mob
Move()
if(src.horns) //If antelope horns activated
src.horns.SET_BOUNDS()
src.horns.refresh()
usr <<" TRUE"
..()
combat_obj
antelope
New(player/p)
..()
// SET_BOUNDS()
DAMAGE()
for(var/player/p in obounds(src))
if(p.team == owner.team||p.dead) continue
DAMAGE(owner,p)
SET_BOUNDS()
loc = owner.loc
dir = owner.dir
step_x = owner.step_x
step_y = owner.step_y
horns
icon = 'ant_horns.dmi'
layer = FLOAT_LAYER
New(player/p)
owner = p
owner.horns = src
world << "Horn owner = [owner]"
SET_BOUNDS()
..()
Del()
world << "delete is being called"
..()
proc
refresh() //pointless
owner.overlays -= src
owner.overlays += src
SET_BOUNDS()
..()
world <<" dir = [dir] "
switch(dir)
if(NORTH)
bound_x=32
bound_y=4
bound_height=48
bound_width=5
step_x+=16
step_y+=70
if(SOUTH)
bound_x=32
bound_y=12
bound_height=48
bound_width=5
step_x+=16
step_y-=43
if(EAST)
bound_x=4
bound_y=29
bound_height=5
bound_width=48
step_y+=9
// step_x+=70
step_x+=300
pixel_x+=300
if(WEST)
bound_x=12
bound_y=32
bound_height=5
bound_width=48
step_y+=6
step_x-=40
Problem description:
Icon wont refresh to proper location. Icon only keeps offsets of original "dir"(where your facing when you started the attack). It does not use the offsets for other directions #SET_BOUNDS().
It pretty much just rotates N/S/E/W like a normal icon only it ignores the bound offsets that are supposed to happen.
To solve your bounding issue, it would help if SET_BOUNDS() received the correct information relating to the player.