Interaction/Attack Hand Refactor (#36405)

This commit is contained in:
kevinz000
2018-03-23 11:20:54 +01:00
committed by AnturK
parent 80f6e451fc
commit f300a5c155
347 changed files with 1483 additions and 1186 deletions
@@ -68,6 +68,7 @@ GLOBAL_VAR(posibrain_notify_cooldown)
else
visible_message(fail_message)
//ATTACK GHOST IGNORING PARENT RETURN VALUE
/obj/item/device/mmi/posibrain/attack_ghost(mob/user)
activate(user)
@@ -53,14 +53,14 @@
return O.attack_obj(src, user)
/obj/item/clothing/mask/facehugger/attack_alien(mob/user) //can be picked up by aliens
attack_hand(user)
return
return attack_hand(user)
//ATTACK HAND IGNORING PARENT RETURN VALUE
/obj/item/clothing/mask/facehugger/attack_hand(mob/user)
if((stat == CONSCIOUS && !sterile) && !isalien(user))
if(Leap(user))
return
..()
. = ..()
/obj/item/clothing/mask/facehugger/attack(mob/living/M, mob/user)
..()
@@ -108,6 +108,7 @@
/mob/living/carbon/attack_drone(mob/living/simple_animal/drone/user)
return //so we don't call the carbon's attack_hand().
//ATTACK HAND IGNORING PARENT RETURN VALUE
/mob/living/carbon/attack_hand(mob/living/carbon/human/user)
for(var/thing in diseases)
+4
View File
@@ -319,6 +319,10 @@
if(C)
C.post_status("shuttle")
/mob/living/silicon/ai/can_interact_with(atom/A)
. = ..()
return . || (istype(loc, /obj/item/device/aicard))? (ISINRANGE(A.x, x - interaction_range, x + interaction_range) && ISINRANGE(A.y, y - interaction_range, y + interaction_range)): GLOB.cameranet.checkTurfVis(get_turf(A))
/mob/living/silicon/ai/cancel_camera()
view_core()
@@ -90,8 +90,6 @@
/obj/item/clothing/head/sombrero,
/obj/item/clothing/head/witchunter_hat)
var/remote_range = 7 //How far can you interact with machines.
can_buckle = TRUE
buckle_lying = FALSE
var/static/list/can_ride_typecache = typecacheof(/mob/living/carbon/human)
@@ -190,6 +188,9 @@
cell = null
return ..()
/mob/living/silicon/robot/can_interact_with(atom/A)
. = ..()
return . || in_view_range(src, A)
/mob/living/silicon/robot/proc/pick_module()
if(module.type != /obj/item/robot_module)
@@ -351,6 +352,9 @@
queueAlarm("--- [class] alarm in [A.name] has been cleared.", class, 0)
return !cleared
/mob/living/silicon/robot/can_interact_with(atom/A)
return !low_power_mode && ISINRANGE(A.x, x - interaction_range, x + interaction_range) && ISINRANGE(A.y, y - interaction_range, y + interaction_range)
/mob/living/silicon/robot/attackby(obj/item/W, mob/user, params)
if(istype(W, /obj/item/weldingtool) && (user.a_intent != INTENT_HARM || user == src))
user.changeNext_move(CLICK_CD_MELEE)
@@ -52,6 +52,7 @@
return
//ATTACK HAND IGNORING PARENT RETURN VALUE
/mob/living/silicon/robot/attack_hand(mob/living/carbon/human/user)
add_fingerprint(user)
if(opened && !wiresexposed && !issilicon(user))
+7 -6
View File
@@ -40,6 +40,7 @@
var/updating = FALSE //portable camera camerachunk update
var/hack_software = FALSE //Will be able to use hacking actions
var/interaction_range = 7 //wireless control range
/mob/living/silicon/Initialize()
. = ..()
@@ -152,17 +153,17 @@
/mob/living/silicon/can_inject(mob/user, error_msg)
if(error_msg)
to_chat(user, "<span class='alert'>Their outer shell is too tough.</span>")
return 0
return FALSE
/mob/living/silicon/IsAdvancedToolUser()
return 1
return TRUE
/proc/islinked(mob/living/silicon/robot/bot, mob/living/silicon/ai/ai)
if(!istype(bot) || !istype(ai))
return 0
if (bot.connected_ai == ai)
return 1
return 0
return FALSE
if(bot.connected_ai == ai)
return TRUE
return FALSE
/mob/living/silicon/Topic(href, href_list)
if (href_list["lawc"]) // Toggling whether or not a law gets stated by the State Laws verb --NeoFite
@@ -63,6 +63,7 @@
return 1
return 0
//ATTACK HAND IGNORING PARENT RETURN VALUE
/mob/living/silicon/attack_hand(mob/living/carbon/human/M)
switch(M.a_intent)
if ("help")
@@ -234,8 +234,6 @@
to_chat(user, "<span class='warning'>They won't fit in, as there is already stuff inside!</span>")
return
if(T.use(10))
if(user.s_active)
user.s_active.close(user)
var/obj/item/bot_assembly/floorbot/B = new
B.toolbox = type
user.put_in_hands(B)
@@ -312,7 +310,6 @@
qdel(S)
qdel(src)
/obj/item/bot_assembly/medbot/attackby(obj/item/W, mob/user, params)
..()
switch(build_step)
@@ -12,7 +12,7 @@
icon = 'icons/mob/drone.dmi'
icon_state = "drone_maint_hat"//yes reuse the _hat state.
layer = BELOW_MOB_LAYER
var/drone_type = /mob/living/simple_animal/drone //Type of drone that will be spawned
var/seasonal_hats = TRUE //If TRUE, and there are no default hats, different holidays will grant different hats
var/static/list/possible_seasonal_hats //This is built automatically in build_seasonal_hats() but can also be edited by admins!
@@ -39,6 +39,7 @@
GLOB.poi_list -= src
. = ..()
//ATTACK GHOST IGNORING PARENT RETURN VALUE
/obj/item/drone_shell/attack_ghost(mob/user)
if(jobban_isbanned(user,"drone"))
return
@@ -29,6 +29,7 @@
if("Nothing")
return
//ATTACK HAND IGNORING PARENT RETURN VALUE
/mob/living/simple_animal/drone/attack_hand(mob/user)
if(ishuman(user))
if(stat == DEAD || status_flags & GODMODE || !can_be_held)
@@ -656,11 +656,9 @@ GLOBAL_LIST_EMPTY(parasites) //all currently existing/living guardians
/obj/item/storage/box/syndie_kit/guardian
name = "holoparasite injector kit"
/obj/item/storage/box/syndie_kit/guardian/Initialize()
. = ..()
/obj/item/storage/box/syndie_kit/guardian/PopulateContents()
new /obj/item/guardiancreator/tech/choose/traitor(src)
new /obj/item/paper/guides/antag/guardian(src)
return
/obj/item/guardiancreator/carp
name = "holocarp fishsticks"
@@ -88,6 +88,7 @@
/obj/guardian_bomb/attackby(mob/living/user)
detonate(user)
//ATTACK HAND IGNORING PARENT RETURN VALUE
/obj/guardian_bomb/attack_hand(mob/living/user)
detonate(user)
@@ -73,8 +73,10 @@
to_chat(src, "<span class='spider'><b>[directive]</b></span>")
/mob/living/simple_animal/hostile/poison/giant_spider/attack_ghost(mob/user)
if(!humanize_spider(user))
return ..()
. = ..()
if(.)
return
humanize_spider(user)
/mob/living/simple_animal/hostile/poison/giant_spider/proc/humanize_spider(mob/user)
if(key || !playable_spider)//Someone is in it or the fun police are shutting it down
@@ -382,7 +382,9 @@ Difficulty: Very Hard
ActivationReaction(speaker, ACTIVATE_SPEECH)
/obj/machinery/anomalous_crystal/attack_hand(mob/user)
..()
. = ..()
if(.)
return
ActivationReaction(user, ACTIVATE_TOUCH)
/obj/machinery/anomalous_crystal/attackby(obj/item/I, mob/user, params)
@@ -576,7 +578,9 @@ Difficulty: Very Hard
notify_ghosts("An anomalous crystal has been activated in [get_area(src)]! This crystal can always be used by ghosts hereafter.", enter_link = "<a href=?src=[REF(src)];ghostjoin=1>(Click to enter)</a>", ghost_sound = 'sound/effects/ghost2.ogg', source = src, action = NOTIFY_ATTACK)
/obj/machinery/anomalous_crystal/helpers/attack_ghost(mob/dead/observer/user)
..()
. = ..()
if(.)
return
if(ready_to_deploy)
var/be_helper = alert("Become a Lightgeist? (Warning, You can no longer be cloned!)",,"Yes","No")
if(be_helper == "Yes" && !QDELETED(src) && isobserver(user))
@@ -299,10 +299,10 @@
return
/mob/living/simple_animal/parrot/attack_paw(mob/living/carbon/monkey/M)
attack_hand(M)
return attack_hand(M)
/mob/living/simple_animal/parrot/attack_alien(mob/living/carbon/alien/M)
attack_hand(M)
return attack_hand(M)
//Simple animals
/mob/living/simple_animal/parrot/attack_animal(mob/living/simple_animal/M)
@@ -232,7 +232,7 @@
var/mob/living/Food = A
if(CanFeedon(Food))
Feedon(Food)
..()
return ..()
/mob/living/simple_animal/slime/doUnEquip(obj/item/W)
return
@@ -278,8 +278,6 @@
discipline_slime(user)
return ..()
/mob/living/simple_animal/slime/attack_hand(mob/living/carbon/human/M)
if(buckled)
M.do_attack_animation(src, ATTACK_EFFECT_DISARM)
+12 -8
View File
@@ -206,26 +206,26 @@
//unset redraw_mob to prevent the mob from being redrawn at the end.
/mob/proc/equip_to_slot_if_possible(obj/item/W, slot, qdel_on_fail = FALSE, disable_warning = FALSE, redraw_mob = TRUE, bypass_equip_delay_self = FALSE)
if(!istype(W))
return 0
return FALSE
if(!W.mob_can_equip(src, null, slot, disable_warning, bypass_equip_delay_self))
if(qdel_on_fail)
qdel(W)
else
if(!disable_warning)
to_chat(src, "<span class='warning'>You are unable to equip that!</span>" )
return 0
to_chat(src, "<span class='warning'>You are unable to equip that!</span>")
return FALSE
equip_to_slot(W, slot, redraw_mob) //This proc should not ever fail.
return 1
return TRUE
//This is an UNSAFE proc. It merely handles the actual job of equipping. All the checks on whether you can or can't eqip need to be done before! Use mob_can_equip() for that task.
//This is an UNSAFE proc. It merely handles the actual job of equipping. All the checks on whether you can or can't equip need to be done before! Use mob_can_equip() for that task.
//In most cases you will want to use equip_to_slot_if_possible()
/mob/proc/equip_to_slot(obj/item/W, slot)
return
//This is just a commonly used configuration for the equip_to_slot_if_possible() proc, used to equip people when the rounds tarts and when events happen and such.
//This is just a commonly used configuration for the equip_to_slot_if_possible() proc, used to equip people when the round starts and when events happen and such.
//Also bypasses equip delay checks, since the mob isn't actually putting it on.
/mob/proc/equip_to_slot_or_del(obj/item/W, slot)
return equip_to_slot_if_possible(W, slot, 1, 1, 0, 1)
return equip_to_slot_if_possible(W, slot, TRUE, TRUE, FALSE, TRUE)
//puts the item "W" into an appropriate slot in a human's inventory
//returns 0 if it cannot, 1 if successful
@@ -482,7 +482,7 @@
return
/mob/MouseDrop(mob/M)
..()
. = ..()
if(M != usr)
return
if(usr == src)
@@ -730,6 +730,10 @@
/mob/proc/can_unbuckle()
return 1
//Can the mob interact() with an atom?
/mob/proc/can_interact_with(atom/A)
return IsAdminGhost(src) || Adjacent(A)
//Can the mob see reagents inside of containers?
/mob/proc/can_see_reagents()
if(stat == DEAD) //Ghosts and such can always see reagents