Merge pull request #3088 from tigercat2000/code_styling_nazi

January Cleaning
This commit is contained in:
Fox McCloud
2016-01-03 19:42:09 -05:00
14 changed files with 169 additions and 168 deletions
+145 -145
View File
@@ -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.
+1 -1
View File
@@ -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()
+1 -1
View File
@@ -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
+2 -2
View File
@@ -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)
+2 -2
View File
@@ -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//
+2 -2
View File
@@ -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."
+2 -2
View File
@@ -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."
+1 -1
View File
@@ -307,7 +307,7 @@
F.ReplaceWithLattice()
visible_message("<span class='danger'>[src] makes an excited booping sound.</span>")
spawn(50)
amount ++
amount++
anchored = 0
mode = BOT_IDLE
target = null
+1 -1
View File
@@ -315,7 +315,7 @@
if(href_list["operation"])
switch(href_list["operation"])
if("plusspeed")
speed ++
speed++
if(speed > 10)
speed = 10
if("minusspeed")
@@ -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..."
+1 -1
View File
@@ -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))
+3 -3
View File
@@ -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
+1
View File
@@ -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
+1 -1
View File
@@ -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