diff --git a/code/game/atom_procs.dm b/code/game/atom_procs.dm index a02db80540..a317031197 100644 --- a/code/game/atom_procs.dm +++ b/code/game/atom_procs.dm @@ -347,19 +347,17 @@ /atom/Click(location,control,params) //world << "atom.Click() on [src] by [usr] : src.type is [src.type]" - if(usr.client.buildmode) build_click(usr, usr.client.buildmode, location, control, params, src) return - - if(using_new_click_proc) //TODO ERRORAGE (see message below) - return DblClickNew() +// if(using_new_click_proc) //TODO ERRORAGE (see message below) +// return DblClickNew() return DblClick(location, control, params) var/using_new_click_proc = 0 //TODO ERRORAGE (This is temporary, while the DblClickNew() proc is being tested) /atom/proc/DblClickNew() - + if(!usr) return // TODO DOOHL: Intergrate params to new proc. Saved for another time because var/valid_place is a fucking brainfuck //Spamclick server-overloading prevention delay... THING @@ -649,8 +647,7 @@ var/using_new_click_proc = 0 //TODO ERRORAGE (This is temporary, while the DblCl attack_animal(animal) /atom/DblClick(location, control, params) //TODO: DEFERRED: REWRITE -// world << "checking if this shit gets called at all" - + if(!usr) return // ------- TIME SINCE LAST CLICK ------- if (world.time <= usr:lastDblClick+1) @@ -660,51 +657,49 @@ var/using_new_click_proc = 0 //TODO ERRORAGE (This is temporary, while the DblCl // world << "atom.DblClick() on [src] by [usr] : src.type is [src.type]" usr:lastDblClick = world.time - // ------- DIR CHANGING WHEN CLICKING (changes facting direction) ------ + //Putting it here for now. It diverts stuff to the mech clicking procs. Putting it here stops us drilling items in our inventory Carn + if(istype(usr.loc,/obj/mecha)) + if(usr.client && (src in usr.client.screen)) + return + var/obj/mecha/Mech = usr.loc + Mech.click_action(src,usr) + return - if( usr && iscarbon(usr) && !usr.buckled ) + // ------- DIR CHANGING WHEN CLICKING ------ + if( iscarbon(usr) && !usr.buckled ) if( src.x && src.y && usr.x && usr.y ) var/dx = src.x - usr.x var/dy = src.y - usr.y - if( dy > 0 && abs(dx) < dy ) //North - usr.dir = 1 - if( dy < 0 && abs(dx) < abs(dy) ) //South - usr.dir = 2 - if( dx > 0 && abs(dy) <= dx ) //East - usr.dir = 4 - if( dx < 0 && abs(dy) <= abs(dx) ) //West - usr.dir = 8 - if( dx == 0 && dy == 0 ) - if(src.pixel_y > 16) - usr.dir = 1 - if(src.pixel_y < -16) - usr.dir = 2 - if(src.pixel_x > 16) - usr.dir = 4 - if(src.pixel_x < -16) - usr.dir = 8 + if(dy || dx) + if(abs(dx) < abs(dy)) + if(dy > 0) usr.dir = NORTH + else usr.dir = SOUTH + else + if(dx > 0) usr.dir = EAST + else usr.dir = WEST + else + if(pixel_y > 16) usr.dir = NORTH + else if(pixel_y < -16) usr.dir = SOUTH + else if(pixel_x > 16) usr.dir = EAST + else if(pixel_x < -16) usr.dir = WEST // ------- AI ------- - if (istype(usr, /mob/living/silicon/ai)) + else if (istype(usr, /mob/living/silicon/ai)) var/mob/living/silicon/ai/ai = usr if (ai.control_disabled) return // ------- CYBORG ------- - if (istype (usr, /mob/living/silicon/robot)) + else if (istype(usr, /mob/living/silicon/robot)) var/mob/living/silicon/robot/bot = usr if (bot.lockcharge) return ..() - - - - // ------- SHIFT-CLICK ------- if(params) @@ -736,7 +731,7 @@ var/using_new_click_proc = 0 //TODO ERRORAGE (This is temporary, while the DblCl else AICtrlClick(usr) return - } + } // ------- MIDDLE-CLICK ------- @@ -752,17 +747,16 @@ var/using_new_click_proc = 0 //TODO ERRORAGE (This is temporary, while the DblCl // ------- ITEM IN HAND DEFINED ------- var/obj/item/W = usr.get_active_hand() - +/* Now handled by get_active_hand() // ------- ROBOT ------- if(istype(usr, /mob/living/silicon/robot)) if(!isnull(usr:module_active)) W = usr:module_active else W = null - +*/ // ------- ATTACK SELF ------- if (W == src && usr.stat == 0) -// spawn (0) //would cause a runtime if W was deconstructed during a lagspike W.attack_self(usr) if(usr.hand) usr.update_inv_l_hand() //update in-hand overlays @@ -784,19 +778,15 @@ var/using_new_click_proc = 0 //TODO ERRORAGE (This is temporary, while the DblCl return // ------- 1 TILE AWAY ------- - var/t5 = in_range(src, usr) || src.loc == usr - + var/t5 // ------- AI CAN CLICK ANYTHING ------- - if (istype(usr, /mob/living/silicon/ai)) + if(istype(usr, /mob/living/silicon/ai)) t5 = 1 - // ------- CYBORG CAN CLICK ANYTHING WHEN NOT HOLDING STUFF ------- - if ((istype(usr, /mob/living/silicon/robot)) && W == null) + else if(istype(usr, /mob/living/silicon/robot) && !W) t5 = 1 - - // ------- CLICKING ON ORGANS ------- - if (istype(src, /datum/organ) && src in usr.contents) - return + else + t5 = in_range(src, usr) || src.loc == usr // world << "according to dblclick(), t5 is [t5]" diff --git a/code/game/mecha/equipment/mecha_equipment.dm b/code/game/mecha/equipment/mecha_equipment.dm index c253e07569..2a0457d974 100644 --- a/code/game/mecha/equipment/mecha_equipment.dm +++ b/code/game/mecha/equipment/mecha_equipment.dm @@ -82,12 +82,12 @@ return 0 if(!chassis) return 0 - if(energy_drain && !chassis.has_charge(energy_drain)) - return 0 if(!equip_ready) return 0 if(crit_fail) return 0 + if(energy_drain && !chassis.has_charge(energy_drain)) + return 0 return 1 /obj/item/mecha_parts/mecha_equipment/proc/action(atom/target) diff --git a/code/game/mecha/equipment/tools/tools.dm b/code/game/mecha/equipment/tools/tools.dm index 51f88e09de..fceb556013 100644 --- a/code/game/mecha/equipment/tools/tools.dm +++ b/code/game/mecha/equipment/tools/tools.dm @@ -73,6 +73,9 @@ action(atom/target) if(!action_checks(target)) return + if(isobj(target)) + var/obj/target_obj = target + if(target_obj.unacidable) return set_ready_state(0) chassis.use_power(energy_drain) chassis.visible_message("[chassis] starts to drill [target]", "You hear the drill.") @@ -127,6 +130,9 @@ action(atom/target) if(!action_checks(target)) return + if(isobj(target)) + var/obj/target_obj = target + if(target_obj.unacidable) return set_ready_state(0) chassis.use_power(energy_drain) chassis.visible_message("[chassis] starts to drill [target]", "You hear the drill.") diff --git a/code/game/mecha/mecha.dm b/code/game/mecha/mecha.dm index 4d07c21e77..1fd49a4731 100644 --- a/code/game/mecha/mecha.dm +++ b/code/game/mecha/mecha.dm @@ -195,14 +195,14 @@ //////////////////////////// ///// Action processing //// //////////////////////////// - -/client/Click(object,location,control,params) +/* +/atom/DblClick(object,location,control,params) var/mob/M = src.mob if(M && M.in_contents_of(/obj/mecha)) -/* + if(mech_click == world.time) return mech_click = world.time -*/ + if(!istype(object, /atom)) return if(istype(object, /obj/screen)) var/obj/screen/using = object @@ -214,8 +214,9 @@ spawn() //this helps prevent clickspam fest. if (Mech) Mech.click_action(object,M) - else - return ..() +// else +// return ..() +*/ /obj/mecha/proc/click_action(atom/target,mob/user) if(!src.occupant || src.occupant != user ) return diff --git a/code/game/objects/alien/defines.dm b/code/game/objects/alien/defines.dm index da187f6b6d..d7882abba0 100644 --- a/code/game/objects/alien/defines.dm +++ b/code/game/objects/alien/defines.dm @@ -4,14 +4,6 @@ icon = 'alien.dmi' // unacidable = 1 //Aliens won't ment their own. -/obj/effect/alien/head - name = "severed head" - desc = "a severed head..." - icon_state = "weeds" - - density = 0 - anchored = 0 - /obj/effect/alien/resin name = "resin" desc = "Looks like some kind of slimy growth." diff --git a/code/modules/admin/admin.dm b/code/modules/admin/admin.dm index 6344c0f970..60a447e6e0 100644 --- a/code/modules/admin/admin.dm +++ b/code/modules/admin/admin.dm @@ -1417,6 +1417,7 @@ var/global/BSACooldown = 0 //change admin level var/rank = href_list["chgadlvl"] var/client/C = locate(href_list["client4ad"]) + if(!istype(C)) return if(rank == "Remove") C.clear_admin_verbs() C.update_admins(null) @@ -1424,6 +1425,9 @@ var/global/BSACooldown = 0 message_admins("[key_name_admin(usr)] has removed [C]'s adminship", 1) admins.Remove(C.ckey) else + if(C == owner) //no promoting/demoting yourself + message_admins("[C] tried to change their own admin-rank >:(") + return C.clear_admin_verbs() C.update_admins(rank) log_admin("[key_name(usr)] has made [C] a [rank]") diff --git a/code/modules/mob/inventory.dm b/code/modules/mob/inventory.dm index 2a8e2f720a..099a0f2c3e 100644 --- a/code/modules/mob/inventory.dm +++ b/code/modules/mob/inventory.dm @@ -66,7 +66,7 @@ /mob/proc/drop_item_v() //this is dumb. - if(stat == CONSCIOUS) + if(stat == CONSCIOUS && isturf(loc)) return drop_item() return 0 diff --git a/code/modules/mob/living/carbon/alien/humanoid/inventory.dm b/code/modules/mob/living/carbon/alien/humanoid/inventory.dm index 8da6f55459..1705f690b2 100644 --- a/code/modules/mob/living/carbon/alien/humanoid/inventory.dm +++ b/code/modules/mob/living/carbon/alien/humanoid/inventory.dm @@ -21,60 +21,34 @@ /mob/living/carbon/alien/humanoid/db_click(text, t1) var/obj/item/W = get_active_hand() - var/emptyHand = (W == null) - if ((!emptyHand) && (!istype(W, /obj/item))) + if(W && !istype(W)) return - if (emptyHand) - usr.next_move = usr.prev_move - usr:lastDblClick -= 3 //permit the double-click redirection to proceed. + switch(text) - -//if emptyhand then wear the suit, no bedsheet clothes for the alien - if("o_clothing") - if (wear_suit) - if (emptyHand) - wear_suit.DblClick() -// else -// update_inv_wear_suit() - return -/* if (!( istype(W, /obj/item/clothing/suit) )) + if(wear_suit) + if(!W) wear_suit.attack_alien(src) return - u_equip(W) - wear_suit = W - W.get_active_hand(src, text) -*/ + return if("head") - if (head) - if (emptyHand) - head.DblClick() - else if (( istype(W, /obj/effect/alien/head) )) //TODO: figure out wtf this is about ~Carn - u_equip(W) - head = W - update_inv_head() + if(head) + if(!W) head.attack_alien(src) + return return -/* if (!( istype(W, /obj/item/clothing/head) )) - return - u_equip(W) - head = W - W.get_active_hand(src, text) -*/ if("storage1") - if (l_store) - if (emptyHand) - l_store.DblClick() + if(l_store) + if(!W) l_store.attack_alien(src) return - if ((!( istype(W, /obj/item) ) || W.w_class > 3)) + if(W.w_class > 3) return u_equip(W) l_store = W update_inv_pockets() if("storage2") - if (r_store) - if (emptyHand) - r_store.DblClick() + if(r_store) + if(!W) r_store.attack_alien(src) return - if ((!( istype(W, /obj/item) ) || W.w_class > 3)) + if(W.w_class > 3) return u_equip(W) r_store = W diff --git a/code/modules/mob/living/carbon/human/inventory.dm b/code/modules/mob/living/carbon/human/inventory.dm index 06b4cb3830..07fb47832f 100644 --- a/code/modules/mob/living/carbon/human/inventory.dm +++ b/code/modules/mob/living/carbon/human/inventory.dm @@ -1013,65 +1013,41 @@ It can still be worn/put on as normal. /mob/living/carbon/human/db_click(text, t1) var/obj/item/W = get_active_hand() - var/emptyHand = (W == null) - if(emptyHand) - usr.next_move = usr.prev_move - usr:lastDblClick -= 3 //permit the double-click redirection to proceed. - else - if( !istype(W, /obj/item) ) return + if(W && !istype(W)) return switch(text) if("mask") if(wear_mask) - if(emptyHand) - wear_mask.DblClick() + if(!W) wear_mask.attack_hand(src) return - if (!istype(W, /obj/item)) - return - if (!( W.slot_flags & SLOT_MASK )) + if( !(W.slot_flags & SLOT_MASK) ) return u_equip(W) wear_mask = W - if(wear_mask && (wear_mask.flags & BLOCKHAIR)) + if(wear_mask.flags & BLOCKHAIR) update_hair(0) //rebuild hair W.equipped(src, text) update_inv_wear_mask() if("back") - if (back) - if (emptyHand) - back.DblClick() + if(back) + if(!W) back.attack_hand(src) return - if (!istype(W, /obj/item)) + if( !(W.slot_flags & SLOT_BACK) ) return - if (!( W.slot_flags & SLOT_BACK )) - return - if(istype(W,/obj/item/weapon/twohanded) && W:wielded) + if(istype(W,/obj/item/weapon/twohanded) && W:wielded) //TODO usr << "Unwield the [initial(W.name)] first!" return u_equip(W) back = W W.equipped(src, text) update_inv_back() -/* if("headset") - if (ears) - if (emptyHand) - ears.DblClick() - return - if (!( istype(W, /obj/item/device/radio/headset) )) - return - u_equip(W) - w_radio = W - W.equipped(src, text) */ if("o_clothing") - if (wear_suit) - if (emptyHand) - wear_suit.DblClick() + if(wear_suit) + if(!W) wear_suit.attack_hand(src) return - if (!istype(W, /obj/item)) + if( !(W.slot_flags & SLOT_OCLOTHING) ) return - if (!( W.slot_flags & SLOT_OCLOTHING )) - return - if ((FAT in src.mutations) && !(W.flags & ONESIZEFITSALL)) + if( !(W.flags & ONESIZEFITSALL) && (FAT in mutations) ) src << "\red You're too fat to wear the [W.name]!" return u_equip(W) @@ -1079,100 +1055,78 @@ It can still be worn/put on as normal. W.equipped(src, text) update_inv_wear_suit() if("gloves") - if (gloves) - if (emptyHand) - gloves.DblClick() + if(gloves) + if(!W) gloves.attack_hand(src) return - if (!istype(W, /obj/item)) - return - if (!( W.slot_flags & SLOT_GLOVES )) + if( !(W.slot_flags & SLOT_GLOVES) ) return u_equip(W) gloves = W W.equipped(src, text) update_inv_gloves() if("shoes") - if (shoes) - if (emptyHand) - shoes.DblClick() + if(shoes) + if(!W) shoes.attack_hand(src) return - if (!istype(W, /obj/item)) - return - if (!( W.slot_flags & SLOT_FEET )) + if( !( W.slot_flags & SLOT_FEET) ) return u_equip(W) shoes = W W.equipped(src, text) update_inv_shoes() if("belt") - if (belt) - if (emptyHand) - belt.DblClick() + if(belt) + if(!W) belt.attack_hand(src) return - if (!w_uniform) + if(!w_uniform) return - if (!istype(W, /obj/item)) - return - if (!( W.slot_flags & SLOT_BELT )) + if( !(W.slot_flags & SLOT_BELT) ) return u_equip(W) belt = W W.equipped(src, text) update_inv_belt() if("eyes") - if (glasses) - if (emptyHand) - glasses.DblClick() + if(glasses) + if(!W) glasses.attack_hand(src) return - if (!istype(W, /obj/item)) - return - if (!( W.slot_flags & SLOT_EYES )) + if( !(W.slot_flags & SLOT_EYES) ) return u_equip(W) glasses = W W.equipped(src, text) update_inv_glasses() if("head") - if (head) - if (emptyHand) - head.DblClick() + if(head) + if(!W) head.attack_hand(src) return - if (!istype(W, /obj/item)) - return - if (!( W.slot_flags & SLOT_HEAD )) + if( !(W.slot_flags & SLOT_HEAD) ) return u_equip(W) head = W if(head.flags & BLOCKHAIR) - //rebuild hair - update_hair(0) + update_hair(0) //rebuild hair if(istype(W,/obj/item/clothing/head/kitty)) W.update_icon(src) W.equipped(src, text) update_inv_head() if("ears") - if (ears) - if (emptyHand) - ears.DblClick() + if(ears) + if(!W) ears.attack_hand(src) return - if (!istype(W, /obj/item)) - return - if (!( W.slot_flags & SLOT_EARS )) + if( !(W.slot_flags & SLOT_EARS) ) return u_equip(W) ears = W W.equipped(src, text) update_inv_ears() if("i_clothing") - if (w_uniform) - if (emptyHand) - w_uniform.DblClick() + if(w_uniform) + if(!W) w_uniform.attack_hand(src) return - if (!istype(W, /obj/item)) + if( !(W.slot_flags & SLOT_ICLOTHING) ) return - if (!( W.slot_flags & SLOT_ICLOTHING )) - return - if ((FAT in src.mutations) && !(W.flags & ONESIZEFITSALL)) + if( !(W.flags & ONESIZEFITSALL) && (FAT in src.mutations) ) src << "\red You're too fat to wear the [W.name]!" return u_equip(W) @@ -1180,66 +1134,51 @@ It can still be worn/put on as normal. W.equipped(src, text) update_inv_w_uniform() if("id") - if (wear_id) - if (emptyHand) - wear_id.DblClick() + if(wear_id) + if(!W) wear_id.attack_hand(src) return - if (!w_uniform) + if(!w_uniform) return - if (!istype(W, /obj/item)) - return - if (!( W.slot_flags & SLOT_ID )) + if( !(W.slot_flags & SLOT_ID) ) return u_equip(W) wear_id = W W.equipped(src, text) update_inv_wear_id() if("storage1") - if (l_store) - if (emptyHand) - l_store.DblClick() + if(l_store) + if(!W) l_store.attack_hand(src) return - if (!w_uniform) + if(!w_uniform) return - if (!istype(W, /obj/item)) + if(W.slot_flags & SLOT_DENYPOCKET) return - if ( ( W.slot_flags & SLOT_DENYPOCKET ) ) - return - if ( W.w_class <= 2 || ( W.slot_flags & SLOT_POCKET ) ) + if( W.w_class <= 2 || (W.slot_flags & SLOT_POCKET) ) u_equip(W) l_store = W update_inv_pockets() if("storage2") - if (r_store) - if (emptyHand) - r_store.DblClick() + if(r_store) + if(!W) r_store.attack_hand(src) return - if (!w_uniform) + if(!w_uniform) return - if (!istype(W, /obj/item)) + if(W.slot_flags & SLOT_DENYPOCKET) return - if ( ( W.slot_flags & SLOT_DENYPOCKET ) ) - return - if ( W.w_class <= 2 || ( W.slot_flags & SLOT_POCKET ) ) + if( W.w_class <= 2 || (W.slot_flags & SLOT_POCKET) ) u_equip(W) r_store = W update_inv_pockets() if("suit storage") - if (s_store) - if (emptyHand) - s_store.DblClick() + if(s_store) + if(!W) s_store.attack_hand(src) return - var/confirm - if (wear_suit) - if(!wear_suit.allowed) - usr << "You somehow have a suit with no defined allowed items for suit storage, stop that." - return - if (istype(W, /obj/item/device/pda) || istype(W, /obj/item/weapon/pen)) - confirm = 1 - if (is_type_in_list(W, wear_suit.allowed)) - confirm = 1 - if (!confirm) return - else + if(!wear_suit) + return + if(!wear_suit.allowed) + usr << "You somehow have a suit with no defined allowed items for suit storage, stop that." + return + if( istype(W, /obj/item/device/pda) || istype(W, /obj/item/weapon/pen) || is_type_in_list(W, wear_suit.allowed) ) u_equip(W) s_store = W update_inv_s_store() diff --git a/code/modules/mob/mob.dm b/code/modules/mob/mob.dm index f9f0ae8b02..a533952313 100644 --- a/code/modules/mob/mob.dm +++ b/code/modules/mob/mob.dm @@ -108,32 +108,30 @@ //Used by monkeys, *chimpers* //TODO: eliminate this convoluted proc it's incredibly shitty. ~Carn /mob/proc/db_click(text, t1) - var/obj/item/weapon/W = get_active_hand() + var/obj/item/W = get_active_hand() + if(W && !istype(W)) return switch(text) if("mask") - if (wear_mask) + if(wear_mask) return - if (!( W.slot_flags & SLOT_MASK )) + if( !(W.slot_flags & SLOT_MASK) ) return u_equip(W) wear_mask = W W.equipped(src, text) update_inv_wear_mask() if("back") - if (back) + if(back) return - if (!istype(W, /obj/item)) + if( !(W.slot_flags & SLOT_BACK) ) return - if (!( W.slot_flags & SLOT_BACK )) - return - if(istype(W,/obj/item/weapon/twohanded) && W:wielded) + if( istype(W,/obj/item/weapon/twohanded) && W:wielded ) //TODO: Carn usr << "Unwield the [initial(W.name)] first!" return u_equip(W) back = W W.equipped(src, text) update_inv_back() - return /mob/proc/reset_view(atom/A)