mirror of
https://github.com/Bubberstation/Bubberstation.git
synced 2026-08-29 08:08:49 +01:00
Bugfixen
Modifies Adjacent() for items, to allow items to be accessed properly inside each other and the user. This fixes a few bugs seen in testing. Sets a maximum telekinesis range (in case you were using cameras). The telekinetic grab now does nothing at all in melee combat. This prevents double messages where you attack them with the object telekinetically, and then also attack them with the telekinetic grab. Crayons had a bug where they were drawing at all distances. This is because in old click code, afterattack() only happened at range when you had the USE_DELAY flag, which is no longer true. Proper behavior is to use parameter 3 (proximity_flag), which is 1 when adjacent or 0 if inaccessible.
This commit is contained in:
@@ -61,12 +61,22 @@
|
||||
This is not used in stock /tg/station currently.
|
||||
*/
|
||||
/atom/movable/Adjacent(var/atom/neighbor)
|
||||
if(neighbor == loc) return 1
|
||||
if(!isturf(loc)) return 0
|
||||
for(var/turf/T in locs)
|
||||
if(isnull(T)) continue
|
||||
if(T.Adjacent(neighbor,src)) return 1
|
||||
return 0
|
||||
|
||||
// This is necessary for storage items not on your person.
|
||||
/obj/item/Adjacent(var/atom/neighbor, var/recurse = 1)
|
||||
if(neighbor == loc) return 1
|
||||
if(istype(loc,/obj/item))
|
||||
if(recurse > 0)
|
||||
return loc.Adjacent(neighbor,recurse - 1)
|
||||
return 0
|
||||
return ..()
|
||||
|
||||
/*
|
||||
This checks if you there is uninterrupted airspace between that turf and this one.
|
||||
This is defined as any dense ON_BORDER object, or any dense object without throwpass.
|
||||
|
||||
@@ -153,13 +153,13 @@
|
||||
// Return 1 in attackby() to prevent afterattack() effects (when safely moving items for example)
|
||||
var/resolved = A.attackby(W,src)
|
||||
if(!resolved && A && W)
|
||||
W.afterattack(A,src,1,params)
|
||||
W.afterattack(A,src,1,params) // 1: clicking something Adjacent
|
||||
else
|
||||
UnarmedAttack(A)
|
||||
return
|
||||
else // non-adjacent click
|
||||
if(W)
|
||||
W.afterattack(A,src,0,params)
|
||||
W.afterattack(A,src,0,params) // 0: not Adjacent
|
||||
else
|
||||
if((LASER in mutations) && a_intent == "harm")
|
||||
LaserEyes(A) // moved into a proc below
|
||||
@@ -169,8 +169,10 @@
|
||||
next_move += 2
|
||||
if(5 to 7)
|
||||
next_move += 5
|
||||
if(8 to 1024)
|
||||
if(8 to 15)
|
||||
next_move += 10
|
||||
if(16 to 128)
|
||||
return
|
||||
A.attack_tk(src)
|
||||
|
||||
return
|
||||
|
||||
@@ -17,7 +17,7 @@
|
||||
|
||||
// Proximity_flag is 1 if this afterattack was called on something adjacent, in your square, or on your person.
|
||||
// Click parameters is the params string from byond Click() code, see that documentation.
|
||||
/obj/item/proc/afterattack(atom/target,mob/user,proximity_flag,click_parameters)
|
||||
/obj/item/proc/afterattack(atom/target, mob/user, proximity_flag, click_parameters)
|
||||
return
|
||||
|
||||
|
||||
|
||||
@@ -109,11 +109,7 @@
|
||||
return
|
||||
|
||||
attack(mob/living/M as mob, mob/living/user as mob, def_zone)
|
||||
if(focus && focus.Adjacent(M))
|
||||
if(istype(focus,/obj/item))
|
||||
var/obj/item/I = focus
|
||||
I.attack(M,user,def_zone)
|
||||
return
|
||||
return
|
||||
|
||||
|
||||
proc/focus_object(var/obj/target, var/mob/living/user)
|
||||
|
||||
@@ -65,7 +65,8 @@
|
||||
shadeColour = input(user, "Please select the shade colour.", "Crayon colour") as color
|
||||
return
|
||||
|
||||
/obj/item/toy/crayon/afterattack(atom/target, mob/user as mob)
|
||||
/obj/item/toy/crayon/afterattack(atom/target, mob/user as mob, flag)
|
||||
if(!flag) return
|
||||
if(istype(target,/turf/simulated/floor))
|
||||
var/drawtype = input("Choose what you'd like to draw.", "Crayon scribbles") in list("graffiti","rune","letter")
|
||||
switch(drawtype)
|
||||
|
||||
Reference in New Issue
Block a user