mirror of
https://github.com/ParadiseSS13/Paradise.git
synced 2026-08-30 15:37:36 +01:00
new attack procs
minor fixes to make it compile cleans up the code
This commit is contained in:
@@ -13,51 +13,17 @@
|
||||
if(!(W.flags&NOBLUDGEON))
|
||||
visible_message("<span class='danger'>[src] has been hit by [user] with [W].</span>")
|
||||
|
||||
/obj/attackby(obj/item/I, mob/living/user, params)
|
||||
return I.attack_obj(src, user)
|
||||
|
||||
/mob/living/attackby(obj/item/I, mob/user, params)
|
||||
user.changeNext_move(CLICK_CD_MELEE)
|
||||
if(attempt_harvest(I, user))
|
||||
return
|
||||
I.attack(src, user)
|
||||
|
||||
/mob/living/proc/attacked_by(obj/item/I, mob/living/user, def_zone)
|
||||
apply_damage(I.force, I.damtype, def_zone)
|
||||
if(I.damtype == "brute")
|
||||
if(prob(33) && I.force)
|
||||
add_splatter_floor()
|
||||
|
||||
var/showname = "."
|
||||
if(user)
|
||||
showname = " by [user]!"
|
||||
user.do_attack_animation(src)
|
||||
if(!(user in viewers(src, null)))
|
||||
showname = "."
|
||||
|
||||
if(I.attack_verb && I.attack_verb.len)
|
||||
visible_message("<span class='combat danger'>[src] has been [pick(I.attack_verb)] with [I][showname]</span>",
|
||||
"<span class='userdanger'>[src] has been [pick(I.attack_verb)] with [I][showname]</span>")
|
||||
else if(I.force)
|
||||
visible_message("<span class='combat danger'>[src] has been attacked with [I][showname]</span>",
|
||||
"<span class='userdanger'>[src] has been attacked with [I][showname]</span>")
|
||||
|
||||
/mob/living/simple_animal/attacked_by(obj/item/I, mob/living/user)
|
||||
if(!I.force)
|
||||
user.visible_message("<span class='warning'>[user] gently taps [src] with [I].</span>",\
|
||||
"<span class='warning'>This weapon is ineffective, it does no damage.</span>")
|
||||
else if(I.force >= force_threshold && I.damtype != STAMINA)
|
||||
..()
|
||||
else
|
||||
visible_message("<span class='danger'>[I] bounces harmlessly off of [src].</span>",\
|
||||
"<span class='userdanger'>[I] bounces harmlessly off of [src].</span>")
|
||||
|
||||
// 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
|
||||
|
||||
return 1
|
||||
return I.attack(src, user)
|
||||
|
||||
/obj/item/proc/attack(mob/living/M, mob/living/user, def_zone)
|
||||
|
||||
if(!istype(M)) // not sure if this is the right thing...
|
||||
if(flags & (NOBLUDGEON))
|
||||
return 0
|
||||
|
||||
if(can_operate(M)) //Checks if mob is lying down on table for surgery
|
||||
@@ -85,29 +51,91 @@
|
||||
else
|
||||
return 1
|
||||
|
||||
if(hitsound && force > 0) //If an item's hitsound is defined and the item's force is greater than zero...
|
||||
playsound(loc, hitsound, get_clamped_volume(), 1, -1) //...play the item's hitsound at get_clamped_volume() with varying frequency and -1 extra range.
|
||||
else if(force == 0)//Otherwise, if the item's force is zero...
|
||||
playsound(loc, 'sound/weapons/tap.ogg', get_clamped_volume(), 1, -1)//...play tap.ogg at get_clamped_volume()
|
||||
/////////////////////////
|
||||
if(!force)
|
||||
playsound(loc, 'sound/weapons/tap.ogg', get_clamped_volume(), 1, -1)
|
||||
else if(hitsound)
|
||||
playsound(loc, hitsound, get_clamped_volume(), 1, -1)
|
||||
|
||||
user.lastattacked = M
|
||||
M.lastattacker = user
|
||||
add_logs(user, M, "attacked", name, "(INTENT: [uppertext(user.a_intent)]) (DAMTYPE: [uppertext(damtype)])", print_attack_log = (force > 0))//print it if stuff deals damage
|
||||
|
||||
if(!iscarbon(user))
|
||||
M.LAssailant = null
|
||||
else
|
||||
M.LAssailant = user
|
||||
|
||||
/////////////////////////
|
||||
|
||||
if(user != M)
|
||||
user.do_attack_animation(M)
|
||||
M.attacked_by(src, user, def_zone)
|
||||
|
||||
add_logs(user, M, "attacked", name, "(INTENT: [uppertext(user.a_intent)]) (DAMTYPE: [uppertext(damtype)])", print_attack_log = (force > 0))//print it if stuff deals damage
|
||||
add_fingerprint(user)
|
||||
return 1
|
||||
|
||||
|
||||
//the equivalent of the standard version of attack() but for object targets.
|
||||
/obj/item/proc/attack_obj(obj/O, mob/living/user)
|
||||
if(flags & (NOBLUDGEON))
|
||||
return
|
||||
user.changeNext_move(CLICK_CD_MELEE)
|
||||
user.do_attack_animation(O)
|
||||
O.attacked_by(src, user)
|
||||
|
||||
/atom/movable/proc/attacked_by()
|
||||
return
|
||||
|
||||
/obj/attacked_by(obj/item/I, mob/living/user)
|
||||
if(I.force)
|
||||
user.visible_message("<span class='danger'>[user] has hit [src] with [I]!</span>", "<span class='danger'>You hit [src] with [I]!</span>")
|
||||
|
||||
/mob/living/attacked_by(obj/item/I, mob/living/user, def_zone)
|
||||
send_item_attack_message(I, user)
|
||||
if(I.force)
|
||||
apply_damage(I.force, I.damtype, def_zone)
|
||||
if(I.damtype == BRUTE)
|
||||
if(prob(33))
|
||||
I.add_mob_blood(src)
|
||||
var/turf/location = get_turf(src)
|
||||
add_splatter_floor(location)
|
||||
if(get_dist(user, src) <= 1) //people with TK won't get smeared with blood
|
||||
user.add_mob_blood(src)
|
||||
return TRUE //successful attack
|
||||
|
||||
/mob/living/simple_animal/attacked_by(obj/item/I, mob/living/user)
|
||||
if(!I.force)
|
||||
user.visible_message("<span class='warning'>[user] gently taps [src] with [I].</span>",\
|
||||
"<span class='warning'>This weapon is ineffective, it does no damage!</span>")
|
||||
else if(I.force < force_threshold || I.damtype == STAMINA)
|
||||
visible_message("<span class='warning'>[I] bounces harmlessly off of [src].</span>",\
|
||||
"<span class='warning'>[I] bounces harmlessly off of [src]!</span>")
|
||||
else
|
||||
return ..()
|
||||
|
||||
// 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/get_clamped_volume()
|
||||
if(w_class)
|
||||
if(force)
|
||||
return Clamp((force + w_class) * 4, 30, 100)// Add the item's force to its weight class and multiply by 4, then clamp the value between 30 and 100
|
||||
else
|
||||
return Clamp(w_class * 6, 10, 100) // Multiply the item's weight class by 6, then clamp the value between 10 and 100
|
||||
return Clamp(w_class * 6, 10, 100) // Multiply the item's weight class by 6, then clamp the value between 10 and 100
|
||||
|
||||
/mob/living/proc/send_item_attack_message(obj/item/I, mob/living/user, hit_area)
|
||||
if(I.discrete)
|
||||
return
|
||||
var/message_verb = "attacked"
|
||||
if(I.attack_verb && I.attack_verb.len)
|
||||
message_verb = "[pick(I.attack_verb)]"
|
||||
else if(!I.force)
|
||||
return
|
||||
var/message_hit_area = ""
|
||||
if(hit_area)
|
||||
message_hit_area = " in the [hit_area]"
|
||||
var/attack_message = "[src] has been [message_verb][message_hit_area] with [I]."
|
||||
if(user in viewers(src, null))
|
||||
attack_message = "[src] has been [message_verb][message_hit_area] with [I] by [user]!"
|
||||
visible_message("<span class='danger'>[attack_message]</span>",
|
||||
"<span class='userdanger'>[attack_message]</span>")
|
||||
return 1
|
||||
|
||||
@@ -833,7 +833,7 @@
|
||||
else
|
||||
return attacked_by(W, user)
|
||||
|
||||
/obj/mecha/proc/attacked_by(obj/item/I, mob/user)
|
||||
/obj/mecha/attacked_by(obj/item/I, mob/user)
|
||||
log_message("Attacked by [I]. Attacker - [user]")
|
||||
user.changeNext_move(CLICK_CD_MELEE)
|
||||
user.do_attack_animation(src)
|
||||
|
||||
@@ -234,7 +234,7 @@
|
||||
W.update_icon()
|
||||
return
|
||||
|
||||
/obj/structure/grille/proc/attacked_by(obj/item/I, mob/living/user)
|
||||
/obj/structure/grille/attacked_by(obj/item/I, mob/living/user)
|
||||
user.changeNext_move(CLICK_CD_MELEE)
|
||||
user.do_attack_animation(src)
|
||||
if(!(I.flags&NOBLUDGEON))
|
||||
|
||||
@@ -141,7 +141,7 @@
|
||||
else
|
||||
attacked_by(W, user)
|
||||
|
||||
/obj/structure/mineral_door/proc/attacked_by(obj/item/I, mob/user)
|
||||
/obj/structure/mineral_door/attacked_by(obj/item/I, mob/user)
|
||||
if(I.damtype != STAMINA)
|
||||
user.changeNext_move(CLICK_CD_MELEE)
|
||||
user.do_attack_animation(src)
|
||||
|
||||
@@ -24,7 +24,7 @@
|
||||
for(var/datum/surgery/S in surgeries)
|
||||
if(S.next_step(user, src))
|
||||
return 1
|
||||
..()
|
||||
return ..()
|
||||
|
||||
/mob/living/carbon/attack_hand(mob/living/carbon/human/user)
|
||||
if(!iscarbon(user))
|
||||
|
||||
@@ -228,6 +228,3 @@
|
||||
playsound(loc, 'sound/weapons/punchmiss.ogg', 25, 1, -1)
|
||||
visible_message("<span class='danger'>[M] attempted to disarm [src]!</span>")
|
||||
return
|
||||
|
||||
/mob/living/carbon/human/proc/afterattack(atom/target as mob|obj|turf|area, mob/living/user as mob|obj, inrange, params)
|
||||
return
|
||||
|
||||
@@ -215,15 +215,10 @@ emp_act
|
||||
if(istype(I,/obj/item/weapon/card/emag))
|
||||
emag_act(user, affecting)
|
||||
|
||||
if(!I.discrete)
|
||||
if(I.attack_verb && I.attack_verb.len)
|
||||
visible_message("<span class='combat danger'>[src] has been [pick(I.attack_verb)] in the [hit_area] with [I] by [user]!</span>",
|
||||
"<span class='combat userdanger'>[src] has been [pick(I.attack_verb)] in the [hit_area] with [I] by [user]!</span>"))
|
||||
else if(I.force)
|
||||
visible_message("<span class='combat danger'>[src] has been attacked in the [hit_area] with [I] by [user]!</span>",
|
||||
"<span class='combat userdanger'>[src] has been attacked in the [hit_area] with [I] by [user]!</span>"))
|
||||
else
|
||||
return 0
|
||||
send_item_attack_message(I, user, hit_area)
|
||||
|
||||
if(!I.force)
|
||||
return 0 //item force is zero
|
||||
|
||||
var/armor = run_armor_check(affecting, "melee", "<span class='warning'>Your armour has protected your [hit_area].</span>", "<span class='warning'>Your armour has softened hit to your [hit_area].</span>", armour_penetration = I.armour_penetration)
|
||||
var/weapon_sharp = is_sharp(I)
|
||||
|
||||
@@ -567,10 +567,7 @@ var/list/robot_verbs_default = list(
|
||||
return 2
|
||||
|
||||
|
||||
/mob/living/silicon/robot/attackby(obj/item/weapon/W as obj, mob/user as mob, params)
|
||||
if(istype(W, /obj/item/weapon/restraints/handcuffs)) // fuck i don't even know why isrobot() in handcuff code isn't working so this will have to do
|
||||
return
|
||||
|
||||
/mob/living/silicon/robot/attackby(obj/item/weapon/W, mob/user, params)
|
||||
if(opened) // Are they trying to insert something?
|
||||
for(var/V in components)
|
||||
var/datum/robot_component/C = components[V]
|
||||
@@ -610,6 +607,7 @@ var/list/robot_verbs_default = list(
|
||||
|
||||
|
||||
else if(istype(W, /obj/item/stack/cable_coil) && user.a_intent == INTENT_HELP && (wiresexposed || istype(src,/mob/living/silicon/robot/drone)))
|
||||
user.changeNext_move(CLICK_CD_MELEE)
|
||||
if(!getFireLoss())
|
||||
to_chat(user, "<span class='notice'>Nothing to fix!</span>")
|
||||
return
|
||||
@@ -744,9 +742,13 @@ var/list/robot_verbs_default = list(
|
||||
to_chat(user, "<span class='danger'>Upgrade error.</span>")
|
||||
|
||||
else
|
||||
spark_system.start()
|
||||
return ..()
|
||||
|
||||
/mob/living/silicon/robot/attacked_by(obj/item/I, mob/living/user, def_zone)
|
||||
if(I.force && I.damtype != STAMINA && stat != DEAD) //only sparks if real damage is dealt.
|
||||
spark_system.start()
|
||||
..()
|
||||
|
||||
/mob/living/silicon/robot/emag_act(user as mob)
|
||||
if(!ishuman(user) && !issilicon(user))
|
||||
return
|
||||
|
||||
@@ -221,8 +221,9 @@
|
||||
update_controls()
|
||||
return
|
||||
|
||||
/mob/living/simple_animal/bot/medbot/attackby(obj/item/weapon/W as obj, mob/user as mob, params)
|
||||
/mob/living/simple_animal/bot/medbot/attackby(obj/item/weapon/W, mob/user, params)
|
||||
if(istype(W, /obj/item/weapon/reagent_containers/glass))
|
||||
. = 1 //no afterattack
|
||||
if(locked)
|
||||
to_chat(user, "<span class='warning'>You cannot insert a beaker because the panel is locked!</span>")
|
||||
return
|
||||
@@ -236,7 +237,6 @@
|
||||
reagent_glass = W
|
||||
to_chat(user, "<span class='notice'>You insert [W].</span>")
|
||||
show_controls(user)
|
||||
return
|
||||
|
||||
else
|
||||
var/current_health = health
|
||||
|
||||
@@ -382,7 +382,7 @@
|
||||
|
||||
return
|
||||
|
||||
/mob/living/simple_animal/attackby(var/obj/item/O as obj, var/mob/living/user as mob) //Marker -Agouri
|
||||
/mob/living/simple_animal/attackby(obj/item/O, mob/living/user)
|
||||
if(can_collar && !collar && istype(O, /obj/item/clothing/accessory/petcollar))
|
||||
var/obj/item/clothing/accessory/petcollar/C = O
|
||||
user.drop_item()
|
||||
@@ -396,34 +396,7 @@
|
||||
real_name = C.tagname
|
||||
return
|
||||
else
|
||||
user.changeNext_move(CLICK_CD_MELEE)
|
||||
if(attempt_harvest(O, user))
|
||||
return
|
||||
user.do_attack_animation(src)
|
||||
if(istype(O) && istype(user) && !O.attack(src, user))
|
||||
var/damage = 0
|
||||
if(O.force)
|
||||
if(O.force >= force_threshold)
|
||||
damage = O.force
|
||||
if(O.damtype == STAMINA)
|
||||
damage = 0
|
||||
if(O.damtype == BRUTE)
|
||||
if(prob(33))
|
||||
O.add_mob_blood(src)
|
||||
var/turf/location = get_turf(src)
|
||||
add_splatter_floor(location)
|
||||
if(get_dist(user, src) <= 1) //people with TK won't get smeared with blood
|
||||
user.add_mob_blood(src)
|
||||
visible_message("<span class='danger'>[user] has [O.attack_verb.len ? "[pick(O.attack_verb)]": "attacked"] [src] with [O]!</span>",\
|
||||
"<span class='userdanger'>[user] has [O.attack_verb.len ? "[pick(O.attack_verb)]": "attacked"] you with [O]!</span>")
|
||||
else
|
||||
visible_message("<span class='danger'>[O] bounces harmlessly off of [src].</span>",\
|
||||
"<span class='userdanger'>[O] bounces harmlessly off of [src].</span>")
|
||||
playsound(loc, O.hitsound, 50, 1, -1)
|
||||
else
|
||||
user.visible_message("<span class='warning'>[user] gently taps [src] with [O].</span>",\
|
||||
"<span class='warning'>This weapon is ineffective, it does no damage.</span>")
|
||||
adjustBruteLoss(damage)
|
||||
..()
|
||||
|
||||
/mob/living/simple_animal/movement_delay()
|
||||
. = ..()
|
||||
|
||||
Reference in New Issue
Block a user