mirror of
https://github.com/VOREStation/VOREStation.git
synced 2026-07-20 03:26:37 +01:00
Refactors various item attack() implementations
Replaced some attack() overrides with apply_hit_effect() or other attack procs where appropriate. Removed the attack() override from reagent_containers.
This commit is contained in:
@@ -263,9 +263,6 @@
|
||||
return 1
|
||||
return 0
|
||||
|
||||
/obj/item/weapon/holo/esword/attack(target as mob, mob/user as mob)
|
||||
..()
|
||||
|
||||
/obj/item/weapon/holo/esword/New()
|
||||
item_color = pick("red","blue","green","purple")
|
||||
|
||||
|
||||
@@ -234,49 +234,22 @@
|
||||
return
|
||||
..()
|
||||
|
||||
/obj/item/weapon/reagent_containers/food/snacks/grown/attack(var/mob/living/carbon/M, var/mob/user, var/def_zone)
|
||||
if(user == M)
|
||||
return ..()
|
||||
|
||||
if(user.a_intent == I_HURT)
|
||||
|
||||
if(!istype(M))
|
||||
return 0
|
||||
if(!force || (flags & NOBLUDGEON))
|
||||
return 0
|
||||
|
||||
/////////////////////////
|
||||
user.lastattacked = M
|
||||
M.lastattacker = user
|
||||
|
||||
if(!no_attack_log)
|
||||
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>"
|
||||
msg_admin_attack("[key_name(user)] attacked [key_name(M)] with [name] (INTENT: [uppertext(user.a_intent)]) (DAMTYE: [uppertext(damtype)])" )
|
||||
/////////////////////////
|
||||
|
||||
user.do_attack_animation(M)
|
||||
M.attacked_with_item(src, user, def_zone)
|
||||
|
||||
if(seed && seed.get_trait(TRAIT_STINGS))
|
||||
if(!reagents || reagents.total_volume <= 0)
|
||||
return
|
||||
reagents.remove_any(rand(1,3))
|
||||
seed.thrown_at(src,M)
|
||||
sleep(-1)
|
||||
if(!src)
|
||||
return
|
||||
if(prob(35))
|
||||
if(user)
|
||||
user << "<span class='danger'>\The [src] has fallen to bits.</span>"
|
||||
user.drop_from_inventory(src)
|
||||
qdel(src)
|
||||
|
||||
add_fingerprint(user)
|
||||
return 1
|
||||
|
||||
else
|
||||
..()
|
||||
/obj/item/weapon/reagent_containers/food/snacks/grown/apply_hit_effect(mob/living/target, mob/living/user, var/hit_zone)
|
||||
..()
|
||||
|
||||
if(seed && seed.get_trait(TRAIT_STINGS))
|
||||
if(!reagents || reagents.total_volume <= 0)
|
||||
return
|
||||
reagents.remove_any(rand(1,3))
|
||||
seed.thrown_at(src, target)
|
||||
sleep(-1)
|
||||
if(!src)
|
||||
return
|
||||
if(prob(35))
|
||||
if(user)
|
||||
user << "<span class='danger'>\The [src] has fallen to bits.</span>"
|
||||
user.drop_from_inventory(src)
|
||||
qdel(src)
|
||||
|
||||
/obj/item/weapon/reagent_containers/food/snacks/grown/attack_self(mob/user as mob)
|
||||
|
||||
|
||||
@@ -48,20 +48,6 @@
|
||||
toxicity = 8
|
||||
pest_kill_str = 7
|
||||
|
||||
/obj/item/weapon/material/minihoe // -- Numbers
|
||||
name = "mini hoe"
|
||||
desc = "It's used for removing weeds or scratching your back."
|
||||
icon = 'icons/obj/weapons.dmi'
|
||||
icon_state = "hoe"
|
||||
item_state = "hoe"
|
||||
flags = CONDUCT | NOBLUDGEON
|
||||
force = 5.0
|
||||
throwforce = 7.0
|
||||
w_class = 2.0
|
||||
matter = list(DEFAULT_WALL_MATERIAL = 50)
|
||||
attack_verb = list("slashed", "sliced", "cut", "clawed")
|
||||
|
||||
|
||||
// *************************************
|
||||
// Weedkiller defines for hydroponics
|
||||
// *************************************
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
|
||||
//Called when the mob is hit with an item in combat.
|
||||
/mob/living/carbon/hit_with_weapon(obj/item/I, mob/living/user, var/effective_force, var/hit_zone)
|
||||
/mob/living/carbon/resolve_item_attack(obj/item/I, mob/living/user, var/effective_force, var/hit_zone)
|
||||
if(check_attack_throat(I, user))
|
||||
return
|
||||
return null
|
||||
..()
|
||||
|
||||
/mob/living/carbon/standard_weapon_hit_effects(obj/item/I, mob/living/user, var/effective_force, var/blocked, var/hit_zone)
|
||||
|
||||
@@ -145,30 +145,28 @@ emp_act
|
||||
O.emp_act(severity)
|
||||
..()
|
||||
|
||||
/mob/living/carbon/human/attacked_with_item(obj/item/I, mob/living/user, var/target_zone)
|
||||
if(!I || !user)
|
||||
return
|
||||
/mob/living/carbon/human/resolve_item_attack(obj/item/I, mob/living/user, var/target_zone)
|
||||
if(check_attack_throat(I, user))
|
||||
return null
|
||||
|
||||
if(check_attack_throat(I, user))
|
||||
return
|
||||
|
||||
var/hit_zone = target_zone
|
||||
if(user != src) // Attacking yourself can't miss
|
||||
hit_zone = get_zone_with_miss_chance(target_zone, src)
|
||||
if(user == src) // Attacking yourself can't miss
|
||||
return target_zone
|
||||
|
||||
var/hit_zone = get_zone_with_miss_chance(target_zone, src)
|
||||
|
||||
if(!hit_zone)
|
||||
visible_message("<span class='danger'>\The [user] misses [src] with \the [I]!</span>")
|
||||
return
|
||||
|
||||
return null
|
||||
|
||||
if(check_shields(I.force, I, user, target_zone, "the [I.name]"))
|
||||
return
|
||||
|
||||
|
||||
var/obj/item/organ/external/affecting = get_organ(hit_zone)
|
||||
if (!affecting || (affecting.status & ORGAN_DESTROYED) || affecting.is_stump())
|
||||
user << "<span class='danger'>They are missing that limb!</span>"
|
||||
return
|
||||
return null
|
||||
|
||||
I.apply_hit_effect(src, user, target_zone)
|
||||
return hit_zone
|
||||
|
||||
/mob/living/carbon/human/hit_with_weapon(obj/item/I, mob/living/user, var/effective_force, var/hit_zone)
|
||||
var/obj/item/organ/external/affecting = get_organ(hit_zone)
|
||||
|
||||
@@ -32,10 +32,11 @@ var/const/MAX_ACTIVE_TIME = 400
|
||||
|
||||
..()
|
||||
|
||||
/obj/item/clothing/mask/facehugger/attack(mob/living/M as mob, mob/user as mob)
|
||||
/obj/item/clothing/mask/facehugger/apply_hit_effect(mob/living/target, mob/living/user, var/hit_zone)
|
||||
..()
|
||||
user.drop_from_inventory(src)
|
||||
Attach(M)
|
||||
if(hit_zone == "head")
|
||||
Attach(target)
|
||||
|
||||
/obj/item/clothing/mask/facehugger/New()
|
||||
if(config.aliens_allowed)
|
||||
|
||||
@@ -111,9 +111,33 @@
|
||||
O.emp_act(severity)
|
||||
..()
|
||||
|
||||
/*
|
||||
//Whereas attackby() handles the general case of using items on mobs, this handles the specific case of attacking a mob with an item as a weapon.
|
||||
/mob/living/proc/attacked_with_item(obj/item/I, mob/living/user, var/target_zone)
|
||||
I.apply_hit_effect(src, user, target_zone)
|
||||
if(!istype(user))
|
||||
return 0
|
||||
|
||||
/////////////////////////
|
||||
user.lastattacked = M
|
||||
M.lastattacker = user
|
||||
|
||||
if(!no_attack_log)
|
||||
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>"
|
||||
msg_admin_attack("[key_name(user)] attacked [key_name(M)] with [name] (INTENT: [uppertext(user.a_intent)]) (DAMTYE: [uppertext(damtype)])" )
|
||||
/////////////////////////
|
||||
|
||||
user.do_attack_animation(M)
|
||||
|
||||
var/hit_zone = resolve_hit_zone(I, user, target_zone)
|
||||
if(hit_zone)
|
||||
I.apply_hit_effect(src, user, hit_zone)
|
||||
|
||||
return 1
|
||||
*/
|
||||
|
||||
/mob/living/proc/resolve_item_attack(obj/item/I, mob/living/user, var/target_zone)
|
||||
return target_zone
|
||||
|
||||
//Called when the mob is hit with an item in combat.
|
||||
/mob/living/proc/hit_with_weapon(obj/item/I, mob/living/user, var/effective_force, var/hit_zone)
|
||||
@@ -121,7 +145,7 @@
|
||||
|
||||
var/blocked = run_armor_check(hit_zone, "melee")
|
||||
standard_weapon_hit_effects(I, user, effective_force, blocked, hit_zone)
|
||||
|
||||
|
||||
if(I.damtype == BRUTE && prob(33)) // Added blood for whacking non-humans too
|
||||
var/turf/simulated/location = get_turf(src)
|
||||
if(istype(location)) location.add_blood_floor(src)
|
||||
|
||||
@@ -131,8 +131,8 @@
|
||||
return 0
|
||||
|
||||
else
|
||||
attacked_with_item(O, user)
|
||||
|
||||
O.attack(src, user, user.zone_sel.selecting)
|
||||
|
||||
/mob/living/simple_animal/spiderbot/emag_act(var/remaining_charges, var/mob/user)
|
||||
if (emagged)
|
||||
user << "<span class='warning'>[src] is already overloaded - better run.</span>"
|
||||
|
||||
@@ -286,12 +286,12 @@
|
||||
if(istype(O, /obj/item/weapon/material/knife) || istype(O, /obj/item/weapon/material/knife/butch))
|
||||
harvest(user)
|
||||
else
|
||||
attacked_with_item(O, user, user.zone_sel.selecting)
|
||||
|
||||
/mob/living/simple_animal/attacked_with_item(obj/item/O, mob/living/user, var/target_zone)
|
||||
if(!O.force)
|
||||
visible_message("<span class='notice'>[user] gently taps [src] with \the [O].</span>")
|
||||
return
|
||||
if(!O.force)
|
||||
visible_message("<span class='notice'>[user] gently taps [src] with \the [O].</span>")
|
||||
else
|
||||
O.attack(src, user, user.zone_sel.selecting)
|
||||
|
||||
/mob/living/simple_animal/hit_with_weapon(obj/item/O, mob/living/user, var/effective_force, var/hit_zone)
|
||||
|
||||
if(O.force > resistance)
|
||||
var/damage = O.force
|
||||
@@ -302,10 +302,9 @@
|
||||
purge = 3
|
||||
adjustBruteLoss(damage)
|
||||
else
|
||||
usr << "<span class='danger'>This weapon is ineffective, it does no damage.</span>"
|
||||
user << "<span class='danger'>This weapon is ineffective, it does no damage.</span>"
|
||||
|
||||
visible_message("<span class='danger'>\The [src] has been attacked with \the [O] by [user].</span>")
|
||||
user.do_attack_animation(src)
|
||||
visible_message("<span class='danger'>\The [src] has been attacked with \the [O] by [user].</span>")
|
||||
|
||||
/mob/living/simple_animal/movement_delay()
|
||||
var/tally = 0 //Incase I need to add stuff other than "speed" later
|
||||
|
||||
@@ -25,11 +25,6 @@
|
||||
/obj/item/weapon/reagent_containers/attack_self(mob/user as mob)
|
||||
return
|
||||
|
||||
/obj/item/weapon/reagent_containers/attack(mob/M as mob, mob/user as mob, def_zone)
|
||||
if(can_operate(M))//Checks if mob is lying down on table for surgery
|
||||
if(do_surgery(M, user, src))
|
||||
return
|
||||
|
||||
/obj/item/weapon/reagent_containers/afterattack(obj/target, mob/user, flag)
|
||||
return
|
||||
|
||||
|
||||
Reference in New Issue
Block a user