From b606a6d1fd86602268f22619006c3a06998b5045 Mon Sep 17 00:00:00 2001 From: Tigercat2000 Date: Sat, 2 Jan 2016 10:46:01 -0800 Subject: [PATCH 1/2] Clean incorrect styling for the ++ operator --- code/__HELPERS/unsorted.dm | 2 +- code/controllers/Processes/air.dm | 2 +- code/game/gamemodes/blob/blob.dm | 4 ++-- code/game/gamemodes/game_mode.dm | 4 ++-- code/game/gamemodes/newobjective.dm | 4 ++-- code/game/gamemodes/objective.dm | 4 ++-- code/game/machinery/bots/floorbot.dm | 2 +- code/game/machinery/magnet.dm | 2 +- .../game/machinery/telecomms/machine_interactions.dm | 12 ++++++------ code/game/turfs/turf.dm | 2 +- code/modules/fish/fishtank.dm | 6 +++--- code/modules/mob/living/living.dm | 1 + code/modules/power/singularity/emitter.dm | 2 +- 13 files changed, 24 insertions(+), 23 deletions(-) diff --git a/code/__HELPERS/unsorted.dm b/code/__HELPERS/unsorted.dm index e37ca4bfb52..d6b0cf70932 100644 --- a/code/__HELPERS/unsorted.dm +++ b/code/__HELPERS/unsorted.dm @@ -1455,7 +1455,7 @@ proc/rotate_icon(file, state, step = 1, aa = FALSE) var w, h, w2, h2 if(aa) - aa ++ + aa++ w = base.Width() w2 = w * aa h = base.Height() diff --git a/code/controllers/Processes/air.dm b/code/controllers/Processes/air.dm index df52e295bcf..58456b76d8b 100644 --- a/code/controllers/Processes/air.dm +++ b/code/controllers/Processes/air.dm @@ -120,7 +120,7 @@ var/global/datum/controller/process/air_system/air_master /datum/controller/process/air_system/proc/process_excited_groups() last_excited = excited_groups.len for(var/datum/excited_group/EG in excited_groups) - EG.breakdown_cooldown ++ + EG.breakdown_cooldown++ if(EG.breakdown_cooldown == 10) EG.self_breakdown() SCHECK diff --git a/code/game/gamemodes/blob/blob.dm b/code/game/gamemodes/blob/blob.dm index 4c8914b9131..655e98141cf 100644 --- a/code/game/gamemodes/blob/blob.dm +++ b/code/game/gamemodes/blob/blob.dm @@ -126,7 +126,7 @@ var/list/blob_nodes = list() spawn(300) burst_blob(blob, 1) else - burst ++ + burst++ log_admin("[key_name(C)] was in space when attempting to burst as a blob.") message_admins("[key_name_admin(C)] was in space when attempting to burst as a blob.") C.gib() @@ -134,7 +134,7 @@ var/list/blob_nodes = list() check_finished() //Still needed in case we can't make any blobs else if(blob_client && location) - burst ++ + burst++ C.gib() var/obj/effect/blob/core/core = new(location, 200, blob_client, blob_point_rate) if(core.overmind && core.overmind.mind) diff --git a/code/game/gamemodes/game_mode.dm b/code/game/gamemodes/game_mode.dm index f2de8d413fd..b9c678c74f7 100644 --- a/code/game/gamemodes/game_mode.dm +++ b/code/game/gamemodes/game_mode.dm @@ -295,13 +295,13 @@ . = 0 for(var/mob/new_player/P in player_list) if(P.client && P.ready) - . ++ + .++ /datum/game_mode/proc/num_players_started() . = 0 for(var/mob/living/carbon/human/H in player_list) if(H.client) - . ++ + .++ /////////////////////////////////// //Keeps track of all living heads// diff --git a/code/game/gamemodes/newobjective.dm b/code/game/gamemodes/newobjective.dm index f8d16134ae9..9b823509edd 100644 --- a/code/game/gamemodes/newobjective.dm +++ b/code/game/gamemodes/newobjective.dm @@ -1281,11 +1281,11 @@ datum if (ticker.current_state == GAME_STATE_SETTING_UP) for(var/mob/new_player/P in world) if(P.client && P.ready && P.mind!=owner) - n_p ++ + n_p++ else if (ticker.current_state == GAME_STATE_PLAYING) for(var/mob/living/carbon/human/P in world) if(P.client && !(P.mind in ticker.mode.changelings) && P.mind!=owner) - n_p ++ + n_p++ target_amount = min(target_amount, n_p) explanation_text = "Absorb [target_amount] compatible genomes." diff --git a/code/game/gamemodes/objective.dm b/code/game/gamemodes/objective.dm index af6ade47e55..b9a53bb2b23 100644 --- a/code/game/gamemodes/objective.dm +++ b/code/game/gamemodes/objective.dm @@ -696,13 +696,13 @@ datum/objective/absorb if(P.client && P.ready && P.mind != owner) if(P.client.prefs && (P.client.prefs.species == "Vox" || P.client.prefs.species == "Slime People" || P.client.prefs.species == "Machine")) // Special check for species that can't be absorbed. No better solution. continue - n_p ++ + n_p++ else if (ticker.current_state == GAME_STATE_PLAYING) for(var/mob/living/carbon/human/P in player_list) if(P.species.flags & NO_SCAN) continue if(P.client && !(P.mind in ticker.mode.changelings) && P.mind!=owner) - n_p ++ + n_p++ target_amount = min(target_amount, n_p) explanation_text = "Absorb [target_amount] compatible genomes." diff --git a/code/game/machinery/bots/floorbot.dm b/code/game/machinery/bots/floorbot.dm index 4c1193aacd6..82ea0138503 100644 --- a/code/game/machinery/bots/floorbot.dm +++ b/code/game/machinery/bots/floorbot.dm @@ -307,7 +307,7 @@ F.ReplaceWithLattice() visible_message("[src] makes an excited booping sound.") spawn(50) - amount ++ + amount++ anchored = 0 mode = BOT_IDLE target = null diff --git a/code/game/machinery/magnet.dm b/code/game/machinery/magnet.dm index edca612efd0..370ebb62713 100644 --- a/code/game/machinery/magnet.dm +++ b/code/game/machinery/magnet.dm @@ -315,7 +315,7 @@ if(href_list["operation"]) switch(href_list["operation"]) if("plusspeed") - speed ++ + speed++ if(speed > 10) speed = 10 if("minusspeed") diff --git a/code/game/machinery/telecomms/machine_interactions.dm b/code/game/machinery/telecomms/machine_interactions.dm index 715f023895e..3cafaed9df8 100644 --- a/code/game/machinery/telecomms/machine_interactions.dm +++ b/code/game/machinery/telecomms/machine_interactions.dm @@ -25,25 +25,25 @@ if(istype(P, /obj/item/weapon/screwdriver)) user << "You unfasten the bolts." playsound(src.loc, 'sound/items/Screwdriver.ogg', 50, 1) - construct_op ++ + construct_op++ if(1) if(istype(P, /obj/item/weapon/screwdriver)) user << "You fasten the bolts." playsound(src.loc, 'sound/items/Screwdriver.ogg', 50, 1) - construct_op -- + construct_op-- if(istype(P, /obj/item/weapon/wrench)) user << "You dislodge the external plating." playsound(src.loc, 'sound/items/Ratchet.ogg', 75, 1) - construct_op ++ + construct_op++ if(2) if(istype(P, /obj/item/weapon/wrench)) user << "You secure the external plating." playsound(src.loc, 'sound/items/Ratchet.ogg', 75, 1) - construct_op -- + construct_op-- if(istype(P, /obj/item/weapon/wirecutters)) playsound(src.loc, 'sound/items/Wirecutter.ogg', 50, 1) user << "You remove the cables." - construct_op ++ + construct_op++ var/obj/item/stack/cable_coil/A = new /obj/item/stack/cable_coil( user.loc ) A.amount = 5 stat |= BROKEN // the machine's been borked! @@ -56,7 +56,7 @@ if(A.amount <= 0) user.drop_item() qdel(A) - construct_op -- + construct_op-- stat &= ~BROKEN // the machine's not borked anymore! if(istype(P, /obj/item/weapon/crowbar)) user << "You begin prying out the circuit board other components..." diff --git a/code/game/turfs/turf.dm b/code/game/turfs/turf.dm index 3dce001a535..ce4908661cd 100644 --- a/code/game/turfs/turf.dm +++ b/code/game/turfs/turf.dm @@ -214,7 +214,7 @@ aco += S.air.carbon_dioxide atox += S.air.toxins atemp += S.air.temperature - turf_count ++ + turf_count++ air.oxygen = (aoxy/max(turf_count,1))//Averages contents of the turfs, ignoring walls and the like air.nitrogen = (anitro/max(turf_count,1)) air.carbon_dioxide = (aco/max(turf_count,1)) diff --git a/code/modules/fish/fishtank.dm b/code/modules/fish/fishtank.dm index 74b639c513b..ba02098e30e 100644 --- a/code/modules/fish/fishtank.dm +++ b/code/modules/fish/fishtank.dm @@ -178,7 +178,7 @@ fish_count = 0 for(var/fish in fish_list) if(fish) - fish_count ++ + fish_count++ //Check if the water level can support the current number of fish if((fish_count * 50) > water_level) @@ -196,7 +196,7 @@ if(fish_count >=2 && egg_count < max_fish) //Need at least 2 fish to breed, but won't breed if there are as many eggs as max_fish if(food_level > 2 && filth_level <=5) //Breeding is going to use extra food, and the filth_level shouldn't be too high if(prob(((fish_count - 2) * 5)+10)) //Chances increase with each additional fish, 10% base + 5% per additional fish - egg_count ++ //A new set of eggs were laid, increase egg_count + egg_count++ //A new set of eggs were laid, increase egg_count egg_list.Add(select_egg_type()) //Add the new egg to the egg_list for storage food_level -= 2 //Remove extra food for the breeding process @@ -305,7 +305,7 @@ //Check if we were passed a fish type if(type) fish_list.Add("[type]") //Add a fish of the specified type - fish_count ++ //Increase fish_count to reflect the introduction of a fish, so the everything else works fine + fish_count++ //Increase fish_count to reflect the introduction of a fish, so the everything else works fine //Announce the new fish src.visible_message("A new [type] has hatched in \the [src]!") //Null type fish are dud eggs, give a message to inform the player diff --git a/code/modules/mob/living/living.dm b/code/modules/mob/living/living.dm index 4f1ed4eb7c9..49488f529ac 100644 --- a/code/modules/mob/living/living.dm +++ b/code/modules/mob/living/living.dm @@ -97,6 +97,7 @@ // ++++ROCKDTBEN++++ MOB PROCS -- Ask me before touching. // Stop! ... Hammertime! ~Carn // I touched them without asking... I'm soooo edgy ~Erro (added nodamage checks) +// no ~Tigerkitty /mob/living/proc/getBruteLoss() return bruteloss diff --git a/code/modules/power/singularity/emitter.dm b/code/modules/power/singularity/emitter.dm index 1eea4bc9d0b..e78ed83fa1f 100644 --- a/code/modules/power/singularity/emitter.dm +++ b/code/modules/power/singularity/emitter.dm @@ -186,7 +186,7 @@ src.last_shot = world.time if(src.shot_number < 3) src.fire_delay = 2 - src.shot_number ++ + src.shot_number++ else src.fire_delay = rand(minimum_fire_delay,maximum_fire_delay) src.shot_number = 0 From 290931300b42b8f94cd51e945cef7a92d6a35657 Mon Sep 17 00:00:00 2001 From: Tigercat2000 Date: Sat, 2 Jan 2016 11:11:15 -0800 Subject: [PATCH 2/2] this has annoyed me for fucking ever --- code/__HELPERS/icons.dm | 290 ++++++++++++++++++++-------------------- 1 file changed, 145 insertions(+), 145 deletions(-) diff --git a/code/__HELPERS/icons.dm b/code/__HELPERS/icons.dm index a9a04a4f621..bcfe46bc138 100644 --- a/code/__HELPERS/icons.dm +++ b/code/__HELPERS/icons.dm @@ -634,168 +634,168 @@ as a single icon. Useful for when you want to manipulate an icon via the above a The _flatIcons list is a cache for generated icon files. */ -proc // Creates a single icon from a given /atom or /image. Only the first argument is required. - getFlatIcon(image/A, defdir=2, deficon=null, defstate="", defblend=BLEND_DEFAULT) - // We start with a blank canvas, otherwise some icon procs crash silently - var/icon/flat = icon('icons/effects/effects.dmi', "icon_state"="nothing") // Final flattened icon - if(!A) - return flat - if(A.alpha <= 0) - return flat - var/noIcon = FALSE +// Creates a single icon from a given /atom or /image. Only the first argument is required. +/proc/getFlatIcon(image/A, defdir=2, deficon=null, defstate="", defblend=BLEND_DEFAULT) + // We start with a blank canvas, otherwise some icon procs crash silently + var/icon/flat = icon('icons/effects/effects.dmi', "icon_state"="nothing") // Final flattened icon + if(!A) + return flat + if(A.alpha <= 0) + return flat + var/noIcon = FALSE - var/curicon - if(A.icon) - curicon = A.icon + var/curicon + if(A.icon) + curicon = A.icon + else + curicon = deficon + + if(!curicon) + noIcon = TRUE // Do not render this object. + + var/curstate + if(A.icon_state) + curstate = A.icon_state + else + curstate = defstate + + if(!noIcon && !(curstate in icon_states(curicon))) + if("" in icon_states(curicon)) + curstate = "" else - curicon = deficon - - if(!curicon) noIcon = TRUE // Do not render this object. - var/curstate - if(A.icon_state) - curstate = A.icon_state - else - curstate = defstate + var/curdir + if(A.dir != 2) + curdir = A.dir + else + curdir = defdir - if(!noIcon && !(curstate in icon_states(curicon))) - if("" in icon_states(curicon)) - curstate = "" - else - noIcon = TRUE // Do not render this object. + var/curblend + if(A.blend_mode == BLEND_DEFAULT) + curblend = defblend + else + curblend = A.blend_mode - var/curdir - if(A.dir != 2) - curdir = A.dir - else - curdir = defdir + // Layers will be a sorted list of icons/overlays, based on the order in which they are displayed + var/list/layers = list() + var/image/copy + // Add the atom's icon itself, without pixel_x/y offsets. + if(!noIcon) + copy = image(icon=curicon, icon_state=curstate, layer=A.layer, dir=curdir) + copy.color = A.color + copy.alpha = A.alpha + copy.blend_mode = curblend + layers[copy] = A.layer - var/curblend - if(A.blend_mode == BLEND_DEFAULT) - curblend = defblend - else - curblend = A.blend_mode - - // Layers will be a sorted list of icons/overlays, based on the order in which they are displayed - var/list/layers = list() - var/image/copy - // Add the atom's icon itself, without pixel_x/y offsets. - if(!noIcon) - copy = image(icon=curicon, icon_state=curstate, layer=A.layer, dir=curdir) - copy.color = A.color - copy.alpha = A.alpha - copy.blend_mode = curblend - layers[copy] = A.layer - - // Loop through the underlays, then overlays, sorting them into the layers list - var/list/process = A.underlays // Current list being processed - var/pSet=0 // Which list is being processed: 0 = underlays, 1 = overlays - var/curIndex=1 // index of 'current' in list being processed - var/current // Current overlay being sorted - var/currentLayer // Calculated layer that overlay appears on (special case for FLOAT_LAYER) - var/compare // The overlay 'add' is being compared against - var/cmpIndex // The index in the layers list of 'compare' - while(TRUE) - if(curIndex<=process.len) - current = process[curIndex] - if(!current) - curIndex++ //Skip this bad layer item - continue - currentLayer = current:layer - if(currentLayer<0) // Special case for FLY_LAYER - if(currentLayer <= -1000) return flat - if(pSet == 0) // Underlay - currentLayer = A.layer+currentLayer/1000 - else // Overlay - currentLayer = A.layer+(1000+currentLayer)/1000 - - // Sort add into layers list - for(cmpIndex=1,cmpIndex<=layers.len,cmpIndex++) - compare = layers[cmpIndex] - if(currentLayer < layers[compare]) // Associated value is the calculated layer - layers.Insert(cmpIndex,current) - layers[current] = currentLayer - break - if(cmpIndex>layers.len) // Reached end of list without inserting - layers[current]=currentLayer // Place at end - - curIndex++ - - if(curIndex>process.len) - if(pSet == 0) // Switch to overlays - curIndex = 1 - pSet = 1 - process = A.overlays - else // All done - break - - var/icon/add // Icon of overlay being added - - // Current dimensions of flattened icon - var/{flatX1=1;flatX2=flat.Width();flatY1=1;flatY2=flat.Height()} - // Dimensions of overlay being added - var/{addX1;addX2;addY1;addY2} - - for(var/I in layers) - - if(I:alpha == 0) + // Loop through the underlays, then overlays, sorting them into the layers list + var/list/process = A.underlays // Current list being processed + var/pSet=0 // Which list is being processed: 0 = underlays, 1 = overlays + var/curIndex=1 // index of 'current' in list being processed + var/current // Current overlay being sorted + var/currentLayer // Calculated layer that overlay appears on (special case for FLOAT_LAYER) + var/compare // The overlay 'add' is being compared against + var/cmpIndex // The index in the layers list of 'compare' + while(TRUE) + if(curIndex<=process.len) + current = process[curIndex] + if(!current) + curIndex++ //Skip this bad layer item continue + currentLayer = current:layer + if(currentLayer<0) // Special case for FLY_LAYER + if(currentLayer <= -1000) return flat + if(pSet == 0) // Underlay + currentLayer = A.layer+currentLayer/1000 + else // Overlay + currentLayer = A.layer+(1000+currentLayer)/1000 - if(I == copy) // 'I' is an /image based on the object being flattened. - curblend = BLEND_OVERLAY - add = icon(I:icon, I:icon_state, I:dir) - // This checks for a silent failure mode of the icon routine. If the requested dir - // doesn't exist in this icon state it returns a 32x32 icon with 0 alpha. - if (I:dir != SOUTH && add.Width() == 32 && add.Height() == 32) - // Check every pixel for blank (computationally expensive, but the process is limited - // by the amount of film on the station, only happens when we hit something that's - // turned, and bails at the very first pixel it sees. - var/blankpixel; - for(var/y;y<=32;y++) - for(var/x;x<32;x++) - blankpixel = isnull(add.GetPixel(x,y)) - if(!blankpixel) - break + // Sort add into layers list + for(cmpIndex=1,cmpIndex<=layers.len,cmpIndex++) + compare = layers[cmpIndex] + if(currentLayer < layers[compare]) // Associated value is the calculated layer + layers.Insert(cmpIndex,current) + layers[current] = currentLayer + break + if(cmpIndex>layers.len) // Reached end of list without inserting + layers[current]=currentLayer // Place at end + + curIndex++ + + if(curIndex>process.len) + if(pSet == 0) // Switch to overlays + curIndex = 1 + pSet = 1 + process = A.overlays + else // All done + break + + var/icon/add // Icon of overlay being added + + // Current dimensions of flattened icon + var/{flatX1=1;flatX2=flat.Width();flatY1=1;flatY2=flat.Height()} + // Dimensions of overlay being added + var/{addX1;addX2;addY1;addY2} + + for(var/I in layers) + + if(I:alpha == 0) + continue + + if(I == copy) // 'I' is an /image based on the object being flattened. + curblend = BLEND_OVERLAY + add = icon(I:icon, I:icon_state, I:dir) + // This checks for a silent failure mode of the icon routine. If the requested dir + // doesn't exist in this icon state it returns a 32x32 icon with 0 alpha. + if (I:dir != SOUTH && add.Width() == 32 && add.Height() == 32) + // Check every pixel for blank (computationally expensive, but the process is limited + // by the amount of film on the station, only happens when we hit something that's + // turned, and bails at the very first pixel it sees. + var/blankpixel; + for(var/y;y<=32;y++) + for(var/x;x<32;x++) + blankpixel = isnull(add.GetPixel(x,y)) if(!blankpixel) break - // If we ALWAYS returned a null (which happens when GetPixel encounters something with alpha 0) - if (blankpixel) - // Pull the default direction. - add = icon(I:icon, I:icon_state) - else // 'I' is an appearance object. - add = getFlatIcon(new/image(I), curdir, curicon, curstate, curblend) + if(!blankpixel) + break + // If we ALWAYS returned a null (which happens when GetPixel encounters something with alpha 0) + if (blankpixel) + // Pull the default direction. + add = icon(I:icon, I:icon_state) + else // 'I' is an appearance object. + add = getFlatIcon(new/image(I), curdir, curicon, curstate, curblend) - // Find the new dimensions of the flat icon to fit the added overlay - addX1 = min(flatX1, I:pixel_x+1) - addX2 = max(flatX2, I:pixel_x+add.Width()) - addY1 = min(flatY1, I:pixel_y+1) - addY2 = max(flatY2, I:pixel_y+add.Height()) + // Find the new dimensions of the flat icon to fit the added overlay + addX1 = min(flatX1, I:pixel_x+1) + addX2 = max(flatX2, I:pixel_x+add.Width()) + addY1 = min(flatY1, I:pixel_y+1) + addY2 = max(flatY2, I:pixel_y+add.Height()) - if(addX1!=flatX1 || addX2!=flatX2 || addY1!=flatY1 || addY2!=flatY2) - // Resize the flattened icon so the new icon fits - flat.Crop(addX1-flatX1+1, addY1-flatY1+1, addX2-flatX1+1, addY2-flatY1+1) - flatX1=addX1;flatX2=addX2 - flatY1=addY1;flatY2=addY2 + if(addX1!=flatX1 || addX2!=flatX2 || addY1!=flatY1 || addY2!=flatY2) + // Resize the flattened icon so the new icon fits + flat.Crop(addX1-flatX1+1, addY1-flatY1+1, addX2-flatX1+1, addY2-flatY1+1) + flatX1=addX1;flatX2=addX2 + flatY1=addY1;flatY2=addY2 - // Blend the overlay into the flattened icon - flat.Blend(add, blendMode2iconMode(curblend), I:pixel_x + 2 - flatX1, I:pixel_y + 2 - flatY1) + // Blend the overlay into the flattened icon + flat.Blend(add, blendMode2iconMode(curblend), I:pixel_x + 2 - flatX1, I:pixel_y + 2 - flatY1) - if(A.color) - flat.Blend(A.color, ICON_MULTIPLY) - if(A.alpha < 255) - flat.Blend(rgb(255, 255, 255, A.alpha), ICON_MULTIPLY) + if(A.color) + flat.Blend(A.color, ICON_MULTIPLY) + if(A.alpha < 255) + flat.Blend(rgb(255, 255, 255, A.alpha), ICON_MULTIPLY) - return icon(flat, "", SOUTH) + return icon(flat, "", SOUTH) - getIconMask(atom/A)//By yours truly. Creates a dynamic mask for a mob/whatever. /N - var/icon/alpha_mask = new(A.icon,A.icon_state)//So we want the default icon and icon state of A. - for(var/I in A.overlays)//For every image in overlays. var/image/I will not work, don't try it. - if(I:layer>A.layer) continue//If layer is greater than what we need, skip it. - var/icon/image_overlay = new(I:icon,I:icon_state)//Blend only works with icon objects. - //Also, icons cannot directly set icon_state. Slower than changing variables but whatever. - alpha_mask.Blend(image_overlay,ICON_OR)//OR so they are lumped together in a nice overlay. - return alpha_mask//And now return the mask. +/proc/getIconMask(atom/A)//By yours truly. Creates a dynamic mask for a mob/whatever. /N + var/icon/alpha_mask = new(A.icon,A.icon_state)//So we want the default icon and icon state of A. + for(var/I in A.overlays)//For every image in overlays. var/image/I will not work, don't try it. + if(I:layer>A.layer) continue//If layer is greater than what we need, skip it. + var/icon/image_overlay = new(I:icon,I:icon_state)//Blend only works with icon objects. + //Also, icons cannot directly set icon_state. Slower than changing variables but whatever. + alpha_mask.Blend(image_overlay,ICON_OR)//OR so they are lumped together in a nice overlay. + return alpha_mask//And now return the mask. /mob/proc/AddCamoOverlay(atom/A)//A is the atom which we are using as the overlay. var/icon/opacity_icon = new(A.icon, A.icon_state)//Don't really care for overlays/underlays.