mirror of
https://github.com/Bubberstation/Bubberstation.git
synced 2025-12-31 20:11:56 +00:00
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.
162 lines
4.4 KiB
Plaintext
162 lines
4.4 KiB
Plaintext
|
|
// Called when the item is in the active hand, and clicked; alternately, there is an 'activate held object' verb or you can hit pagedown.
|
|
/obj/item/proc/attack_self(mob/user)
|
|
return
|
|
|
|
// No comment
|
|
/atom/proc/attackby(obj/item/W, mob/user)
|
|
return
|
|
/atom/movable/attackby(obj/item/W, mob/user)
|
|
if(!(W.flags&NOBLUDGEON))
|
|
visible_message("<span class='danger'>[src] has been hit by [user] with [W].</span>")
|
|
|
|
/mob/living/attackby(obj/item/I, mob/user)
|
|
if(istype(I) && ismob(user))
|
|
I.attack(src, user)
|
|
|
|
|
|
// 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)
|
|
return
|
|
|
|
|
|
/obj/item/proc/attack(mob/living/M as mob, mob/living/user as mob, def_zone)
|
|
|
|
if (!istype(M)) // not sure if this is the right thing...
|
|
return
|
|
var/messagesource = M
|
|
|
|
if (istype(M,/mob/living/carbon/brain))
|
|
messagesource = M:container
|
|
if (hitsound)
|
|
playsound(loc, hitsound, 50, 1, -1)
|
|
/////////////////////////
|
|
user.lastattacked = M
|
|
M.lastattacker = user
|
|
|
|
user.attack_log += "\[[time_stamp()]\]<font color='red'> Attacked [M.name] ([M.ckey]) with [name] (INTENT: [uppertext(user.a_intent)]) (DAMTYE: [uppertext(damtype)])</font>"
|
|
M.attack_log += "\[[time_stamp()]\]<font color='orange'> Attacked by [user.name] ([user.ckey]) with [name] (INTENT: [uppertext(user.a_intent)]) (DAMTYE: [uppertext(damtype)])</font>"
|
|
log_attack("<font color='red'>[user.name] ([user.ckey]) attacked [M.name] ([M.ckey]) with [name] (INTENT: [uppertext(user.a_intent)]) (DAMTYE: [uppertext(damtype)])</font>" )
|
|
|
|
//spawn(1800) // this wont work right
|
|
// M.lastattacker = null
|
|
/////////////////////////
|
|
|
|
var/power = force
|
|
if(HULK in user.mutations)
|
|
power *= 2
|
|
|
|
if(!istype(M, /mob/living/carbon/human))
|
|
if(istype(M, /mob/living/carbon/slime))
|
|
var/mob/living/carbon/slime/slime = M
|
|
if(prob(25))
|
|
user << "\red [src] passes right through [M]!"
|
|
return
|
|
|
|
if(power > 0)
|
|
slime.attacked += 10
|
|
|
|
if(slime.Discipline && prob(50)) // wow, buddy, why am I getting attacked??
|
|
slime.Discipline = 0
|
|
|
|
if(power >= 3)
|
|
if(istype(slime, /mob/living/carbon/slime/adult))
|
|
if(prob(5 + round(power/2)))
|
|
|
|
if(slime.Victim)
|
|
if(prob(80) && !slime.client)
|
|
slime.Discipline++
|
|
slime.Victim = null
|
|
slime.anchored = 0
|
|
|
|
spawn()
|
|
if(slime)
|
|
slime.SStun = 1
|
|
sleep(rand(5,20))
|
|
if(slime)
|
|
slime.SStun = 0
|
|
|
|
spawn(0)
|
|
if(slime)
|
|
slime.canmove = 0
|
|
step_away(slime, user)
|
|
if(prob(25 + power))
|
|
sleep(2)
|
|
if(slime && user)
|
|
step_away(slime, user)
|
|
slime.canmove = 1
|
|
|
|
else
|
|
if(prob(10 + power*2))
|
|
if(slime)
|
|
if(slime.Victim)
|
|
if(prob(80) && !slime.client)
|
|
slime.Discipline++
|
|
|
|
if(slime.Discipline == 1)
|
|
slime.attacked = 0
|
|
|
|
spawn()
|
|
if(slime)
|
|
slime.SStun = 1
|
|
sleep(rand(5,20))
|
|
if(slime)
|
|
slime.SStun = 0
|
|
|
|
slime.Victim = null
|
|
slime.anchored = 0
|
|
|
|
|
|
spawn(0)
|
|
if(slime && user)
|
|
step_away(slime, user)
|
|
slime.canmove = 0
|
|
if(prob(25 + power*4))
|
|
sleep(2)
|
|
if(slime && user)
|
|
step_away(slime, user)
|
|
slime.canmove = 1
|
|
|
|
|
|
var/showname = "."
|
|
if(user)
|
|
showname = " by [user]."
|
|
if(!(user in viewers(M, null)))
|
|
showname = "."
|
|
|
|
for(var/mob/O in viewers(messagesource, null))
|
|
if(attack_verb.len)
|
|
O.show_message("\red <B>[M] has been [pick(attack_verb)] with [src][showname] </B>", 1)
|
|
else
|
|
O.show_message("\red <B>[M] has been attacked with [src][showname] </B>", 1)
|
|
|
|
if(!showname && user)
|
|
if(user.client)
|
|
user << "\red <B>You attack [M] with [src]. </B>"
|
|
|
|
|
|
|
|
if(istype(M, /mob/living/carbon/human))
|
|
M:attacked_by(src, user, def_zone)
|
|
else
|
|
switch(damtype)
|
|
if("brute")
|
|
if(istype(src, /mob/living/carbon/slime))
|
|
M.adjustBrainLoss(power)
|
|
|
|
else
|
|
|
|
M.take_organ_damage(power)
|
|
if (prob(33)) // Added blood for whacking non-humans too
|
|
var/turf/location = M.loc
|
|
if (istype(location, /turf/simulated))
|
|
location.add_blood_floor(M)
|
|
if("fire")
|
|
if (!(COLD_RESISTANCE in M.mutations))
|
|
M.take_organ_damage(0, power)
|
|
M << "Aargh it burns!"
|
|
M.updatehealth()
|
|
add_fingerprint(user)
|
|
return 1
|