Merge branch 'bugfix' into 'Bleeding-Edge'

Fixing a hookshot bug, and adding attack logs

* Fixed a bug that would make hookshots unable to fire, and their projectile chain to remain on the ground.
* Using the hookshot on a mob now creates attack logs.
* Fixed a bug that would allow hookshots to let players clip through walls.

See merge request !144
This commit is contained in:
Clusterfack
2015-08-25 23:55:22 +00:00
5 changed files with 78 additions and 13 deletions

View File

@@ -1649,7 +1649,7 @@
for(var/obj/item/hand in handlist)
if(prob(current_size*5) && hand.w_class >= ((11-current_size)/2) && u_equip(hand,1))
step_towards(hand, src)
src << "<span class = 'warning'>The [S] pulls \the [hand] from your grip!</span>"
src << "<span class = 'warning'>\The [S] pulls \the [hand] from your grip!</span>"
if(radiations)
apply_effect(current_size * radiations, IRRADIATE)
if(shoes)

View File

@@ -705,11 +705,11 @@ Thanks.
for(var/i = 1;i<hookshot.maxlength;i++)
var/obj/effect/overlay/hookchain/HC = hookshot.links["[i]"]
if(HC.loc != hookshot)
HC.forceMove(get_step(HC,direct),direct)
HC.Move(get_step(HC,direct),direct)
if(hookshot.hook)
var/obj/item/projectile/hookshot/hook = hookshot.hook
hook.forceMove(get_step(hook,direct),direct)
hook.Move(get_step(hook,direct),direct)
if(direct & NORTH)
hook.override_starting_Y++
hook.override_target_Y++

View File

@@ -20,6 +20,7 @@
var/clockwerk = 0 //clockwerk means "pulling yourself to the target".
var/mob/living/carbon/firer = null
var/atom/movable/extremity = null
var/panic = 0 //set to 1 by a part of the hookchain that got destroyed.
/obj/item/weapon/gun/hookshot/update_icon()
if(hook || chain_datum)
@@ -36,11 +37,17 @@
..()
for(var/i = 0;i <= maxlength; i++)
var/obj/effect/overlay/hookchain/HC = new(src)
HC.shot_from = src
links["[i]"] = HC
/obj/item/weapon/gun/hookshot/Destroy()//if a single link of the chain is destroyed, the rest of the chain is instantly destroyed as well.
if(chain_datum)
chain_datum.Delete_Chain()
for(var/i = 0;i <= maxlength; i++)
var/obj/effect/overlay/hookchain/HC = links["[i]"]
qdel(HC)
links["[i]"] = null
..()
/obj/item/weapon/gun/hookshot/attack_self(mob/user)//clicking on the hookshot while tethered rewinds the chain without pulling the target.
@@ -54,6 +61,18 @@
/obj/item/weapon/gun/hookshot/process_chambered()
if(in_chamber)
return 1
if(panic)//if a part of the chain got deleted, we recreate it.
for(var/i = 0;i <= maxlength; i++)
var/obj/effect/overlay/hookchain/HC = links["[i]"]
if(!HC)
HC = new(src)
HC.shot_from = src
links["[i]"] = HC
else
HC.loc = src
panic = 0
if(!hook && !rewinding && !clockwerk && !check_tether())//if there is no projectile already, and we aren't currently rewinding the chain, or reeling in toward a target,
hook = new/obj/item/projectile/hookshot(src) //and that the hookshot isn't currently sustaining a tether, then we can fire.
in_chamber = hook
@@ -78,6 +97,9 @@
..()
/obj/item/weapon/gun/hookshot/dropped(mob/user as mob)
if(!clockwerk && !rewinding)
rewind_chain()
if(user.tether)
var/datum/chain/tether_datum = user.tether.chain_datum
if(tether_datum == chain_datum)
@@ -124,22 +146,35 @@
return
rewinding = 1
for(var/j = 1; j <= maxlength; j++)
var/pause = 0
for(var/i = maxlength; i > 0; i--)
var/obj/effect/overlay/hookchain/HC = links["[i]"]
if(!HC)
cancel_chain()
return
if(HC.loc == src)
continue
pause = 1
var/obj/effect/overlay/hookchain/HC0 = links["[i-1]"]
if(!HC0)
cancel_chain()
return
HC.loc = HC0.loc
HC.pixel_x = HC0.pixel_x
HC.pixel_y = HC0.pixel_y
sleep(1)
sleep(pause)
rewinding = 0
update_icon()
/obj/item/weapon/gun/hookshot/proc/cancel_chain()//instantly delete the links
/obj/item/weapon/gun/hookshot/proc/cancel_chain()//instantly sends all the links back into the hookshot. replaces those that got destroyed.
for(var/j = 1; j <= maxlength; j++)
var/obj/effect/overlay/hookchain/HC = links["[j]"]
HC.loc = src
if(HC)
HC.loc = src
else
HC = new(src)
HC.shot_from = src
links["[j]"] = HC
rewinding = 0
clockwerk = 0
update_icon()
@@ -252,6 +287,21 @@
Delete_Chain()
//THE CHAIN THAT APPEARS WHEN YOU FIRE THE HOOKSHOT
/obj/effect/overlay/hookchain
name = "hookshot"
icon = 'icons/obj/projectiles_experimental.dmi'
icon_state = "hookshot_chain"
animate_movement = 0
var/obj/item/weapon/gun/hookshot/shot_from = null
/obj/effect/overlay/hookchain/Destroy()
if(shot_from)
shot_from.panic = 1
shot_from = null
..()
//THE CHAIN THAT TETHERS STUFF TOGETHER
/obj/effect/overlay/chain
name = "chain"
icon = 'icons/obj/chain.dmi'

View File

@@ -1,5 +1,5 @@
/obj/item/projectile/hookshot
name = "hookshot"
name = "hook"
icon = 'icons/obj/projectiles_experimental.dmi'
icon_state = "hookshot"
damage = 0
@@ -71,6 +71,14 @@
OnDeath()
returnToPool(src)
/obj/item/projectile/hookshot/Destroy()
var/obj/item/weapon/gun/hookshot/hookshot = shot_from
if(hookshot)
if(!hookshot.clockwerk && !hookshot.rewinding)
hookshot.rewind_chain()
hookshot.hook = null
..()
/obj/item/projectile/hookshot/Bump(atom/A as mob|obj|turf|area)
if(bumped) return 0
bumped = 1
@@ -123,15 +131,16 @@
else
C.extremity_A = chain_datum.links["[i-1]"]
C.extremity_B = chain_datum.links["[i+1]"]
if(istype(firer, /mob) && isliving(AM))
var/mob/living/L = AM
log_attack("<font color='red'>[key_name(firer)] hooked [key_name(L)] with a [type]</font>")
L.attack_log += "\[[time_stamp()]\] <b>[key_name(firer)]</b> hooked <b>[key_name(L)]</b> with a <b>[type]</b>"
firer.attack_log += "\[[time_stamp()]\] <b>[key_name(firer)]</b> hooked <b>[key_name(L)]</b> with a <b>[type]</b>"
hookshot.cancel_chain() //then we remove the chain laid by the projectile
else
hookshot.rewind_chain()
else
hookshot.rewind_chain() //hit something that we can neither pull ourselves to nor drag to us? Just retract the chain.
bullet_die()
/obj/effect/overlay/hookchain
name = "hookshot"
icon = 'icons/obj/projectiles_experimental.dmi'
icon_state = "hookshot_chain"
animate_movement = 0