diff --git a/code/WorkInProgress/buildmode.dm b/code/WorkInProgress/buildmode.dm index 9a193b84a4b..d4cc945cc6c 100644 --- a/code/WorkInProgress/buildmode.dm +++ b/code/WorkInProgress/buildmode.dm @@ -175,7 +175,7 @@ return 1 -/proc/build_click(var/mob/user, buildmode, location, control, params, var/obj/object) +/proc/build_click(var/mob/user, buildmode, params, var/obj/object) var/obj/effect/bmode/buildholder/holder = null for(var/obj/effect/bmode/buildholder/H) if(H.cl == user.client) diff --git a/code/__DEFINES.dm b/code/__DEFINES.dm index cc8745856bb..a7e0d755370 100644 --- a/code/__DEFINES.dm +++ b/code/__DEFINES.dm @@ -53,8 +53,7 @@ #define MASKINTERNALS 8 // mask allows internals //#define SUITSPACE 8 // suit protects against space -#define USEDELAY 16 // 1 second extra delay on use (Can be used once every 2s) -#define NODELAY 32768 // 1 second attackby delay skipped (Can be used once every 0.2s). Most objects have a 1s attackby delay, which doesn't require a flag. +#define USEDELAY 16 // For adding extra delay to heavy items, not currently used #define NOSHIELD 32 // weapon not affected by shield #define CONDUCT 64 // conducts electricity (metal etc.) #define FPRINT 256 // takes a fingerprint diff --git a/code/_onclick/adjacent.dm b/code/_onclick/adjacent.dm index d866878c45f..57cd33df7b6 100644 --- a/code/_onclick/adjacent.dm +++ b/code/_onclick/adjacent.dm @@ -1,18 +1,21 @@ /* Adjacency proc for determining touch range - This is to determine if a user can enter a square for the purposes of touching something. + This is mostly to determine if a user can enter a square for the purposes of touching something. Examples include reaching a square diagonally or reaching something on the other side of a glass window. This is calculated by looking for border items, or in the case of clicking diagonally from yourself, dense items. This proc will NOT notice if you are trying to attack a window on the other side of a dense object in its turf. There is a window helper for that. + + Note that in all cases the neighbor is handled simply; this is usually the user's mob, in which case it is up to you + to check that the mob is not inside of something */ -/atom/proc/Adjacent(var/mob/user) +/atom/proc/Adjacent(var/atom/neighbor) return 0 // Not a sane use of the function and (for now) indicative of an error elsewhere -/area/Adjacent(var/mob/user) - CRASH("Call to /area/Adjacent(user), unimplemented proc") +/area/Adjacent(var/atom/neighbor) + CRASH("Call to /area/Adjacent(), unimplemented proc") /* @@ -76,6 +79,23 @@ return loc.Adjacent(neighbor,recurse - 1) return 0 return ..() +/* + Special case: This allows you to reach a door when it is visally on top of, + but technically behind, a fire door + + You could try to rewrite this to be faster, but I'm not sure anything would be. + This can be safely removed if border firedoors are ever moved to be on top of doors + so they can be interacted with without opening the door. +*/ +/obj/machinery/door/Adjacent(var/atom/neighbor) + var/obj/machinery/door/firedoor/border_only/BOD = locate() in loc + if(BOD) + BOD.throwpass = 1 // allow click to pass + . = ..() + BOD.throwpass = 0 + return . + return ..() + /* This checks if you there is uninterrupted airspace between that turf and this one. @@ -84,12 +104,21 @@ */ /turf/proc/ClickCross(var/target_dir, var/border_only, var/target_atom = null) for(var/obj/O in src) - if( !O.density || O == target_atom) continue + if( !O.density || O == target_atom || O.throwpass) continue // throwpass is used for anything you can click through - if( O.flags&ON_BORDER ) // windows have throwpass but are on border, check them first + if( O.flags&ON_BORDER) // windows have throwpass but are on border, check them first if( O.dir & target_dir || O.dir&(O.dir-1) ) // full tile windows are just diagonals mechanically return 0 - else if( !border_only && !O.throwpass ) // dense, not on border, cannot pass over + else if( !border_only ) // dense, not on border, cannot pass over return 0 return 1 +/* + Aside: throwpass does not do what I thought it did originally, and is only used for checking whether or not + a thrown object should stop after already successfully entering a square. Currently the throw code involved + only seems to affect hitting mobs, because the checks performed against objects are already performed when + entering or leaving the square. Since throwpass isn't used on mobs, but only on objects, it is effectively + useless. Throwpass may later need to be removed and replaced with a passcheck (bitfield on movable atom passflags). + + Since I don't want to complicate the click code rework by messing with unrelated systems it won't be changed here. +*/ \ No newline at end of file diff --git a/code/_onclick/ai.dm b/code/_onclick/ai.dm index 686176e317e..c778bd775bb 100644 --- a/code/_onclick/ai.dm +++ b/code/_onclick/ai.dm @@ -2,25 +2,52 @@ // New feature: Double click on mobs as AI to track them -// No adjacency, no nothing -/mob/living/silicon/ai/ClickOn(var/atom/A, var/doubleclick) - if(control_disabled || stat || (world.time <= next_move && !doubleclick)) return +/mob/living/silicon/ai/DblClickOn(var/atom/A) + if(control_disabled || stat) return next_move = world.time + 9 - if(doubleclick) - if(ismob(A)) - ai_actual_track(A) - else - A.move_camera_by_click() - else if(restrained()) - A.hand_a(src) + if(ismob(A)) + ai_actual_track(A) else - A.attack_ai(src) + A.move_camera_by_click() + +// No adjacency, no nothing +/mob/living/silicon/ai/ClickOn(var/atom/A, params) + if(world.time <= next_click) + return + next_click = world.time + 1 + + if(client.buildmode) // comes after object.Click to allow buildmode gui objects to be clicked + build_click(src, client.buildmode, params, A) + return + + var/list/modifiers = params2list(params) + if("middle" in modifiers) + MiddleClickOn(A) + return + if("shift" in modifiers) + ShiftClickOn(A) + return + if("ctrl" in modifiers) + CtrlClickOn(A) + return + if("alt" in modifiers) + AltClickOn(A) + return + if(control_disabled || stat || world.time <= next_move) return + next_move = world.time + 9 + + /* + AI restrained() currently does nothing + if(restrained()) + RestrainedClickOn(A) + else + */ + A.attack_ai(src) + /atom/proc/attack_ai(mob/user as mob) return -/atom/proc/hand_a(mob/user as mob) //AI - restrained - return /mob/living/silicon/ai/ShiftClickOn(var/atom/A) @@ -50,12 +77,12 @@ /obj/machinery/door/airlock/AICtrlClick() // Bolts doors if(locked) - Topic("aiEnable=4", list("aiEnable"="4"), 1) + Topic("aiEnable=4", list("aiEnable"="4"), 1)// 1 meaning no window (consistency!) else Topic("aiDisable=4", list("aiDisable"="4"), 1) /obj/machinery/power/apc/AICtrlClick() // turns off APCs. - Topic("breaker=1", list("breaker"="1"), 0) // 0 meaning no window (consistency!) + Topic("breaker=1", list("breaker"="1"), 0) // 0 meaning no window (consistency! wait...) /atom/proc/AIAltClick() diff --git a/code/_onclick/click.dm b/code/_onclick/click.dm index 9297735bcf5..b3e2bd8a3b3 100644 --- a/code/_onclick/click.dm +++ b/code/_onclick/click.dm @@ -2,60 +2,21 @@ Click code cleanup ~Sayu */ -/client/var/next_click = 0 // 1 decisecond click delay (above and beyond mob/next_move) - -/client/DblClick(atom/object,location,control,params) - Click(object,location,control,params,doubleclick=1) +/mob/var/next_click = 0 // 1 decisecond click delay (above and beyond mob/next_move) /* - Client click code: - Enforces 1 click/decisecond in all cases. - If the target object has an overridden click handler (GUI code mostly), allow it to handle it. - If you are in buildmode, let the buildmode handler handle it. - If it is a special click, handle it separately. - Otherwise, run your particular mobtype's click handler. + Click code: + Before anything else, defer these calls to a per-mobtype handler. This allows us to + remove istype() spaghetti code, but requires the addition of other handler procs to simplify it. - The default below applies to most everything except cyborgs, AI, and ghosts, whose code are in separate files. - - Note: ShiftClickOn, etc, do NOT check paralysis/stat/etc by default. + Alternately, you could hardcode every mob's variation in a flat ClickOn() proc; however, + that's a lot of code duplication and is hard to maintain. */ +/atom/Click(location,control,params) + usr.ClickOn(src, params) +/atom/DblClick(location,control,params) + usr.DblClickOn(src,params) -/client/Click(atom/object,location,control,params,doubleclick = 0) - if(world.time <= next_click && !doubleclick) - return - next_click = world.time + 1 - - if(!mob || !object) return - - usr = mob - - if(object.Click(location,control,params)) // some things redefine Click() and it's faster to call a default-return proc than typecheck object every call - return - - if(buildmode) // comes after object.Click to allow buildmode gui objects to be clicked - build_click(mob, buildmode, location, control, params, object) - return - - if(params) - var/list/modifiers = params2list(params) - - if("middle" in modifiers) - mob.MiddleClickOn(object) - return - if("shift" in modifiers) - mob.ShiftClickOn(object) - return - if("ctrl" in modifiers) - mob.CtrlClickOn(object) - return - if("alt" in modifiers) - mob.AltClickOn(object) - return - - mob.ClickOn(object, doubleclick, params) - -/atom/Click() // default return 0. If you override this and want to stop normal interaction, return 1. - return 0 /mob/proc/face_atom(var/atom/A) if(!canface()) return @@ -71,31 +32,41 @@ if(dx > 0) usr.dir = EAST else usr.dir = WEST -/* - Default mob click handler - applies to humans, monkeys, simple animals, etc. +/mob/proc/ClickOn( var/atom/A, var/params ) + if(world.time <= next_click) + return + next_click = world.time + 1 - This is a mostly straight port of oldcode, but using object inheritance to determine - which function to call instead of istype()s. + if(client.buildmode) // comes after object.Click to allow buildmode gui objects to be clicked + build_click(src, client.buildmode, params, A) + return - ClickOn, RestrainedClickOn, UnarmedAttack, etc, can all be overwritten for various mobtypes. -*/. -/mob/proc/ClickOn( var/atom/A, var/doubleclick, var/params ) - if(!A || doubleclick) // doubleclick not used by default + var/list/modifiers = params2list(params) + if("middle" in modifiers) + MiddleClickOn(A) + return + if("shift" in modifiers) + ShiftClickOn(A) + return + if("ctrl" in modifiers) + CtrlClickOn(A) + return + if("alt" in modifiers) + AltClickOn(A) return if(stat || paralysis || stunned || weakened) return - if(next_move >= world.time) // in the year 2000... + face_atom(A) // change direction to face what you clicked on + + if(next_move > world.time) // in the year 2000... return if(istype(loc,/obj/mecha)) var/obj/mecha/M = loc return M.click_action(A,src) - face_atom(A) // change direction to face what you clicked on - - if(restrained()) RestrainedClickOn(A) return @@ -165,27 +136,35 @@ return +// Default behavior ignore +/mob/proc/DblClickOn(var/atom/A, var/params) + ClickOn(A,params) + + // translates into attack_hand, attack_paw, etc. proximity_flag should NOT be true if you are not adjacent (telekinesis) /mob/proc/UnarmedAttack(var/atom/A, var/proximity_flag) return // unarmed and at range - laser eyes, telekinesis, and mob special abilities /mob/proc/RangedAttack(var/atom/A, var/params) + if(!mutations.len) return if((LASER in mutations) && a_intent == "harm") LaserEyes(A) // moved into a proc below else if(TK in mutations) switch(get_dist(src,A)) + if(0) + ; if(1 to 5) // not adjacent may mean blocked by window next_move += 2 if(5 to 7) next_move += 5 - if(8 to 15) + if(8 to tk_maxrange) next_move += 10 - if(16 to 128) + else return A.attack_tk(src) -// hand_h, hand_p, etc - these are almost entirely unused +// Not currently used by anything but could easily be /mob/proc/RestrainedClickOn(var/atom/A) return diff --git a/code/_onclick/cyborg.dm b/code/_onclick/cyborg.dm index c7ee6b4d7b0..b3af8f61cbd 100644 --- a/code/_onclick/cyborg.dm +++ b/code/_onclick/cyborg.dm @@ -3,14 +3,29 @@ Cyborgs have no range restriction on attack_robot(), because it is basically an AI click. However, they do have a range restriction on item use. - - Note that at present cyborg restrained() returns 0 in all cases */ +/mob/living/silicon/robot/ClickOn(var/atom/A, var/params) + if(world.time <= next_click) + return + next_click = world.time + 1 + if(client.buildmode) // comes after object.Click to allow buildmode gui objects to be clicked + build_click(src, client.buildmode, params, A) + return -/mob/living/silicon/robot/ClickOn(var/atom/A, var/doubleclick, var/params) - if(!A) + var/list/modifiers = params2list(params) + if("middle" in modifiers) + MiddleClickOn(A) + return + if("shift" in modifiers) + ShiftClickOn(A) + return + if("ctrl" in modifiers) + CtrlClickOn(A) + return + if("alt" in modifiers) + AltClickOn(A) return if(stat || lockcharge || weakened || stunned || paralysis) @@ -21,9 +36,12 @@ face_atom(A) // change direction to face what you clicked on + /* + cyborg restrained() currently does nothing if(restrained()) - A.hand_r(src) + RestrainedClickOn(A) return + */ var/obj/item/W = get_active_hand() @@ -79,7 +97,3 @@ /atom/proc/attack_robot(mob/user as mob) attack_ai(user) return - -/atom/proc/hand_r(mob/user as mob) //Cyborg (robot) - restrained - src.hand_a(user) - return \ No newline at end of file diff --git a/code/_onclick/observer.dm b/code/_onclick/observer.dm index 66ab9fbfa1b..a6290cf870f 100644 --- a/code/_onclick/observer.dm +++ b/code/_onclick/observer.dm @@ -1,20 +1,18 @@ -/mob/dead/observer/ClickOn(var/atom/A, var/doubleclick) - if(doubleclick) +/mob/dead/observer/DblClickOn(var/atom/A) + if(can_reenter_corpse && mind && mind.current) + if(A == mind.current || (mind.current in A)) // double click your corpse or whatever holds it + reenter_corpse() // (cloning scanner, body bag, closet, mech, etc) + return // seems legit. - if(can_reenter_corpse && mind && mind.current) - if(A == mind.current || (mind.current in A)) // double click your corpse or whatever holds it - reenter_corpse() // (cloning scanner, body bag, closet, mech, etc) - return // seems legit. + // Things you might plausibly want to follow + if((ismob(A) && A != src) || istype(A,/obj/machinery/bot) || istype(A,/obj/machinery/singularity)) + ManualFollow(A) - // Things you might plausibly want to follow - if((ismob(A) && A != src) || istype(A,/obj/machinery/bot) || istype(A,/obj/machinery/singularity)) - ManualFollow(A) + // Otherwise jump + else + loc = get_turf(A) - // Otherwise jump - else - loc = get_turf(A) - - return +/mob/dead/observer/ClickOn(var/atom/A) if(world.time <= next_move) return next_move = world.time + 8 // You are responsible for checking config.ghost_interaction when you override this function diff --git a/code/_onclick/other_mobs.dm b/code/_onclick/other_mobs.dm index 8a8eb516580..a80d53f0a15 100644 --- a/code/_onclick/other_mobs.dm +++ b/code/_onclick/other_mobs.dm @@ -15,11 +15,10 @@ return /mob/living/carbon/human/RestrainedClickOn(var/atom/A) - A.hand_h(src) -/atom/proc/hand_h(mob/user as mob) //human (hand) - restrained return /mob/living/carbon/human/RangedAttack(var/atom/A) + if(!gloves && !mutations.len) return var/obj/item/clothing/gloves/G = gloves if((LASER in mutations) && a_intent == "harm") LaserEyes(A) // moved into a proc below @@ -46,8 +45,6 @@ /atom/proc/attack_animal(mob/user as mob) return /mob/living/RestrainedClickOn(var/atom/A) - A.hand_a(src) -/atom/proc/hand_an(mob/user as mob) return @@ -56,12 +53,33 @@ A.attack_paw(src) /atom/proc/attack_paw(mob/user as mob) return -/mob/living/carbon/monkey/RestrainedClickOn(var/atom/A) - A.hand_p(src) -/atom/proc/hand_p(mob/user as mob) //monkey (paw) - restrained - return +/mob/living/carbon/monkey/RestrainedClickOn(var/atom/A) + if(a_intent != "harm" || !ismob(A)) return + if(istype(wear_mask, /obj/item/clothing/mask/muzzle)) + return + var/mob/living/carbon/ML = A + var/dam_zone = pick("chest", "l_hand", "r_hand", "l_leg", "r_leg") + var/datum/limb/affecting = null + if(ishuman(ML)) // why the hell is this not more general + affecting = ML:get_organ(ran_zone(dam_zone)) + var/armor = ML.run_armor_check(affecting, "melee") + if(prob(75)) + ML.apply_damage(rand(1,3), BRUTE, affecting, armor) + for(var/mob/O in viewers(ML, null)) + O.show_message("\red [name] has bit [ML]!", 1) + if(armor >= 2) return + if(ishuman(ML)) + ML = ML.monkeyize() + if(ismonkey(ML)) + for(var/datum/disease/D in viruses) + if(istype(D, /datum/disease/jungle_fever)) + ML.contract_disease(D,1,0) + else + for(var/mob/O in viewers(ML, null)) + O.show_message("\red [src] has attempted to bite [ML]!", 1) + //Aliens - Defaults to same as monkey in most places /mob/living/carbon/alien/humanoid/UnarmedAttack(var/atom/A) A.attack_alien(src) @@ -69,9 +87,6 @@ attack_paw(user) return /mob/living/carbon/alien/humanoid/RestrainedClickOn(var/atom/A) - A.hand_al(src) -/atom/proc/hand_al(mob/user as mob) //alien - restrained - hand_p(user) return // Babby aliens @@ -87,8 +102,6 @@ /atom/proc/attack_slime(mob/user as mob) return /mob/living/carbon/slime/RestrainedClickOn(var/atom/A) - A.hand_s(src) -/atom/proc/hand_s(mob/user as mob) //slime - restrained return /mob/new_player/ClickOn() diff --git a/code/_onclick/telekinesis.dm b/code/_onclick/telekinesis.dm index 379a0c2e89a..9af41fc8b13 100644 --- a/code/_onclick/telekinesis.dm +++ b/code/_onclick/telekinesis.dm @@ -3,6 +3,7 @@ This needs more thinking out, but I might as well. */ +var/const/tk_maxrange = 15 // click on atom with an empty hand, not Adjacent /atom/proc/attack_tk(mob/user) @@ -47,7 +48,7 @@ desc = "Magic" icon = 'icons/obj/magic.dmi'//Needs sprites icon_state = "2" - flags = USEDELAY | NOBLUDGEON + flags = NOBLUDGEON //item_state = null w_class = 10.0 layer = 20 @@ -77,19 +78,34 @@ if(focus) focus.attack_self_tk(user) - afterattack(atom/target as mob|obj|turf|area, mob/living/user as mob|obj, flag)//TODO: go over this + afterattack(atom/target as mob|obj|turf|area, mob/living/user as mob|obj, proximity)//TODO: go over this if(!target || !user) return if(last_throw+3 > world.time) return - if(!host) + if(!host || host != user) del(src) return if(!(TK in host.mutations)) del(src) return - if(isobj(target)) - if(!target.loc || !isturf(target.loc)) - del(src) + if(isobj(target) && !isturf(target.loc)) + return + + var/d = get_dist(user, target) + if(focus) d = max(d,get_dist(user,focus)) // whichever is further + switch(d) + if(0) + ; + if(1 to 5) // not adjacent may mean blocked by window + if(!proximity) + user.next_move += 2 + if(5 to 7) + user.next_move += 5 + if(8 to tk_maxrange) + user.next_move += 10 + else + user << "\blue Your mind won't reach that far." return + if(!focus) focus_object(target, user) return @@ -98,11 +114,15 @@ target.attack_self_tk(user) return // todo: something like attack_self not laden with assumptions inherent to attack_self - var/focusturf = get_turf(focus) - if(get_dist(focusturf, target) <= 1 && !istype(target, /turf)) - target.attackby(focus, user, user:get_organ_target()) - else if(get_dist(focusturf, target) <= 16) + if(!istype(target, /turf) && istype(focus,/obj/item) && target.Adjacent(focus)) + var/obj/item/I = focus + var/resolved = target.attackby(I, user, user:get_organ_target()) + if(!resolved && target && I) + I.afterattack(target,user,1) // for splashing with beakers + + + else apply_focus_overlay() focus.throw_at(target, 10, 1) last_throw = world.time diff --git a/code/defines/obj.dm b/code/defines/obj.dm index 026ff11473c..5154ac412f4 100644 --- a/code/defines/obj.dm +++ b/code/defines/obj.dm @@ -84,7 +84,7 @@ throwforce = 0.0 throw_speed = 1 throw_range = 20 - flags = FPRINT | USEDELAY | TABLEPASS + flags = FPRINT | TABLEPASS afterattack(atom/target as mob|obj|turf|area, mob/user as mob) user.drop_item() src.throw_at(target, throw_range, throw_speed) diff --git a/code/defines/obj/weapon.dm b/code/defines/obj/weapon.dm index f37aeb583bf..c312f18125e 100644 --- a/code/defines/obj/weapon.dm +++ b/code/defines/obj/weapon.dm @@ -427,7 +427,8 @@ origin_tech = "materials=2;combat=2" attack_verb = list("chopped", "sliced", "cut", "reaped") -/obj/item/weapon/scythe/afterattack(atom/A, mob/user as mob) +/obj/item/weapon/scythe/afterattack(atom/A, mob/user as mob, proximity) + if(!proximity) return if(istype(A, /obj/effect/spacevine)) for(var/obj/effect/spacevine/B in orange(A,1)) if(prob(80)) diff --git a/code/game/atoms_movable.dm b/code/game/atoms_movable.dm index 307ce09d7f1..ddf101acff1 100644 --- a/code/game/atoms_movable.dm +++ b/code/game/atoms_movable.dm @@ -44,7 +44,7 @@ return 1 return 0 -/atom/movable/proc/hit_check() +/atom/movable/proc/hit_check() // todo: this is partly obsolete due to passflags already, add throwing stuff to mob CanPass and finish it if(src.throwing) for(var/atom/A in get_turf(src)) if(A == src) continue @@ -150,7 +150,7 @@ //done throwing, either because it hit something or it finished moving src.throwing = 0 - if(isobj(src)) src:throw_impact(get_turf(src)) + if(isobj(src)) src.throw_impact(get_turf(src)) //Overlays diff --git a/code/game/machinery/doors/door.dm b/code/game/machinery/doors/door.dm index 367eed5b3a4..8cc72d07354 100644 --- a/code/game/machinery/doors/door.dm +++ b/code/game/machinery/doors/door.dm @@ -118,7 +118,7 @@ return if(src.operating || isrobot(user)) return //borgs can't attack doors open because it conflicts with their AI-like interaction with them. src.add_fingerprint(user) - if(istype(I,/obj/item/tk_grab) && !Adjacent(user)) + if(!Adjacent(user)) user = null if(!src.requiresID()) user = null diff --git a/code/game/objects/items/crayons.dm b/code/game/objects/items/crayons.dm index 84f22b6932a..ad757325b95 100644 --- a/code/game/objects/items/crayons.dm +++ b/code/game/objects/items/crayons.dm @@ -65,8 +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, flag) - if(!flag) return +/obj/item/toy/crayon/afterattack(atom/target, mob/user as mob, proximity) + if(!proximity) 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) diff --git a/code/game/objects/items/devices/PDA/PDA.dm b/code/game/objects/items/devices/PDA/PDA.dm index b00f525adfc..5e5182008ea 100644 --- a/code/game/objects/items/devices/PDA/PDA.dm +++ b/code/game/objects/items/devices/PDA/PDA.dm @@ -907,7 +907,8 @@ var/global/list/obj/item/device/pda/PDAs = list() else user.show_message("\blue No radiation detected.") -/obj/item/device/pda/afterattack(atom/A as mob|obj|turf|area, mob/user as mob) +/obj/item/device/pda/afterattack(atom/A as mob|obj|turf|area, mob/user as mob, proximity) + if(!proximity) return switch(scanmode) if(3) diff --git a/code/game/objects/items/devices/chameleonproj.dm b/code/game/objects/items/devices/chameleonproj.dm index 9a1294c3e2b..1053bf4024f 100644 --- a/code/game/objects/items/devices/chameleonproj.dm +++ b/code/game/objects/items/devices/chameleonproj.dm @@ -1,7 +1,7 @@ /obj/item/device/chameleon name = "chameleon-projector" icon_state = "shield0" - flags = FPRINT | TABLEPASS| CONDUCT | USEDELAY + flags = FPRINT | TABLEPASS| CONDUCT slot_flags = SLOT_BELT item_state = "electronic" throwforce = 5.0 @@ -22,7 +22,8 @@ /obj/item/device/chameleon/attack_self() toggle() -/obj/item/device/chameleon/afterattack(atom/target, mob/user , flag) +/obj/item/device/chameleon/afterattack(atom/target, mob/user , proximity) + if(!proximity) return if(!active_dummy) if(istype(target,/obj/item) && !istype(target, /obj/item/weapon/disk/nuclear)) playsound(get_turf(src), 'sound/weapons/flash.ogg', 100, 1, -6) diff --git a/code/game/objects/items/devices/flashlight.dm b/code/game/objects/items/devices/flashlight.dm index b5f64ce481b..50a6f44bbc4 100644 --- a/code/game/objects/items/devices/flashlight.dm +++ b/code/game/objects/items/devices/flashlight.dm @@ -226,7 +226,8 @@ ..() return -/obj/item/device/flashlight/emp/afterattack(atom/A as mob|obj, mob/user) +/obj/item/device/flashlight/emp/afterattack(atom/A as mob|obj, mob/user, proximity) + if(!proximity) return if (emp_charges > 0) A.emp_act(1) A.visible_message("[user] blinks \the [src] at \the [A].", \ diff --git a/code/game/objects/items/devices/laserpointer.dm b/code/game/objects/items/devices/laserpointer.dm index 3e98a0fe200..bb327ce0160 100644 --- a/code/game/objects/items/devices/laserpointer.dm +++ b/code/game/objects/items/devices/laserpointer.dm @@ -6,7 +6,7 @@ icon_state = "pointer" item_state = "pen" var/pointer_icon_state - flags = FPRINT | TABLEPASS | CONDUCT | USEDELAY + flags = FPRINT | TABLEPASS | CONDUCT slot_flags = SLOT_BELT m_amt = 500 g_amt = 500 diff --git a/code/game/objects/items/stacks/sheets/glass.dm b/code/game/objects/items/stacks/sheets/glass.dm index 20069c324a0..5130265ab81 100644 --- a/code/game/objects/items/stacks/sheets/glass.dm +++ b/code/game/objects/items/stacks/sheets/glass.dm @@ -268,7 +268,8 @@ ..() -/obj/item/weapon/shard/afterattack(atom/A as mob|obj, mob/user) +/obj/item/weapon/shard/afterattack(atom/A as mob|obj, mob/user, proximity) + if(!proximity || !(src in user)) return if(isturf(A)) return if(istype(A, /obj/item/weapon/storage)) diff --git a/code/game/objects/items/toys.dm b/code/game/objects/items/toys.dm index cc78be5afc2..98e29755c23 100644 --- a/code/game/objects/items/toys.dm +++ b/code/game/objects/items/toys.dm @@ -35,7 +35,8 @@ /obj/item/toy/balloon/attack(mob/living/carbon/human/M as mob, mob/user as mob) return -/obj/item/toy/balloon/afterattack(atom/A as mob|obj, mob/user as mob) +/obj/item/toy/balloon/afterattack(atom/A as mob|obj, mob/user as mob, proximity) + if(!proximity) return if (istype(A, /obj/structure/reagent_dispensers/watertank) && get_dist(src,A) <= 1) A.reagents.trans_to(src, 10) user << "\blue You fill the balloon with the contents of [A]." @@ -120,7 +121,7 @@ icon = 'icons/obj/gun.dmi' icon_state = "revolver" item_state = "gun" - flags = FPRINT | TABLEPASS | CONDUCT | USEDELAY + flags = FPRINT | TABLEPASS | CONDUCT slot_flags = SLOT_BELT w_class = 3.0 g_amt = 10 @@ -197,7 +198,7 @@ icon = 'icons/obj/gun.dmi' icon_state = "crossbow" item_state = "crossbow" - flags = FPRINT | TABLEPASS | USEDELAY + flags = FPRINT | TABLEPASS w_class = 2.0 attack_verb = list("attacked", "struck", "hit") var/bullets = 5 diff --git a/code/game/objects/items/weapons/RCD.dm b/code/game/objects/items/weapons/RCD.dm index 2ebee6885a7..24d67a0424f 100644 --- a/code/game/objects/items/weapons/RCD.dm +++ b/code/game/objects/items/weapons/RCD.dm @@ -141,7 +141,8 @@ RCD playsound(src.loc, 'sound/items/Deconstruct.ogg', 50, 1) - afterattack(atom/A, mob/user) + afterattack(atom/A, mob/user, proximity) + if(!proximity) return 0 if(disabled && !isrobot(user)) return 0 if(istype(A,/area/shuttle)||istype(A,/turf/space/transit)) diff --git a/code/game/objects/items/weapons/RSF.dm b/code/game/objects/items/weapons/RSF.dm index 5ffed7b6d1a..fa55fc8e624 100644 --- a/code/game/objects/items/weapons/RSF.dm +++ b/code/game/objects/items/weapons/RSF.dm @@ -61,7 +61,8 @@ RSF return // Change mode -/obj/item/weapon/rsf/afterattack(atom/A, mob/user as mob) +/obj/item/weapon/rsf/afterattack(atom/A, mob/user as mob, proximity) + if(!proximity) return if (!(istype(A, /obj/structure/table) || istype(A, /turf/simulated/floor))) return diff --git a/code/game/objects/items/weapons/cards_ids.dm b/code/game/objects/items/weapons/cards_ids.dm index 9519b81ff6f..6130cde3dd2 100644 --- a/code/game/objects/items/weapons/cards_ids.dm +++ b/code/game/objects/items/weapons/cards_ids.dm @@ -111,7 +111,8 @@ access = list(access_maint_tunnels, access_syndicate) origin_tech = "syndicate=3" -/obj/item/weapon/card/id/syndicate/afterattack(var/obj/item/weapon/O as obj, mob/user as mob) +/obj/item/weapon/card/id/syndicate/afterattack(var/obj/item/weapon/O as obj, mob/user as mob, proximity) + if(!proximity) return if(istype(O, /obj/item/weapon/card/id)) var/obj/item/weapon/card/id/I = O src.access |= I.access diff --git a/code/game/objects/items/weapons/cigs_lighters.dm b/code/game/objects/items/weapons/cigs_lighters.dm index b4d881fa314..15dee70e78f 100644 --- a/code/game/objects/items/weapons/cigs_lighters.dm +++ b/code/game/objects/items/weapons/cigs_lighters.dm @@ -118,8 +118,8 @@ CIGARETTE PACKETS ARE IN FANCY.DM return -/obj/item/clothing/mask/cigarette/afterattack(obj/item/weapon/reagent_containers/glass/glass, mob/user as mob) - ..() +/obj/item/clothing/mask/cigarette/afterattack(obj/item/weapon/reagent_containers/glass/glass, mob/user as mob, proximity) + if(!proximity) return if(istype(glass)) //you can dip cigarettes into beakers var/transfered = glass.reagents.trans_to(src, chem_volume) if(transfered) //if reagents were transfered, show the message @@ -160,7 +160,7 @@ CIGARETTE PACKETS ARE IN FANCY.DM var/turf/T = get_turf(src) T.visible_message(flavor_text) processing_objects.Add(src) - + //can't think of any other way to update the overlays :< if(ismob(loc)) var/mob/M = loc diff --git a/code/game/objects/items/weapons/clown_items.dm b/code/game/objects/items/weapons/clown_items.dm index 1f3b451e628..49f0b2e45f5 100644 --- a/code/game/objects/items/weapons/clown_items.dm +++ b/code/game/objects/items/weapons/clown_items.dm @@ -35,7 +35,8 @@ M.Stun(3) M.Weaken(2) -/obj/item/weapon/soap/afterattack(atom/target, mob/user as mob) +/obj/item/weapon/soap/afterattack(atom/target, mob/user as mob, proximity) + if(!proximity) return //I couldn't feasibly fix the overlay bugs caused by cleaning items we are wearing. //So this is a workaround. This also makes more sense from an IC standpoint. ~Carn if(user.client && (target in user.client.screen)) diff --git a/code/game/objects/items/weapons/explosives.dm b/code/game/objects/items/weapons/explosives.dm index 1ef92efe839..bc10c25778e 100644 --- a/code/game/objects/items/weapons/explosives.dm +++ b/code/game/objects/items/weapons/explosives.dm @@ -7,7 +7,7 @@ icon = 'icons/obj/assemblies.dmi' icon_state = "plastic-explosive0" item_state = "plasticx" - flags = FPRINT | TABLEPASS | USEDELAY | NOBLUDGEON + flags = FPRINT | TABLEPASS | NOBLUDGEON w_class = 2.0 origin_tech = "syndicate=2" var/datum/wires/explosive/plastic/wires = null diff --git a/code/game/objects/items/weapons/extinguisher.dm b/code/game/objects/items/weapons/extinguisher.dm index 329e0dfc1bb..0c5f84a4b73 100644 --- a/code/game/objects/items/weapons/extinguisher.dm +++ b/code/game/objects/items/weapons/extinguisher.dm @@ -5,7 +5,7 @@ icon_state = "fire_extinguisher0" item_state = "fire_extinguisher" hitsound = 'sound/weapons/smash.ogg' - flags = FPRINT | USEDELAY | TABLEPASS | CONDUCT + flags = FPRINT | TABLEPASS | CONDUCT throwforce = 10 w_class = 3.0 throw_speed = 2 @@ -24,7 +24,7 @@ icon_state = "miniFE0" item_state = "miniFE" hitsound = null //it is much lighter, after all. - flags = FPRINT | USEDELAY | TABLEPASS + flags = FPRINT | TABLEPASS throwforce = 2 w_class = 2.0 force = 3.0 diff --git a/code/game/objects/items/weapons/flamethrower.dm b/code/game/objects/items/weapons/flamethrower.dm index 9c0dd273c52..c6fa18b5377 100644 --- a/code/game/objects/items/weapons/flamethrower.dm +++ b/code/game/objects/items/weapons/flamethrower.dm @@ -4,7 +4,7 @@ icon = 'icons/obj/flamethrower.dmi' icon_state = "flamethrowerbase" item_state = "flamethrower_0" - flags = FPRINT | TABLEPASS| CONDUCT | USEDELAY // USEDELAY flag needed in order to use afterattack() for things that are not in reach. I.E: Shooting flames. + flags = FPRINT | TABLEPASS| CONDUCT force = 3.0 throwforce = 10.0 throw_speed = 1 @@ -61,6 +61,7 @@ return /obj/item/weapon/flamethrower/afterattack(atom/target, mob/user, flag) + if(flag) return // too close // Make sure our user is still holding us if(user && user.get_active_hand() == src) var/turf/target_turf = get_turf(target) diff --git a/code/game/objects/items/weapons/grenades/smokebomb.dm b/code/game/objects/items/weapons/grenades/smokebomb.dm index da5c22b8177..1f4e373cbc6 100644 --- a/code/game/objects/items/weapons/grenades/smokebomb.dm +++ b/code/game/objects/items/weapons/grenades/smokebomb.dm @@ -5,7 +5,7 @@ icon_state = "flashbang" det_time = 20 item_state = "flashbang" - flags = FPRINT | TABLEPASS | USEDELAY + flags = FPRINT | TABLEPASS slot_flags = SLOT_BELT var/datum/effect/effect/system/bad_smoke_spread/smoke diff --git a/code/game/objects/items/weapons/mop.dm b/code/game/objects/items/weapons/mop.dm index fd3f2e8c7f2..27935c4f874 100644 --- a/code/game/objects/items/weapons/mop.dm +++ b/code/game/objects/items/weapons/mop.dm @@ -28,7 +28,8 @@ obj/item/weapon/mop/proc/clean(turf/simulated/A) reagents.remove_any(1) //reaction() doesn't use up the reagents -/obj/item/weapon/mop/afterattack(atom/A, mob/user) +/obj/item/weapon/mop/afterattack(atom/A, mob/user, proximity) + if(!proximity) return if(istype(A, /turf/simulated) || istype(A, /obj/effect/decal/cleanable) || istype(A, /obj/effect/overlay) || istype(A, /obj/effect/rune)) if(reagents.total_volume < 1) user << "Your mop is dry!" diff --git a/code/game/objects/items/weapons/paint.dm b/code/game/objects/items/weapons/paint.dm index 081aa7a5e68..fbd001c87c1 100644 --- a/code/game/objects/items/weapons/paint.dm +++ b/code/game/objects/items/weapons/paint.dm @@ -76,7 +76,8 @@ var/global/list/cached_icons = list() return -/obj/item/weapon/paint/afterattack(turf/target, mob/user as mob) +/obj/item/weapon/paint/afterattack(turf/target, mob/user as mob, proximity) + if(!proximity) return if(paintleft <= 0) icon_state = "paint_empty" return @@ -99,7 +100,8 @@ var/global/list/cached_icons = list() name = "Paint remover" icon_state = "paint_neutral" - afterattack(turf/target, mob/user as mob) + afterattack(turf/target, mob/user as mob,proximity) + if(!proximity) return if(istype(target) && target.icon != initial(target.icon)) target.icon = initial(target.icon) return diff --git a/code/game/objects/items/weapons/singularityhammer.dm b/code/game/objects/items/weapons/singularityhammer.dm index c4ce7f308ea..88deea093c6 100644 --- a/code/game/objects/items/weapons/singularityhammer.dm +++ b/code/game/objects/items/weapons/singularityhammer.dm @@ -58,8 +58,8 @@ -/obj/item/weapon/twohanded/singularityhammer/afterattack(atom/A as mob|obj|turf|area, mob/user as mob) - ..() +/obj/item/weapon/twohanded/singularityhammer/afterattack(atom/A as mob|obj|turf|area, mob/user as mob, proximity) + if(!proximity) return if(wielded) if(charged == 5) charged = 0 diff --git a/code/game/objects/items/weapons/storage/bible.dm b/code/game/objects/items/weapons/storage/bible.dm index 609ffafb431..28f007f30db 100644 --- a/code/game/objects/items/weapons/storage/bible.dm +++ b/code/game/objects/items/weapons/storage/bible.dm @@ -87,7 +87,8 @@ playsound(src.loc, "punch", 25, 1, -1) return -/obj/item/weapon/storage/bible/afterattack(atom/A, mob/user as mob) +/obj/item/weapon/storage/bible/afterattack(atom/A, mob/user as mob, proximity) + if(!proximity) return if (istype(A, /turf/simulated/floor)) user << "\blue You hit the floor with the bible." if(user.mind && (user.mind.assigned_role == "Chaplain")) diff --git a/code/game/objects/items/weapons/tools.dm b/code/game/objects/items/weapons/tools.dm index c84360665bf..452fac28fd4 100644 --- a/code/game/objects/items/weapons/tools.dm +++ b/code/game/objects/items/weapons/tools.dm @@ -190,7 +190,8 @@ location.hotspot_expose(700, 5) -/obj/item/weapon/weldingtool/afterattack(obj/O, mob/user) +/obj/item/weapon/weldingtool/afterattack(obj/O, mob/user, proximity) + if(!proximity) return if(istype(O, /obj/structure/reagent_dispensers/fueltank) && in_range(src, O)) if(!welding) O.reagents.trans_to(src, max_fuel) diff --git a/code/game/objects/items/weapons/twohanded.dm b/code/game/objects/items/weapons/twohanded.dm index a5517b4f0fd..97245af7786 100644 --- a/code/game/objects/items/weapons/twohanded.dm +++ b/code/game/objects/items/weapons/twohanded.dm @@ -134,8 +134,8 @@ icon_state = "fireaxe[wielded]" return -/obj/item/weapon/twohanded/fireaxe/afterattack(atom/A as mob|obj|turf|area, mob/user as mob) - ..() +/obj/item/weapon/twohanded/fireaxe/afterattack(atom/A as mob|obj|turf|area, mob/user as mob, proximity) + if(!proximity) return if(A && wielded && (istype(A,/obj/structure/window) || istype(A,/obj/structure/grille))) //destroys windows and grilles in one hit if(istype(A,/obj/structure/window)) //should just make a window.Break() proc but couldn't bother with it var/obj/structure/window/W = A diff --git a/code/game/objects/structures/tables_racks.dm b/code/game/objects/structures/tables_racks.dm index 934bbb71d6e..5a81d92b0c6 100644 --- a/code/game/objects/structures/tables_racks.dm +++ b/code/game/objects/structures/tables_racks.dm @@ -200,12 +200,6 @@ del(src) return - -/obj/structure/table/hand_p(mob/user as mob) - return src.attack_paw(user) - return - - /obj/structure/table/attack_paw(mob/user) if(HULK in user.mutations) user.say(pick(";RAAAAAAAARGH!", ";HNNNNNNNNNGGGGGGH!", ";GWAAAAAAAARRRHHH!", "NNNNNNNNGGGGGGGGHH!", ";AAAAAAARRRGH!" )) diff --git a/code/game/objects/structures/window.dm b/code/game/objects/structures/window.dm index 799038a9148..eb7fd562651 100644 --- a/code/game/objects/structures/window.dm +++ b/code/game/objects/structures/window.dm @@ -96,6 +96,9 @@ if(reinf) new /obj/item/stack/rods(loc) del(src) +/obj/structure/window/attack_tk(mob/user as mob) + user.visible_message("Something knocks on [src].") + playsound(loc, 'sound/effects/Glasshit.ogg', 50, 1) /obj/structure/window/attack_hand(mob/user as mob) if(!can_be_reached(user)) diff --git a/code/modules/admin/verbs/diagnostics.dm b/code/modules/admin/verbs/diagnostics.dm index 1b82bc21018..b05dbe49fba 100644 --- a/code/modules/admin/verbs/diagnostics.dm +++ b/code/modules/admin/verbs/diagnostics.dm @@ -33,15 +33,15 @@ largest_move_time = M.next_move - world.time else largest_move_time = 1 - if(M.client.next_click >= largest_click_time) + if(M.next_click >= largest_click_time) largest_click_mob = M - if(M.client.next_click > world.time) - largest_click_time = M.client.next_click - world.time + if(M.next_click > world.time) + largest_click_time = M.next_click - world.time else largest_click_time = 0 - log_admin("DEBUG: [key_name(M)] next_move = [M.next_move] lastDblClick = [M.client.next_click] world.time = [world.time]") + log_admin("DEBUG: [key_name(M)] next_move = [M.next_move] lastDblClick = [M.next_click] world.time = [world.time]") M.next_move = 1 - M.client.next_click = 0 + M.next_click = 0 message_admins("[key_name_admin(largest_move_mob)] had the largest move delay with [largest_move_time] frames / [largest_move_time/10] seconds!", 1) message_admins("[key_name_admin(largest_click_mob)] had the largest click delay with [largest_click_time] frames / [largest_click_time/10] seconds!", 1) message_admins("world.time = [world.time]", 1) diff --git a/code/modules/detectivework/evidence.dm b/code/modules/detectivework/evidence.dm index c0991dcd3a2..8e75055e17b 100644 --- a/code/modules/detectivework/evidence.dm +++ b/code/modules/detectivework/evidence.dm @@ -8,16 +8,13 @@ item_state = "" w_class = 1 -/obj/item/weapon/evidencebag/afterattack(obj/item/I, mob/user as mob) - if(!in_range(I, user)) +/obj/item/weapon/evidencebag/afterattack(obj/item/I, mob/user as mob,proximity) + if(!proximity) return if(!istype(I) || I.anchored == 1) return ..() - if(istype(I, /obj/item/weapon/storage)) - return ..() - if(istype(I, /obj/item/weapon/evidencebag)) user << "You find putting an evidence bag in another evidence bag to be slightly absurd." return diff --git a/code/modules/detectivework/footprints_and_rag.dm b/code/modules/detectivework/footprints_and_rag.dm index 4100de5b514..6068378d742 100644 --- a/code/modules/detectivework/footprints_and_rag.dm +++ b/code/modules/detectivework/footprints_and_rag.dm @@ -52,7 +52,8 @@ else ..() -/obj/item/weapon/reagent_containers/glass/rag/afterattack(atom/A as obj|turf|area, mob/user as mob) +/obj/item/weapon/reagent_containers/glass/rag/afterattack(atom/A as obj|turf|area, mob/user as mob,proximity) + if(!proximity) return if(istype(A) && src in user) user.visible_message("[user] starts to wipe down [A] with [src]!") if(do_after(user,30)) diff --git a/code/modules/detectivework/scanner.dm b/code/modules/detectivework/scanner.dm index 935d9213e6c..0fb2e322a54 100644 --- a/code/modules/detectivework/scanner.dm +++ b/code/modules/detectivework/scanner.dm @@ -8,7 +8,7 @@ icon_state = "forensic1" w_class = 3.0 item_state = "electronic" - flags = FPRINT | TABLEPASS | CONDUCT | USEDELAY | NOBLUDGEON + flags = FPRINT | TABLEPASS | CONDUCT | NOBLUDGEON slot_flags = SLOT_BELT var/scanning = 0 var/list/log = list() @@ -43,9 +43,8 @@ scan(M, user) -/obj/item/device/detective_scanner/afterattack(atom/A as obj|turf|area, mob/user as mob) - - if(!in_range(A,user)) +/obj/item/device/detective_scanner/afterattack(atom/A as obj|turf|area, mob/user as mob,proximity) + if(!proximity) return if(!isturf(A) && !isobj(A)) return @@ -171,4 +170,4 @@ CRASH("[src] \ref[src] is adding a log when it was never put in scanning mode!") /proc/get_timestamp() - return time2text(world.time + 432000, ":ss") + return time2text(world.time + 432000, ":ss") diff --git a/code/modules/hydroponics/hydroitemcode.dm b/code/modules/hydroponics/hydroitemcode.dm index 1d66bb3acb9..eaec018f589 100644 --- a/code/modules/hydroponics/hydroitemcode.dm +++ b/code/modules/hydroponics/hydroitemcode.dm @@ -14,7 +14,8 @@ M << "\red You are heated by the warmth of the of the [name]!" M.bodytemperature += potency/2 * TEMPERATURE_DAMAGE_COEFFICIENT -/obj/item/weapon/grown/novaflower/afterattack(atom/A as mob|obj, mob/user as mob) +/obj/item/weapon/grown/novaflower/afterattack(atom/A as mob|obj, mob/user as mob,proximity) + if(!proximity) return if(endurance > 0) endurance -= rand(1,(endurance/3)+1) else @@ -38,7 +39,8 @@ else user.take_organ_damage(0,force) -/obj/item/weapon/grown/nettle/afterattack(atom/A as mob|obj, mob/user as mob) +/obj/item/weapon/grown/nettle/afterattack(atom/A as mob|obj, mob/user as mob,proximity) + if(!proximity) return if(force > 0) force -= rand(1,(force/3)+1) // When you whack someone with it, leaves fall off playsound(loc, 'sound/weapons/bladeslice.ogg', 50, 1, -1) @@ -81,7 +83,8 @@ M.Weaken(force/15) M.drop_item() -/obj/item/weapon/grown/deathnettle/afterattack(atom/A as mob|obj, mob/user as mob) +/obj/item/weapon/grown/deathnettle/afterattack(atom/A as mob|obj, mob/user as mob,proximity) + if(!proximity) return if (force > 0) force -= rand(1,(force/3)+1) // When you whack someone with it, leaves fall off diff --git a/code/modules/hydroponics/hydroitemdefines.dm b/code/modules/hydroponics/hydroitemdefines.dm index ba484f9d5fb..6cadee4b764 100644 --- a/code/modules/hydroponics/hydroitemdefines.dm +++ b/code/modules/hydroponics/hydroitemdefines.dm @@ -20,7 +20,7 @@ name = "weed-spray" icon_state = "weedspray" item_state = "spray" - flags = TABLEPASS | OPENCONTAINER | FPRINT | USEDELAY + flags = TABLEPASS | OPENCONTAINER | FPRINT slot_flags = SLOT_BELT throwforce = 4 w_class = 2.0 @@ -39,7 +39,7 @@ name = "pest-spray" icon_state = "pestspray" item_state = "spray" - flags = TABLEPASS | OPENCONTAINER | FPRINT | USEDELAY + flags = TABLEPASS | OPENCONTAINER | FPRINT slot_flags = SLOT_BELT throwforce = 4 w_class = 2.0 @@ -58,7 +58,7 @@ icon = 'icons/obj/weapons.dmi' icon_state = "hoe" item_state = "hoe" - flags = FPRINT | TABLEPASS | CONDUCT | USEDELAY + flags = FPRINT | TABLEPASS | CONDUCT force = 5.0 throwforce = 7.0 w_class = 2.0 diff --git a/code/modules/mob/inventory.dm b/code/modules/mob/inventory.dm index bd7d35f03d5..212970e9900 100644 --- a/code/modules/mob/inventory.dm +++ b/code/modules/mob/inventory.dm @@ -79,6 +79,7 @@ if(W) if(client) client.screen -= W u_equip(W) + if(!W) return 1 // self destroying objects (tk, grabs) W.layer = initial(W.layer) W.loc = loc diff --git a/code/modules/mob/living/carbon/alien/humanoid/humanoid.dm b/code/modules/mob/living/carbon/alien/humanoid/humanoid.dm index 436f616982e..35055b1a056 100644 --- a/code/modules/mob/living/carbon/alien/humanoid/humanoid.dm +++ b/code/modules/mob/living/carbon/alien/humanoid/humanoid.dm @@ -132,16 +132,6 @@ updatehealth() return - -/mob/living/carbon/alien/humanoid/hand_p(mob/living/carbon/user) - if(user.a_intent == "harm") - if(istype(user.wear_mask, /obj/item/clothing/mask/muzzle)) - return - if(health > 0) - visible_message("[user] has bit [src]!") - adjustBruteLoss(rand(1, 3)) - updatehealth() - /mob/living/carbon/alien/humanoid/attack_paw(mob/living/carbon/monkey/M as mob) if(!ismonkey(M)) return//Fix for aliens receiving double messages when attacking other aliens. diff --git a/code/modules/mob/living/carbon/alien/larva/larva.dm b/code/modules/mob/living/carbon/alien/larva/larva.dm index ccacad6456e..69537b98bbf 100644 --- a/code/modules/mob/living/carbon/alien/larva/larva.dm +++ b/code/modules/mob/living/carbon/alien/larva/larva.dm @@ -135,17 +135,6 @@ updatehealth() return - -/mob/living/carbon/alien/larva/hand_p(mob/living/carbon/user) - if(user.a_intent == "harm") - if(istype(user.wear_mask, /obj/item/clothing/mask/muzzle)) - return - if(health > 0) - visible_message("[user] has bit [src]!") - adjustBruteLoss(rand(1, 3)) - updatehealth() - - /mob/living/carbon/alien/larva/attack_animal(mob/living/simple_animal/M as mob) if(M.melee_damage_upper == 0) M.emote("[M.friendly] [src]") diff --git a/code/modules/mob/living/carbon/human/human.dm b/code/modules/mob/living/carbon/human/human.dm index ebbe0d17232..5adb01ed182 100644 --- a/code/modules/mob/living/carbon/human/human.dm +++ b/code/modules/mob/living/carbon/human/human.dm @@ -228,23 +228,6 @@ return -/mob/living/carbon/human/hand_p(mob/M as mob) - var/dam_zone = pick("chest", "l_hand", "r_hand", "l_leg", "r_leg") - var/datum/limb/affecting = get_organ(ran_zone(dam_zone)) - var/armor = run_armor_check(affecting, "melee") - apply_damage(rand(1,2), BRUTE, affecting, armor) - if(armor >= 2) return - - for(var/datum/disease/D in M.viruses) - if(istype(D, /datum/disease/jungle_fever)) - var/mob/living/carbon/human/H = src - src = null - src = H.monkeyize() - contract_disease(D,1,0) - return - - - /mob/living/carbon/human/attack_animal(mob/living/simple_animal/M as mob) if(M.melee_damage_upper == 0) M.emote("[M.friendly] [src]") diff --git a/code/modules/mob/living/carbon/monkey/monkey.dm b/code/modules/mob/living/carbon/monkey/monkey.dm index cf6b0caeedf..d85711f414d 100644 --- a/code/modules/mob/living/carbon/monkey/monkey.dm +++ b/code/modules/mob/living/carbon/monkey/monkey.dm @@ -80,24 +80,6 @@ //mob/living/carbon/monkey/bullet_act(var/obj/item/projectile/Proj)taken care of in living -/mob/living/carbon/monkey/hand_p(mob/M as mob) - if ((M.a_intent == "harm" && !( istype(wear_mask, /obj/item/clothing/mask/muzzle) ))) - if ((prob(75) && health > 0)) - for(var/mob/O in viewers(src, null)) - O.show_message(text("\red [M.name] has bit []!", src), 1) - var/damage = rand(1, 5) - if (HULK in mutations) damage += 10 - adjustBruteLoss(damage) - updatehealth() - - for(var/datum/disease/D in M.viruses) - if(istype(D, /datum/disease/jungle_fever)) - contract_disease(D,1,0) - else - for(var/mob/O in viewers(src, null)) - O.show_message(text("\red [M.name] has attempted to bite []!", src), 1) - return - /mob/living/carbon/monkey/attack_paw(mob/M as mob) ..() diff --git a/code/modules/paperwork/handlabeler.dm b/code/modules/paperwork/handlabeler.dm index 5381dfc30d6..99abdf8f1c7 100644 --- a/code/modules/paperwork/handlabeler.dm +++ b/code/modules/paperwork/handlabeler.dm @@ -8,7 +8,8 @@ var/mode = 0 -/obj/item/weapon/hand_labeler/afterattack(atom/A, mob/user) +/obj/item/weapon/hand_labeler/afterattack(atom/A, mob/user,proximity) + if(!proximity) return if(!mode) //if it's off, give up. return if(A == loc) // if placing the labeller into something (e.g. backpack) diff --git a/code/modules/paperwork/photography.dm b/code/modules/paperwork/photography.dm index c989ebddf2f..98e98f817b6 100644 --- a/code/modules/paperwork/photography.dm +++ b/code/modules/paperwork/photography.dm @@ -99,7 +99,7 @@ icon_state = "camera" item_state = "electropack" w_class = 2.0 - flags = FPRINT | CONDUCT | USEDELAY | TABLEPASS + flags = FPRINT | CONDUCT | TABLEPASS slot_flags = SLOT_BELT m_amt = 2000 var/pictures_max = 10 diff --git a/code/modules/power/cable.dm b/code/modules/power/cable.dm index 0085de82d59..36a11675bab 100644 --- a/code/modules/power/cable.dm +++ b/code/modules/power/cable.dm @@ -208,7 +208,7 @@ throw_range = 5 m_amt = 50 g_amt = 20 - flags = TABLEPASS | USEDELAY | FPRINT | CONDUCT + flags = TABLEPASS | FPRINT | CONDUCT slot_flags = SLOT_BELT attack_verb = list("whipped", "lashed", "disciplined", "flogged") diff --git a/code/modules/power/lighting.dm b/code/modules/power/lighting.dm index 60103151a03..1ad24c77dc5 100644 --- a/code/modules/power/lighting.dm +++ b/code/modules/power/lighting.dm @@ -726,7 +726,8 @@ // shatter light, unless it was an attempt to put it in a light socket // now only shatter if the intent was harm -/obj/item/weapon/light/afterattack(atom/target, mob/user) +/obj/item/weapon/light/afterattack(atom/target, mob/user,proximity) + if(!proximity) return if(istype(target, /obj/machinery/light)) return if(user.a_intent != "harm") diff --git a/code/modules/projectiles/gun.dm b/code/modules/projectiles/gun.dm index f3d89bb05e3..88e12b1affd 100644 --- a/code/modules/projectiles/gun.dm +++ b/code/modules/projectiles/gun.dm @@ -4,7 +4,7 @@ icon = 'icons/obj/gun.dmi' icon_state = "detective" item_state = "gun" - flags = FPRINT | TABLEPASS | CONDUCT | USEDELAY + flags = FPRINT | TABLEPASS | CONDUCT slot_flags = SLOT_BELT m_amt = 2000 w_class = 3.0 diff --git a/code/modules/projectiles/guns/energy/special.dm b/code/modules/projectiles/guns/energy/special.dm index 20508c797be..89d5a02f585 100644 --- a/code/modules/projectiles/guns/energy/special.dm +++ b/code/modules/projectiles/guns/energy/special.dm @@ -5,7 +5,7 @@ fire_sound = 'sound/weapons/Laser.ogg' origin_tech = "combat=2;magnets=4" w_class = 5 - flags = FPRINT | TABLEPASS | CONDUCT | USEDELAY + flags = FPRINT | TABLEPASS | CONDUCT slot_flags = SLOT_BACK charge_cost = 100 projectile_type = "/obj/item/projectile/ion" @@ -33,7 +33,7 @@ obj/item/weapon/gun/energy/staff icon_state = "staffofchange" item_state = "staffofchange" fire_sound = 'sound/weapons/emitter.ogg' - flags = FPRINT | TABLEPASS | CONDUCT | USEDELAY + flags = FPRINT | TABLEPASS | CONDUCT slot_flags = SLOT_BACK w_class = 5 charge_cost = 200 diff --git a/code/modules/projectiles/guns/projectile/shotgun.dm b/code/modules/projectiles/guns/projectile/shotgun.dm index 30c22961209..9435130db2f 100644 --- a/code/modules/projectiles/guns/projectile/shotgun.dm +++ b/code/modules/projectiles/guns/projectile/shotgun.dm @@ -6,7 +6,7 @@ max_shells = 4 w_class = 4.0 force = 10 - flags = FPRINT | TABLEPASS | CONDUCT | USEDELAY + flags = FPRINT | TABLEPASS | CONDUCT slot_flags = SLOT_BACK caliber = "shotgun" origin_tech = "combat=4;materials=2" @@ -68,7 +68,7 @@ max_shells = 2 w_class = 4.0 force = 10 - flags = FPRINT | TABLEPASS | CONDUCT | USEDELAY + flags = FPRINT | TABLEPASS | CONDUCT slot_flags = SLOT_BACK caliber = "shotgun" origin_tech = "combat=3;materials=1" diff --git a/code/modules/reagents/reagent_containers/dropper.dm b/code/modules/reagents/reagent_containers/dropper.dm index 7a159a76505..465b51d966a 100644 --- a/code/modules/reagents/reagent_containers/dropper.dm +++ b/code/modules/reagents/reagent_containers/dropper.dm @@ -8,7 +8,8 @@ volume = 5 var/filled = 0 - afterattack(obj/target, mob/user , flag) + afterattack(obj/target, mob/user , proximity) + if(!proximity) return if(!target.reagents) return if(filled) diff --git a/code/modules/reagents/reagent_containers/food/condiment.dm b/code/modules/reagents/reagent_containers/food/condiment.dm index d9f196375fb..06fd2b45319 100644 --- a/code/modules/reagents/reagent_containers/food/condiment.dm +++ b/code/modules/reagents/reagent_containers/food/condiment.dm @@ -62,7 +62,8 @@ return - afterattack(obj/target, mob/user , flag) + afterattack(obj/target, mob/user , proximity) + if(!proximity) return if(istype(target, /obj/structure/reagent_dispensers)) //A dispenser. Transfer FROM it TO us. if(!target.reagents.total_volume) diff --git a/code/modules/reagents/reagent_containers/food/drinks.dm b/code/modules/reagents/reagent_containers/food/drinks.dm index 4accb30f147..f0e54d4a086 100644 --- a/code/modules/reagents/reagent_containers/food/drinks.dm +++ b/code/modules/reagents/reagent_containers/food/drinks.dm @@ -67,8 +67,8 @@ return 0 - afterattack(obj/target, mob/user , flag) - + afterattack(obj/target, mob/user , proximity) + if(!proximity) return if(istype(target, /obj/structure/reagent_dispensers)) //A dispenser. Transfer FROM it TO us. if(!target.reagents.total_volume) @@ -380,4 +380,4 @@ ..() reagents.add_reagent("dr_gibb", 30) src.pixel_x = rand(-10.0, 10) - src.pixel_y = rand(-10.0, 10) \ No newline at end of file + src.pixel_y = rand(-10.0, 10) diff --git a/code/modules/reagents/reagent_containers/food/snacks.dm b/code/modules/reagents/reagent_containers/food/snacks.dm index 86bd4060083..725407813b7 100644 --- a/code/modules/reagents/reagent_containers/food/snacks.dm +++ b/code/modules/reagents/reagent_containers/food/snacks.dm @@ -100,7 +100,7 @@ return 0 -/obj/item/weapon/reagent_containers/food/snacks/afterattack(obj/target, mob/user , flag) +/obj/item/weapon/reagent_containers/food/snacks/afterattack(obj/target, mob/user , proximity) return @@ -1323,7 +1323,8 @@ ..() reagents.add_reagent("nutriment",10) - afterattack(obj/O, mob/user) + afterattack(obj/O, mob/user,proximity) + if(!proximity) return if(istype(O,/obj/structure/sink) && !wrapped) user << "You place [src] under a stream of water..." user.drop_item() diff --git a/code/modules/reagents/reagent_containers/glass.dm b/code/modules/reagents/reagent_containers/glass.dm index faeb79687dd..e43e45f3a85 100644 --- a/code/modules/reagents/reagent_containers/glass.dm +++ b/code/modules/reagents/reagent_containers/glass.dm @@ -40,7 +40,8 @@ for(var/datum/reagent/R in reagents.reagent_list) usr << "[R.volume] units of [R.name]" - afterattack(obj/target, mob/user , flag) + afterattack(obj/target, mob/user, proximity) + if(!proximity) return // not adjacent for(var/type in can_be_placed_into) if(istype(target, type)) return diff --git a/code/modules/reagents/reagent_containers/pill.dm b/code/modules/reagents/reagent_containers/pill.dm index 1dcd171b764..79d1e40fbbf 100644 --- a/code/modules/reagents/reagent_containers/pill.dm +++ b/code/modules/reagents/reagent_containers/pill.dm @@ -60,7 +60,8 @@ return 0 - afterattack(obj/target, mob/user , flag) + afterattack(obj/target, mob/user , proximity) + if(!proximity) return if(target.is_open_container() != 0 && target.reagents) if(!target.reagents.total_volume) user << "[target] is empty. There's nothing to dissolve [src] in." diff --git a/code/modules/reagents/reagent_containers/spray.dm b/code/modules/reagents/reagent_containers/spray.dm index 01e29963a6f..c6eef991394 100644 --- a/code/modules/reagents/reagent_containers/spray.dm +++ b/code/modules/reagents/reagent_containers/spray.dm @@ -4,7 +4,7 @@ icon = 'icons/obj/janitor.dmi' icon_state = "cleaner" item_state = "cleaner" - flags = TABLEPASS|OPENCONTAINER|FPRINT|USEDELAY|NOBLUDGEON + flags = TABLEPASS|OPENCONTAINER|FPRINT|NOBLUDGEON slot_flags = SLOT_BELT throwforce = 3 w_class = 2.0 @@ -236,11 +236,12 @@ reagents.add_reagent("plantbgone", 100) -/obj/item/weapon/reagent_containers/spray/plantbgone/afterattack(atom/A as mob|obj, mob/user as mob) - if (istype(A, /obj/machinery/hydroponics)) // We are targeting hydrotray - return +/obj/item/weapon/reagent_containers/spray/plantbgone/afterattack(atom/A as mob|obj, mob/user as mob, proximity) + if(proximity) + if (istype(A, /obj/machinery/hydroponics)) // We are targeting hydrotray + return - if (istype(A, /obj/effect/blob)) // blob damage in blob code - return + if (istype(A, /obj/effect/blob)) // blob damage in blob code + return ..() diff --git a/code/modules/reagents/reagent_containers/syringes.dm b/code/modules/reagents/reagent_containers/syringes.dm index 8d75e1aa21e..763d3c9b7b2 100644 --- a/code/modules/reagents/reagent_containers/syringes.dm +++ b/code/modules/reagents/reagent_containers/syringes.dm @@ -40,7 +40,8 @@ attackby(obj/item/I, mob/user) return - afterattack(obj/target, mob/user , flag) + afterattack(obj/target, mob/user , proximity) + if(!proximity) return if(!target.reagents) return switch(mode) diff --git a/code/modules/recycling/sortingmachinery.dm b/code/modules/recycling/sortingmachinery.dm index 5c58fe129b0..c199516f103 100644 --- a/code/modules/recycling/sortingmachinery.dm +++ b/code/modules/recycling/sortingmachinery.dm @@ -98,7 +98,8 @@ var/amount = 25.0 - afterattack(var/obj/target as obj, mob/user as mob) + afterattack(var/obj/target as obj, mob/user as mob, proximity) + if(!proximity) return if(!istype(target)) //this really shouldn't be necessary (but it is). -Pete return if(istype(target, /obj/item/smallDelivery) || istype(target,/obj/structure/bigDelivery) \