From 6dea43c70990565c9f8b3012727842e9023d084f Mon Sep 17 00:00:00 2001 From: Dorsisdwarf Date: Fri, 24 Nov 2017 23:56:11 +0000 Subject: [PATCH 1/2] Advanced Laserpointer Feline Interaction --- code/__DEFINES/is_helpers.dm | 3 + .../objects/items/devices/laserpointer.dm | 162 ++++++++++++++++++ code/modules/admin/verbs/randomverbs.dm | 11 +- 3 files changed, 168 insertions(+), 8 deletions(-) diff --git a/code/__DEFINES/is_helpers.dm b/code/__DEFINES/is_helpers.dm index 47db1dbc06..1e5e994636 100644 --- a/code/__DEFINES/is_helpers.dm +++ b/code/__DEFINES/is_helpers.dm @@ -59,6 +59,9 @@ #define iszombie(A) (is_species(A, /datum/species/zombie)) #define ishumanbasic(A) (is_species(A, /datum/species/human)) +//why arent catpeople a subspecies +#define iscatperson(A) (ishumanbasic(A) && ( A.dna.features["ears"] == "Cat" || A.dna.features["human_tail"] == "Cat") ) + //more carbon mobs #define ismonkey(A) (istype(A, /mob/living/carbon/monkey)) diff --git a/code/game/objects/items/devices/laserpointer.dm b/code/game/objects/items/devices/laserpointer.dm index eef7a0bf7a..4233a82779 100644 --- a/code/game/objects/items/devices/laserpointer.dm +++ b/code/game/objects/items/devices/laserpointer.dm @@ -16,6 +16,7 @@ var/effectchance = 33 var/recharging = 0 var/recharge_locked = FALSE +<<<<<<< HEAD var/obj/item/stock_parts/micro_laser/diode //used for upgrading! @@ -150,6 +151,167 @@ START_PROCESSING(SSobj, src) if(energy <= 0) to_chat(user, "[src]'s battery is overused, it needs time to recharge!") +======= + var/obj/item/stock_parts/micro_laser/diode //used for upgrading! + + +/obj/item/device/laser_pointer/red + pointer_icon_state = "red_laser" +/obj/item/device/laser_pointer/green + pointer_icon_state = "green_laser" +/obj/item/device/laser_pointer/blue + pointer_icon_state = "blue_laser" +/obj/item/device/laser_pointer/purple + pointer_icon_state = "purple_laser" + +/obj/item/device/laser_pointer/New() + ..() + diode = new(src) + if(!pointer_icon_state) + pointer_icon_state = pick("red_laser","green_laser","blue_laser","purple_laser") + +/obj/item/device/laser_pointer/upgraded/New() + ..() + diode = new /obj/item/stock_parts/micro_laser/ultra + +/obj/item/device/laser_pointer/attackby(obj/item/W, mob/user, params) + if(istype(W, /obj/item/stock_parts/micro_laser)) + if(!diode) + if(!user.transferItemToLoc(W, src)) + return + diode = W + to_chat(user, "You install a [diode.name] in [src].") + else + to_chat(user, "[src] already has a diode installed.") + + else if(istype(W, /obj/item/screwdriver)) + if(diode) + to_chat(user, "You remove the [diode.name] from \the [src].") + diode.loc = get_turf(src.loc) + diode = null + else + return ..() + +/obj/item/device/laser_pointer/afterattack(atom/target, mob/living/user, flag, params) + laser_act(target, user, params) + +/obj/item/device/laser_pointer/proc/laser_act(atom/target, mob/living/user, params) + if( !(user in (viewers(7,target))) ) + return + if (!diode) + to_chat(user, "You point [src] at [target], but nothing happens!") + return + if (!user.IsAdvancedToolUser()) + to_chat(user, "You don't have the dexterity to do this!") + return + if(ishuman(user)) + var/mob/living/carbon/human/H = user + if(H.dna.check_mutation(HULK) || (NOGUNS in H.dna.species.species_traits)) + to_chat(user, "Your fingers can't press the button!") + return + + add_fingerprint(user) + + //nothing happens if the battery is drained + if(recharge_locked) + to_chat(user, "You point [src] at [target], but it's still charging.") + return + + var/outmsg + var/turf/targloc = get_turf(target) + + //human/alien mobs + if(iscarbon(target)) + var/mob/living/carbon/C = target + if(user.zone_selected == "eyes") + add_logs(user, C, "shone in the eyes", src) + + var/severity = 1 + if(prob(33)) + severity = 2 + else if(prob(50)) + severity = 0 + + //chance to actually hit the eyes depends on internal component + if(prob(effectchance * diode.rating) && C.flash_act(severity)) + outmsg = "You blind [C] by shining [src] in their eyes." + else + outmsg = "You fail to blind [C] by shining [src] at their eyes!" + + //robots + else if(iscyborg(target)) + var/mob/living/silicon/S = target + add_logs(user, S, "shone in the sensors", src) + //chance to actually hit the eyes depends on internal component + if(prob(effectchance * diode.rating)) + S.flash_act(affect_silicon = 1) + S.Knockdown(rand(100,200)) + to_chat(S, "Your sensors were overloaded by a laser!") + outmsg = "You overload [S] by shining [src] at their sensors." + else + outmsg = "You fail to overload [S] by shining [src] at their sensors!" + + //cameras + else if(istype(target, /obj/machinery/camera)) + var/obj/machinery/camera/C = target + if(prob(effectchance * diode.rating)) + C.emp_act(EMP_HEAVY) + outmsg = "You hit the lens of [C] with [src], temporarily disabling the camera!" + add_logs(user, C, "EMPed", src) + else + outmsg = "You miss the lens of [C] with [src]!" + + //catpeople + for(var/mob/living/carbon/human/H in view(1,targloc)) + if(!iscatperson(H) || H.incapacitated() || H.eye_blind ) + continue + if(!H.lying) + H.setDir(get_dir(H,targloc)) // kitty always looks at the light + if(prob(effectchance)) + H.visible_message("[H] makes a grab for the light!","LIGHT!") + H.Move(targloc) + add_logs(user, H, "moved with a laser pointer",src) + else + H.visible_message("[H] looks briefly distracted by the light."," You're briefly tempted by the shiny light... ") + else + H.visible_message("[H] stares at the light"," You stare at the light... ") + + //cats! + for(var/mob/living/simple_animal/pet/cat/C in view(1,targloc)) + if(prob(50)) + C.visible_message("[C] pounces on the light!","LIGHT!") + C.Move(targloc) + C.resting = TRUE + C.update_canmove() + else + C.visible_message("[C] looks uninterested in your games.","You spot [user] shining [src] at you. How insulting!") + + //laser pointer image + icon_state = "pointer_[pointer_icon_state]" + var/image/I = image('icons/obj/projectiles.dmi',targloc,pointer_icon_state,10) + var/list/click_params = params2list(params) + if(click_params) + if(click_params["icon-x"]) + I.pixel_x = (text2num(click_params["icon-x"]) - 16) + if(click_params["icon-y"]) + I.pixel_y = (text2num(click_params["icon-y"]) - 16) + else + I.pixel_x = target.pixel_x + rand(-5,5) + I.pixel_y = target.pixel_y + rand(-5,5) + + if(outmsg) + to_chat(user, outmsg) + else + to_chat(user, "You point [src] at [target].") + + energy -= 1 + if(energy <= max_energy) + if(!recharging) + recharging = 1 + START_PROCESSING(SSobj, src) + if(energy <= 0) + to_chat(user, "[src]'s battery is overused, it needs time to recharge!") +>>>>>>> ae9ba7b... Advanced Laserpointer Feline Interaction (#32940) recharge_locked = TRUE flick_overlay_view(I, targloc, 10) diff --git a/code/modules/admin/verbs/randomverbs.dm b/code/modules/admin/verbs/randomverbs.dm index accd8f7dcf..bf12b3eb66 100644 --- a/code/modules/admin/verbs/randomverbs.dm +++ b/code/modules/admin/verbs/randomverbs.dm @@ -1091,9 +1091,6 @@ GLOBAL_LIST_EMPTY(custom_outfits) //Admin created outfits log_admin("[key_name(usr)] sent \"[input]\" as the Tip of the Round.") SSblackbox.record_feedback("tally", "admin_verb", 1, "Show Tip") -#define ON_PURRBATION(H) (\H.getorgan(/obj/item/organ/tail/cat) || H.getorgan(/obj/item/organ/ears/cat) || \ - H.dna.features["ears"] == "Cat" || H.dna.features["human_tail"] == "Cat") - /proc/mass_purrbation() for(var/M in GLOB.mob_list) if(ishumanbasic(M)) @@ -1109,7 +1106,7 @@ GLOBAL_LIST_EMPTY(custom_outfits) //Admin created outfits /proc/purrbation_toggle(mob/living/carbon/human/H, silent = FALSE) if(!ishumanbasic(H)) return - if(!ON_PURRBATION(H)) + if(!iscatperson(H)) purrbation_apply(H, silent) . = TRUE else @@ -1119,7 +1116,7 @@ GLOBAL_LIST_EMPTY(custom_outfits) //Admin created outfits /proc/purrbation_apply(mob/living/carbon/human/H, silent = FALSE) if(!ishuman(H)) return - if(ON_PURRBATION(H)) + if(iscatperson(H)) return var/obj/item/organ/ears/cat/ears = new @@ -1134,7 +1131,7 @@ GLOBAL_LIST_EMPTY(custom_outfits) //Admin created outfits /proc/purrbation_remove(mob/living/carbon/human/H, silent = FALSE) if(!ishuman(H)) return - if(!ON_PURRBATION(H)) + if(!iscatperson(H)) return var/obj/item/organ/ears/cat/ears = H.getorgan(/obj/item/organ/ears/cat) @@ -1173,8 +1170,6 @@ GLOBAL_LIST_EMPTY(custom_outfits) //Admin created outfits if(!silent) to_chat(H, "You are no longer a cat.") -#undef ON_PURRBATION - /client/proc/modify_goals() set category = "Debug" set name = "Modify goals" From 186bcf6ef4900afc3287004356eddcef85a31602 Mon Sep 17 00:00:00 2001 From: deathride58 Date: Fri, 24 Nov 2017 19:03:25 -0500 Subject: [PATCH 2/2] Update laserpointer.dm --- .../objects/items/devices/laserpointer.dm | 191 +++--------------- 1 file changed, 27 insertions(+), 164 deletions(-) diff --git a/code/game/objects/items/devices/laserpointer.dm b/code/game/objects/items/devices/laserpointer.dm index 4233a82779..24d508b8c3 100644 --- a/code/game/objects/items/devices/laserpointer.dm +++ b/code/game/objects/items/devices/laserpointer.dm @@ -1,157 +1,21 @@ -/obj/item/device/laser_pointer - name = "laser pointer" - desc = "Don't shine it in your eyes!" - icon = 'icons/obj/device.dmi' - icon_state = "pointer" - item_state = "pen" - var/pointer_icon_state +/obj/item/device/laser_pointer + name = "laser pointer" + desc = "Don't shine it in your eyes!" + icon = 'icons/obj/device.dmi' + icon_state = "pointer" + item_state = "pen" + var/pointer_icon_state flags_1 = CONDUCT_1 | NOBLUDGEON_1 - slot_flags = SLOT_BELT - materials = list(MAT_METAL=500, MAT_GLASS=500) - w_class = WEIGHT_CLASS_SMALL - origin_tech = "combat=1;magnets=2" - var/turf/pointer_loc - var/energy = 5 - var/max_energy = 5 - var/effectchance = 33 - var/recharging = 0 + slot_flags = SLOT_BELT + materials = list(MAT_METAL=500, MAT_GLASS=500) + w_class = WEIGHT_CLASS_SMALL + origin_tech = "combat=1;magnets=2" + var/turf/pointer_loc + var/energy = 5 + var/max_energy = 5 + var/effectchance = 33 + var/recharging = 0 var/recharge_locked = FALSE -<<<<<<< HEAD - var/obj/item/stock_parts/micro_laser/diode //used for upgrading! - - -/obj/item/device/laser_pointer/red - pointer_icon_state = "red_laser" -/obj/item/device/laser_pointer/green - pointer_icon_state = "green_laser" -/obj/item/device/laser_pointer/blue - pointer_icon_state = "blue_laser" -/obj/item/device/laser_pointer/purple - pointer_icon_state = "purple_laser" - -/obj/item/device/laser_pointer/New() - ..() - diode = new(src) - if(!pointer_icon_state) - pointer_icon_state = pick("red_laser","green_laser","blue_laser","purple_laser") - -/obj/item/device/laser_pointer/upgraded/New() - ..() - diode = new /obj/item/stock_parts/micro_laser/ultra - -/obj/item/device/laser_pointer/attackby(obj/item/W, mob/user, params) - if(istype(W, /obj/item/stock_parts/micro_laser)) - if(!diode) - if(!user.transferItemToLoc(W, src)) - return - diode = W - to_chat(user, "You install a [diode.name] in [src].") - else - to_chat(user, "[src] already has a diode installed.") - - else if(istype(W, /obj/item/screwdriver)) - if(diode) - to_chat(user, "You remove the [diode.name] from \the [src].") - diode.loc = get_turf(src.loc) - diode = null - else - return ..() - -/obj/item/device/laser_pointer/afterattack(atom/target, mob/living/user, flag, params) - laser_act(target, user, params) - -/obj/item/device/laser_pointer/proc/laser_act(atom/target, mob/living/user, params) - if( !(user in (viewers(7,target))) ) - return - if (!diode) - to_chat(user, "You point [src] at [target], but nothing happens!") - return - if (!user.IsAdvancedToolUser()) - to_chat(user, "You don't have the dexterity to do this!") - return - if(ishuman(user)) - var/mob/living/carbon/human/H = user - if(H.dna.check_mutation(HULK) || (NOGUNS in H.dna.species.species_traits)) - to_chat(user, "Your fingers can't press the button!") - return - - add_fingerprint(user) - - //nothing happens if the battery is drained - if(recharge_locked) - to_chat(user, "You point [src] at [target], but it's still charging.") - return - - var/outmsg - var/turf/targloc = get_turf(target) - - //human/alien mobs - if(iscarbon(target)) - var/mob/living/carbon/C = target - if(user.zone_selected == "eyes") - add_logs(user, C, "shone in the eyes", src) - - var/severity = 1 - if(prob(33)) - severity = 2 - else if(prob(50)) - severity = 0 - - //20% chance to actually hit the eyes - if(prob(effectchance * diode.rating) && C.flash_act(severity)) - outmsg = "You blind [C] by shining [src] in their eyes." - else - outmsg = "You fail to blind [C] by shining [src] at their eyes!" - - //robots - else if(iscyborg(target)) - var/mob/living/silicon/S = target - //20% chance to actually hit the sensors - if(prob(effectchance * diode.rating)) - S.flash_act(affect_silicon = 1) - S.Knockdown(rand(100,200)) - to_chat(S, "Your sensors were overloaded by a laser!") - outmsg = "You overload [S] by shining [src] at their sensors." - add_logs(user, S, "shone in the sensors", src) - else - outmsg = "You fail to overload [S] by shining [src] at their sensors!" - - //cameras - else if(istype(target, /obj/machinery/camera)) - var/obj/machinery/camera/C = target - if(prob(effectchance * diode.rating)) - C.emp_act(EMP_HEAVY) - outmsg = "You hit the lens of [C] with [src], temporarily disabling the camera!" - add_logs(user, C, "EMPed", src) - else - outmsg = "You miss the lens of [C] with [src]!" - - //laser pointer image - icon_state = "pointer_[pointer_icon_state]" - var/image/I = image('icons/obj/projectiles.dmi',targloc,pointer_icon_state,10) - var/list/click_params = params2list(params) - if(click_params) - if(click_params["icon-x"]) - I.pixel_x = (text2num(click_params["icon-x"]) - 16) - if(click_params["icon-y"]) - I.pixel_y = (text2num(click_params["icon-y"]) - 16) - else - I.pixel_x = target.pixel_x + rand(-5,5) - I.pixel_y = target.pixel_y + rand(-5,5) - - if(outmsg) - to_chat(user, outmsg) - else - to_chat(user, "You point [src] at [target].") - - energy -= 1 - if(energy <= max_energy) - if(!recharging) - recharging = 1 - START_PROCESSING(SSobj, src) - if(energy <= 0) - to_chat(user, "[src]'s battery is overused, it needs time to recharge!") -======= var/obj/item/stock_parts/micro_laser/diode //used for upgrading! @@ -311,17 +175,16 @@ START_PROCESSING(SSobj, src) if(energy <= 0) to_chat(user, "[src]'s battery is overused, it needs time to recharge!") ->>>>>>> ae9ba7b... Advanced Laserpointer Feline Interaction (#32940) recharge_locked = TRUE - - flick_overlay_view(I, targloc, 10) - icon_state = "pointer" - -/obj/item/device/laser_pointer/process() - if(prob(20 - recharge_locked*5)) - energy += 1 - if(energy >= max_energy) - energy = max_energy - recharging = 0 + + flick_overlay_view(I, targloc, 10) + icon_state = "pointer" + +/obj/item/device/laser_pointer/process() + if(prob(20 - recharge_locked*5)) + energy += 1 + if(energy >= max_energy) + energy = max_energy + recharging = 0 recharge_locked = FALSE - ..() + ..()