diff --git a/code/__DEFINES.dm b/code/__DEFINES.dm index a7e0d755370..ee354b78393 100644 --- a/code/__DEFINES.dm +++ b/code/__DEFINES.dm @@ -59,6 +59,7 @@ #define FPRINT 256 // takes a fingerprint #define ON_BORDER 512 // item has priority to check when entering or leaving #define NOBLUDGEON 4 // when an item has this it produces no "X has been hit by Y with Z" message in the default attackby() +#define NOBLOODY 2048 // used by objects that don't want to get bloodied #define GLASSESCOVERSEYES 1024 #define MASKCOVERSEYES 1024 // get rid of some of the other retardation in these flags diff --git a/code/_onclick/ai.dm b/code/_onclick/ai.dm index 64ae7597982..50c1122b312 100644 --- a/code/_onclick/ai.dm +++ b/code/_onclick/ai.dm @@ -39,12 +39,13 @@ if(modifiers["shift"]) ShiftClickOn(A) return + if(modifiers["alt"]) // alt and alt-gr (rightalt) + AltClickOn(A) + return if(modifiers["ctrl"]) CtrlClickOn(A) return - if(modifiers["alt"]) - AltClickOn(A) - return + if(control_disabled || stat || world.time <= next_move) return next_move = world.time + 9 diff --git a/code/_onclick/click.dm b/code/_onclick/click.dm index aee0405e8cc..5ece365899c 100644 --- a/code/_onclick/click.dm +++ b/code/_onclick/click.dm @@ -49,13 +49,13 @@ if(modifiers["shift"]) ShiftClickOn(A) return + if(modifiers["alt"]) // alt and alt-gr (rightalt) + AltClickOn(A) + return if(modifiers["ctrl"]) CtrlClickOn(A) return - if(modifiers["alt"]) - AltClickOn(A) - return - + if(stat || paralysis || stunned || weakened) return diff --git a/code/_onclick/cyborg.dm b/code/_onclick/cyborg.dm index 8e8e76e1524..640a09d045f 100644 --- a/code/_onclick/cyborg.dm +++ b/code/_onclick/cyborg.dm @@ -22,12 +22,12 @@ if(modifiers["shift"]) ShiftClickOn(A) return + if(modifiers["alt"]) // alt and alt-gr (rightalt) + AltClickOn(A) + return if(modifiers["ctrl"]) CtrlClickOn(A) return - if(modifiers["alt"]) - AltClickOn(A) - return if(stat || lockcharge || weakened || stunned || paralysis) return @@ -94,6 +94,12 @@ W.afterattack(A, src, 0, params) return return + +//Middle click cycles through selected modules. +/mob/living/silicon/robot/MiddleClickOn(var/atom/A) + cycle_modules() + return + /* As with AI, these are not used in click code, because the code for robots is specific, not generic. diff --git a/code/_onclick/hud/screen_objects.dm b/code/_onclick/hud/screen_objects.dm index 6f1b8481bad..1967b48f196 100644 --- a/code/_onclick/hud/screen_objects.dm +++ b/code/_onclick/hud/screen_objects.dm @@ -292,37 +292,16 @@ usr:uneq_active() if("module1") - if(usr:module_state_1) - if(usr:module_active != usr:module_state_1) - usr:inv1.icon_state = "inv1 +a" - usr:inv2.icon_state = "inv2" - usr:inv3.icon_state = "inv3" - usr:module_active = usr:module_state_1 - else - usr:inv1.icon_state = "inv1" - usr:module_active = null + if(istype(usr, /mob/living/silicon/robot)) + usr:toggle_module(1) if("module2") - if(usr:module_state_2) - if(usr:module_active != usr:module_state_2) - usr:inv1.icon_state = "inv1" - usr:inv2.icon_state = "inv2 +a" - usr:inv3.icon_state = "inv3" - usr:module_active = usr:module_state_2 - else - usr:inv2.icon_state = "inv2" - usr:module_active = null + if(istype(usr, /mob/living/silicon/robot)) + usr:toggle_module(2) if("module3") - if(usr:module_state_3) - if(usr:module_active != usr:module_state_3) - usr:inv1.icon_state = "inv1" - usr:inv2.icon_state = "inv2" - usr:inv3.icon_state = "inv3 +a" - usr:module_active = usr:module_state_3 - else - usr:inv3.icon_state = "inv3" - usr:module_active = null + if(istype(usr, /mob/living/silicon/robot)) + usr:toggle_module(3) else return 0 diff --git a/code/game/atoms.dm b/code/game/atoms.dm index a2ac031fe19..1d8231b5be8 100644 --- a/code/game/atoms.dm +++ b/code/game/atoms.dm @@ -247,6 +247,7 @@ var/list/blood_splatter_icons = list() //returns 1 if made bloody, returns 0 otherwise /atom/proc/add_blood(mob/living/carbon/M) + if(flags & NOBLOODY) return if(!initial(icon) || !initial(icon_state)) return 0 if(!istype(M)) diff --git a/code/game/objects/items/devices/radio/intercom.dm b/code/game/objects/items/devices/radio/intercom.dm index 01eb03a4a17..83c7fb7f1c0 100644 --- a/code/game/objects/items/devices/radio/intercom.dm +++ b/code/game/objects/items/devices/radio/intercom.dm @@ -5,13 +5,18 @@ anchored = 1 w_class = 4.0 canhear_range = 2 + flags = FPRINT | CONDUCT | TABLEPASS | NOBLOODY var/number = 0 var/anyai = 1 var/mob/living/silicon/ai/ai = list() + var/last_tick //used to delay the powercheck /obj/item/device/radio/intercom/New() - spawn(5) - checkpower() + ..() + processing_objects += src + +/obj/item/device/radio/intercom/Del() + processing_objects -= src ..() /obj/item/device/radio/intercom/attack_ai(mob/user as mob) @@ -51,10 +56,9 @@ return ..() -/obj/item/device/radio/intercom/proc/checkpower() - - // Simple loop, checks for power. Strictly for intercoms - while(src) +/obj/item/device/radio/intercom/process() + if(((world.timeofday - last_tick) > 30) || ((world.timeofday - last_tick) < 0)) + last_tick = world.timeofday if(!src.loc) on = 0 @@ -69,5 +73,3 @@ icon_state = "intercom-p" else icon_state = "intercom" - - sleep(30) \ No newline at end of file diff --git a/code/game/objects/items/weapons/melee/energy.dm b/code/game/objects/items/weapons/melee/energy.dm index 4117608a6ee..4ddee7c6932 100644 --- a/code/game/objects/items/weapons/melee/energy.dm +++ b/code/game/objects/items/weapons/melee/energy.dm @@ -1,5 +1,6 @@ /obj/item/weapon/melee/energy var/active = 0 + flags = FPRINT | TABLEPASS | NOBLOODY suicide_act(mob/user) viewers(user) << pick("\red [user] is slitting \his stomach open with the [src.name]! It looks like \he's trying to commit seppuku.", \ @@ -15,7 +16,7 @@ throw_speed = 1 throw_range = 5 w_class = 3.0 - flags = FPRINT | CONDUCT | NOSHIELD | TABLEPASS + flags = FPRINT | CONDUCT | NOSHIELD | TABLEPASS | NOBLOODY origin_tech = "combat=3" attack_verb = list("attacked", "chopped", "cleaved", "torn", "cut") @@ -33,7 +34,7 @@ throw_speed = 1 throw_range = 5 w_class = 2.0 - flags = FPRINT | TABLEPASS | NOSHIELD + flags = FPRINT | TABLEPASS | NOSHIELD | NOBLOODY origin_tech = "magnets=3;syndicate=4" attack_verb = list("attacked", "slashed", "stabbed", "sliced", "torn", "ripped", "diced", "cut") var/hacked = 0 @@ -52,6 +53,6 @@ throw_speed = 1 throw_range = 1 w_class = 4.0//So you can't hide it in your pocket or some such. - flags = FPRINT | TABLEPASS | NOSHIELD + flags = FPRINT | TABLEPASS | NOSHIELD | NOBLOODY attack_verb = list("attacked", "slashed", "stabbed", "sliced", "torn", "ripped", "diced", "cut") var/datum/effect/effect/system/spark_spread/spark_system \ No newline at end of file diff --git a/code/modules/hydroponics/grown.dm b/code/modules/hydroponics/grown.dm index bc8ecd7c8b3..14f607285c1 100644 --- a/code/modules/hydroponics/grown.dm +++ b/code/modules/hydroponics/grown.dm @@ -924,7 +924,7 @@ user.SetLuminosity(round(user.luminosity + (potency/10),1)) /obj/item/weapon/reagent_containers/food/snacks/grown/mushroom/glowshroom/dropped(mob/user) - user.SetLuminosity(round(user.luminosity + (potency/10),1)) + user.SetLuminosity(round(user.luminosity - (potency/10),1)) SetLuminosity(round(potency/10,1)) //This object is just a transition object. All it does is make dosh and delete itself. -Cheridan @@ -968,4 +968,4 @@ spawn(5) //So potency can be set in the proc that creates these crops reagents.add_reagent("nutriment", 1+round((potency / 20), 1)) reagents.add_reagent("singulo", 1+round((potency / 5), 1)) - bitesize = 1+round(reagents.total_volume / 2, 1) \ No newline at end of file + bitesize = 1+round(reagents.total_volume / 2, 1) diff --git a/code/modules/mob/living/silicon/robot/inventory.dm b/code/modules/mob/living/silicon/robot/inventory.dm index e6557ff57ed..f3ae6c7e5de 100644 --- a/code/modules/mob/living/silicon/robot/inventory.dm +++ b/code/modules/mob/living/silicon/robot/inventory.dm @@ -53,4 +53,124 @@ else if(module_state_3 == O) return 1 else - return 0 \ No newline at end of file + return 0 + +//Helper procs for cyborg modules on the UI. +//These are hackish but they help clean up code elsewhere. + +//module_selected(module) - Checks whether the module slot specified by "module" is currently selected. +/mob/living/silicon/robot/proc/module_selected(var/module) //Module is 1-3 + return module == get_selected_module() + +//module_active(module) - Checks whether there is a module active in the slot specified by "module". +/mob/living/silicon/robot/proc/module_active(var/module) //Module is 1-3 + if(module < 1 || module > 3) return 0 + + switch(module) + if(1) + if(module_state_1) + return 1 + if(2) + if(module_state_2) + return 1 + if(3) + if(module_state_3) + return 1 + return 0 + +//get_selected_module() - Returns the slot number of the currently selected module. Returns 0 if no modules are selected. +/mob/living/silicon/robot/proc/get_selected_module() + if(module_state_1 && module_active == module_state_1) + return 1 + else if(module_state_2 && module_active == module_state_2) + return 2 + else if(module_state_3 && module_active == module_state_3) + return 3 + + return 0 + +//select_module(module) - Selects the module slot specified by "module" +/mob/living/silicon/robot/proc/select_module(var/module) //Module is 1-3 + if(module < 1 || module > 3) return + + if(!module_active(module)) return + + switch(module) + if(1) + if(module_active != module_state_1) + inv1.icon_state = "inv1 +a" + inv2.icon_state = "inv2" + inv3.icon_state = "inv3" + module_active = module_state_1 + return + if(2) + if(module_active != module_state_2) + inv1.icon_state = "inv1" + inv2.icon_state = "inv2 +a" + inv3.icon_state = "inv3" + module_active = module_state_2 + return + if(3) + if(module_active != module_state_3) + inv1.icon_state = "inv1" + inv2.icon_state = "inv2" + inv3.icon_state = "inv3 +a" + module_active = module_state_3 + return + return + +//deselect_module(module) - Deselects the module slot specified by "module" +/mob/living/silicon/robot/proc/deselect_module(var/module) //Module is 1-3 + if(module < 1 || module > 3) return + + switch(module) + if(1) + if(module_active == module_state_1) + inv1.icon_state = "inv1" + module_active = null + return + if(2) + if(module_active == module_state_2) + inv2.icon_state = "inv2" + module_active = null + return + if(3) + if(module_active == module_state_3) + inv3.icon_state = "inv3" + module_active = null + return + return + +//toggle_module(module) - Toggles the selection of the module slot specified by "module". +/mob/living/silicon/robot/proc/toggle_module(var/module) //Module is 1-3 + if(module < 1 || module > 3) return + + if(module_selected(module)) + deselect_module(module) + else + if(module_active(module)) + select_module(module) + else + deselect_module(get_selected_module()) //If we can't do select anything, at least deselect the current module. + return + +//cycle_modules() - Cycles through the list of selected modules. +/mob/living/silicon/robot/proc/cycle_modules() + var/slot_start = get_selected_module() + if(slot_start) deselect_module(slot_start) //Only deselect if we have a selected slot. + + var/slot_num + if(slot_start == 0) + slot_num = 1 + slot_start = 2 + else + slot_num = slot_start + 1 + + while(slot_start != slot_num) //If we wrap around without finding any free slots, just give up. + if(module_active(slot_num)) + select_module(slot_num) + return + slot_num++ + if(slot_num > 3) slot_num = 1 //Wrap around. + + return diff --git a/code/modules/mob/mob_movement.dm b/code/modules/mob/mob_movement.dm index b5b037519bb..eeef9836d1f 100644 --- a/code/modules/mob/mob_movement.dm +++ b/code/modules/mob/mob_movement.dm @@ -54,73 +54,9 @@ set hidden = 1 if(istype(mob, /mob/living/carbon)) mob:swap_hand() - if(istype(mob,/mob/living/silicon/robot))//Oh nested logic loops, is there anything you can't do? -Sieve + if(istype(mob,/mob/living/silicon/robot)) var/mob/living/silicon/robot/R = mob - if(!R.module_active) - if(!R.module_state_1) - if(!R.module_state_2) - if(!R.module_state_3) - return - else - R:inv1.icon_state = "inv1" - R:inv2.icon_state = "inv2" - R:inv3.icon_state = "inv3 +a" - R:module_active = R:module_state_3 - else - R:inv1.icon_state = "inv1" - R:inv2.icon_state = "inv2 +a" - R:inv3.icon_state = "inv3" - R:module_active = R:module_state_2 - else - R:inv1.icon_state = "inv1 +a" - R:inv2.icon_state = "inv2" - R:inv3.icon_state = "inv3" - R:module_active = R:module_state_1 - else - if(R.module_active == R.module_state_1) - if(!R.module_state_2) - if(!R.module_state_3) - return - else - R:inv1.icon_state = "inv1" - R:inv2.icon_state = "inv2" - R:inv3.icon_state = "inv3 +a" - R:module_active = R:module_state_3 - else - R:inv1.icon_state = "inv1" - R:inv2.icon_state = "inv2 +a" - R:inv3.icon_state = "inv3" - R:module_active = R:module_state_2 - else if(R.module_active == R.module_state_2) - if(!R.module_state_3) - if(!R.module_state_1) - return - else - R:inv1.icon_state = "inv1 +a" - R:inv2.icon_state = "inv2" - R:inv3.icon_state = "inv3" - R:module_active = R:module_state_1 - else - R:inv1.icon_state = "inv1" - R:inv2.icon_state = "inv2" - R:inv3.icon_state = "inv3 +a" - R:module_active = R:module_state_3 - else if(R.module_active == R.module_state_3) - if(!R.module_state_1) - if(!R.module_state_2) - return - else - R:inv1.icon_state = "inv1" - R:inv2.icon_state = "inv2 +a" - R:inv3.icon_state = "inv3" - R:module_active = R:module_state_2 - else - R:inv1.icon_state = "inv1 +a" - R:inv2.icon_state = "inv2" - R:inv3.icon_state = "inv3" - R:module_active = R:module_state_1 - else - return + R.cycle_modules() return diff --git a/icons/obj/power_cond/power_cond_cyan.dmi b/icons/obj/power_cond/power_cond_cyan.dmi index 6e1fa1238e6..34d981f55f7 100644 Binary files a/icons/obj/power_cond/power_cond_cyan.dmi and b/icons/obj/power_cond/power_cond_cyan.dmi differ