diff --git a/baystation12.dme b/baystation12.dme index 1c112b009c4..21128d8db28 100644 --- a/baystation12.dme +++ b/baystation12.dme @@ -26,6 +26,7 @@ #define FILE_DIR "code/defines/obj" #define FILE_DIR "code/defines/obj/clothing" #define FILE_DIR "code/defines/procs" +#define FILE_DIR "code/defines/sd_procs" #define FILE_DIR "code/FEA" #define FILE_DIR "code/game" #define FILE_DIR "code/game/area" @@ -352,6 +353,10 @@ #include "code\defines\procs\statistics.dm" #include "code\defines\procs\syndicate_name.dm" #include "code\defines\procs\time_stamp.dm" +#include "code\defines\sd_procs\base64.dm" +#include "code\defines\sd_procs\constants.dm" +#include "code\defines\sd_procs\direction.dm" +#include "code\defines\sd_procs\math.dm" #include "code\FEA\FEA_airgroup.dm" #include "code\FEA\FEA_fire.dm" #include "code\FEA\FEA_gas_mixture.dm" @@ -531,7 +536,7 @@ #include "code\game\machinery\computer\id.dm" #include "code\game\machinery\computer\lockdown.dm" #include "code\game\machinery\computer\medical.dm" -#include "code\game\machinery\computer\Operating.dm" +#include "code\game\machinery\computer\operating.dm" #include "code\game\machinery\computer\power.dm" #include "code\game\machinery\computer\robot.dm" #include "code\game\machinery\computer\security.dm" diff --git a/code/WorkInProgress/Cael_Aislinn/Tajara/tajaran.dm b/code/WorkInProgress/Cael_Aislinn/Tajara/tajaran.dm index b07f634aa9d..3a718e18de5 100644 --- a/code/WorkInProgress/Cael_Aislinn/Tajara/tajaran.dm +++ b/code/WorkInProgress/Cael_Aislinn/Tajara/tajaran.dm @@ -439,6 +439,13 @@ invisibility = 2 else invisibility = 0 + if(targeted_by && target_locked) + overlays += target_locked + else if(targeted_by) + target_locked = new /obj/effect/target_locked(src) + overlays += target_locked + else if(!targeted_by && target_locked) + del(target_locked) /* for (var/mob/M in viewers(1, src))//For the love of god DO NOT REFRESH EVERY SECOND - Mport diff --git a/code/defines/mob/mob.dm b/code/defines/mob/mob.dm index 6bc1b6de22d..4f67c079ec4 100644 --- a/code/defines/mob/mob.dm +++ b/code/defines/mob/mob.dm @@ -41,6 +41,9 @@ var/obj/screen/healths = null var/obj/screen/throw_icon = null var/obj/screen/nutrition_icon = null + var/obj/screen/gun/item/item_use_icon = null + var/obj/screen/gun/move/gun_move_icon = null + var/obj/screen/gun/run/gun_run_icon = null var/total_luminosity = 0 //This controls luminosity for mobs, when you pick up lights and such this is edited. If you want the mob to use lights it must update its lum in its life proc or such. Note clamp this value around 7 or such to prevent massive light lag. var/last_luminosity = 0 diff --git a/code/defines/sd_procs/atom.dm b/code/defines/sd_procs/atom.dm new file mode 100644 index 00000000000..54cbe0ff1d5 --- /dev/null +++ b/code/defines/sd_procs/atom.dm @@ -0,0 +1,32 @@ +/* Atom procs + These procs expand on the basic built in procs. + + Bumped(O) + Automatically called whenever a movable atom O Bump()s into src. + Proc protype designed to be overridden for specific objects. + + Trigger(O) + Automatically called whenever a movable atom O steps into the same + turf with src. + Proc protype designed to be overridden for specific objects. +*/ + +atom + proc + Bumped(O) + // O just Bump()ed into src. + // prototype Bumped() proc for all atoms + Trigger(O) + +atom/movable + + Bump(atom/A) + if(istype(A)) A.Bumped(src) // tell A that src bumped into it + ..() + +turf + Entered(atom/O) + for(var/atom/A in contents - O) + if(O) + O.Trigger(A) + ..() \ No newline at end of file diff --git a/code/defines/sd_procs/base64.dm b/code/defines/sd_procs/base64.dm new file mode 100644 index 00000000000..2b65fef20ca --- /dev/null +++ b/code/defines/sd_procs/base64.dm @@ -0,0 +1,131 @@ +/* base 64 procs + These procs convert plain text to a hexidecimal string to 64 encoded text and vice versa. + + sd_base64toHex(encode64, pad_code = 67) + Accepts a base 64 encoded text and returns the hexidecimal equivalent. + ARGS: + encode64 = the base64 text to convert + pad_code = the character or ASCII code used to pad the base64 text. + DEFAULT: 67 (= sign) + RETURNS: the hexidecimal text + + sd_hex2base64(hextext, pad_char = "=") + Accepts a hexidecimal string and returns the base 64 encoded text equivalent. + ARGS: + hextext = hex text to convert + pad_char = the character or ASCII code used to pad the base64 text. + DEFAULT: "=" (ASCII 67) + RETURNS: the base64 text + + sd_hex2text(hex) + Accepts a hexidecimal string and returns the plain text equivalent. + + sd_text2hex(txt) + Accepts a plain text string and returns the hexidecimal equivalent. +*/ + +/********************************************* +* Implimentation: No need to read further. * +*********************************************/ +proc + sd_base64toHex(encode64, pad_code = 67) + /* convert the base 64 text encode64 to hexidecimal text + pad_code = the character or ASCII code used to pad the base64 text. + DEFAULT: 67 (= sign) + RETURNS: the hexidecimal text */ + var + pos = 1 + offset = 2 + current = 0 + padding = 0 + hextext = "" + if(istext(pad_code)) pad_code = text2ascii(pad_code) + while(pos <= length(encode64)) + var/val = text2ascii(encode64, pos++) + if((val >= 65) && (val <= 90)) // A to Z + val -= 65 + else if((val >= 97) && (val <= 122)) // a to z + val -= 71 + else if((val >= 48) && (val <= 57)) // 0 to 9 + val += 4 + else if(val == 43) // + sign + val = 62 + else if(val == 47) // / symbol + val = 63 + else if(pad_code) // padding + // the = sign indicates that some 0 bits were appended to pad the original string to + val = -1 + padding ++ + else // anything else (presumably whitespace) + val = -1 + if(val < 0) continue // whitespace and padding ignored + + if(offset>2) + var/lft = val >> (8 - offset) + current |= lft + hextext += sd_dec2base(current,,2) + + current = (val << offset) & 0xFF + + offset += 2 + if(offset > 8) + offset = 2 + + if(padding) + hextext = copytext(hextext, 1, length(hextext) + 1 - padding * 2) + return hextext + + sd_hex2base64(hextext, pad_char = "=") + /* convert the hexidecimal string hextext to base 64 encoded text + pad_char = the character or ASCII code used to pad the base64 text. + DEFAULT: "=" (ASCII 67) + RETURNS: the base 64 encoded text */ + var + key64 = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/" + encode64 = "" + pos = 1 + offset = 2 + current = 0 + len = length(hextext) + end = len + padding = end%6 + if(padding) + padding = 6 - padding + end += padding + padding >>= 1 + if(isnum(pad_char)) pad_char = ascii2text(pad_char) + while(pos <= end) + var/val = 0 // pad with 0s + if(pos < len) val = sd_base2dec(copytext(hextext, pos, pos+2)) + pos+=2 + + var/lft = val >> offset + current |= lft + encode64 += copytext(key64,current+1,current+2) + + current = (val << (6-offset)) & 0x3F + + offset += 2 + if(offset>6) + encode64 += copytext(key64,current+1,current+2) + offset = 2 + current = 0 + for(var/x = 1 to padding) + encode64 += pad_char + return encode64 + + sd_hex2text(hex) + /* convert hexidecimal text to a plain text string + RETURNS: the plain text */ + var/txt = "" + for(var/loop = 1 to length(hex) step 2) + txt += ascii2text(sd_base2dec(copytext(hex,loop, loop+2))) + return txt + + sd_text2hex(txt) + /* convert plain text to a hexidecimal string + RETURNS: the hexidecimal text */ + var/hex = "" + for(var/loop = 1 to length(txt)) + hex += sd_dec2base(text2ascii(txt,loop),,2) + return hex \ No newline at end of file diff --git a/code/defines/sd_procs/color.dm b/code/defines/sd_procs/color.dm new file mode 100644 index 00000000000..366227d57f8 --- /dev/null +++ b/code/defines/sd_procs/color.dm @@ -0,0 +1,75 @@ +/* sd_color and procs + sd_color is a special datum that contains color data in various + formats. Sample colors are available in samplecolors.dm. + +sd_color + var + name // the name of the color + red // red componant of the color + green // green componant of the color + blue // red componant of the color + html // html string for the color + icon/Icon // contains the icon produced by the rgb2icon() proc + + PROCS + brightness() + Returns the grayscale brightness of the RGB color set. + + html2rgb() + Calculates the rgb colors from the html colors. + + rgb2html() + Calculates the html color from the rbg colors. + + rgb2icon() + Converts the rgb value to a solid icon stored as src.Icon + +*/ + +/********************************************* +* Implimentation: No need to read further. * +*********************************************/ +sd_color + var + name // the name of the color + red = 0 // red componant of the color + green = 0 // green componant of the color + blue = 0 // red componant of the color + html // html string for the color + icon/Icon // contains the icon produced by the rgb2icon() proc + + proc + brightness() + /* returns the grayscale brightness of the RGB colors. */ + return round((red*30 + green*59 + blue*11)/100,1) + + html2rgb() + /* Calculates the rgb colors from the html colors */ + red = sd_base2dec(copytext(html,1,3)) + green = sd_base2dec(copytext(html,3,5)) + blue = sd_base2dec(copytext(html,5,7)) + + rgb2html() + /* Calculates the html color from the rbg colors */ + html = sd_dec2base(red,,2) + sd_dec2base(green,,2) + sd_dec2base(blue,,2) + return html + + rgb2icon() + /* Converts the rgb value to a solid icon stored as src.Icon */ + Icon = 'Black.dmi' + rgb(red,green,blue) + return Icon + + New() + ..() + // if this is an unnamed subtype, name it according to it's type + if(!name) + name = "[type]" + var/slash = sd_findlast(name,"/") + if(slash) + name = copytext(name,slash+1) + name = sd_replacetext(name,"_"," ") + + if(html) // if there is an html string + html2rgb() // convert the html to red, green, & blue values + else + rgb2html() // convert the red, green, & blue values to html diff --git a/code/defines/sd_procs/constants.dm b/code/defines/sd_procs/constants.dm new file mode 100644 index 00000000000..bb3664aabbc --- /dev/null +++ b/code/defines/sd_procs/constants.dm @@ -0,0 +1 @@ +#define PI 3.141592654 diff --git a/code/defines/sd_procs/direction.dm b/code/defines/sd_procs/direction.dm new file mode 100644 index 00000000000..45a38173fd4 --- /dev/null +++ b/code/defines/sd_procs/direction.dm @@ -0,0 +1,154 @@ +/* Direction procs + These procs deal with BYOND directions. + + sd_get_approx_dir(atom/ref,atom/target) + returns the approximate direction from ref to target. + + sd_degrees2dir(degrees as num) + Accepts an angle in degrees and returns the closest BYOND + direction value. + + sd_dir2degrees(dir as num) + Accepts a BYOND direction value and returns the angle North of + East in degrees. + + sd_dir2radial(dir as num) + Accepts a BYOND direction value and returns the radial direction + (0-7) North of East. + + sd_dir2radians(dir as num) + Accepts a BYOND direction value and returns the angle North of + East in radians. + + sd_dir2text(dir as num) + Accepts a BYOND direction value and returns the lowercase text + name of the direction. + + sd_dir2Text(dir as num) + Accepts a BYOND direction value and returns the Capitalized text + name of the direction + + sd_radial2dir(radial as num) + Accepts a radial direction (0-7) and returns the BYOND direction + value. +*/ + +/********************************************* +* Implimentation: No need to read further. * +*********************************************/ +proc + sd_get_approx_dir(atom/ref,atom/target) + /* returns the approximate direction from ref to target. + Code by Lummox JR + http://www.byond.com/forum/forum.cgi?action=message_list&query=Post+ID%3A153964#153964 + */ + var/d=get_dir(ref,target) + if(d&d-1) // diagonal + var/ax=abs(ref.x-target.x) + var/ay=abs(ref.y-target.y) + if(ax>=ay<<1) return d&12 // keep east/west (4 and 8) + else if(ay>=ax<<1) return d&3 // keep north/south (1 and 2) + return d + + sd_degrees2dir(degrees as num) + /* accepts an angle in degrees and returns the closest BYOND + direction value */ + var/error_report = degrees // for error tracking + + // force angle into a range between 0 and 360 + degrees %= 360 + if(degrees < 0) + degrees += 360 + + // BYOND dirs are at 45 degree angles + degrees = round(degrees,45) + + switch(degrees) + if(0,360) return EAST + if(45) return NORTHEAST + if(90) return NORTH + if(135) return NORTHWEST + if(180) return WEST + if(225) return SOUTHWEST + if(270) return SOUTH + if(315) return SOUTHEAST + else + world.log << "Error in sd_degrees2dir(): [error_report] -> [degrees]" + + sd_dir2degrees(dir as num) + /* accepts a BYOND direction value and returns the angle North of + East in degrees */ + switch(dir) + if(EAST) return 0 + if(NORTHEAST) return 45 + if(NORTH) return 90 + if(NORTHWEST) return 135 + if(WEST) return 180 + if(SOUTHWEST) return 225 + if(SOUTH) return 270 + if(SOUTHEAST) return 315 + + sd_dir2radial(dir as num) + /* accepts a BYOND direction value and returns the radial direction + (0-7) North of East */ + switch(dir) + if(EAST) return 0 + if(NORTHEAST) return 1 + if(NORTH) return 2 + if(NORTHWEST) return 3 + if(WEST) return 4 + if(SOUTHWEST) return 5 + if(SOUTH) return 6 + if(SOUTHEAST) return 7 + + sd_dir2radians(dir as num) + /* accepts a BYOND direction value and returns the angle North of + East in radians */ + switch(dir) + if(EAST) return 0 + if(NORTHEAST) return PI/4 + if(NORTH) return PI/2 + if(NORTHWEST) return PI*3/4 + if(WEST) return PI + if(SOUTHWEST) return PI*5/4 + if(SOUTH) return PI*3/2 + if(SOUTHEAST) return PI*7/4 + + sd_dir2text(dir as num) + /* accepts a direction and returns the lowercase text name of + the direction */ + switch(dir) + if(NORTH) return "north" + if(SOUTH) return "south" + if(EAST) return "east" + if(WEST) return "west" + if(NORTHEAST) return "northeast" + if(SOUTHEAST) return "southeast" + if(NORTHWEST) return "northwest" + if(SOUTHWEST) return "southwest" + + sd_dir2Text(dir as num) + /* accepts a direction and returns the Capitalized text name of + the direction */ + switch(dir) + if(NORTH) return "North" + if(SOUTH) return "South" + if(EAST) return "East" + if(WEST) return "West" + if(NORTHEAST) return "Northeast" + if(SOUTHEAST) return "Southeast" + if(NORTHWEST) return "Northwest" + if(SOUTHWEST) return "Southwest" + + sd_radial2dir(radial as num) + /* accepts a radial direction (0-7) and returns the BYOND direction + value */ + switch(radial) + if(0) return EAST + if(1) return NORTHEAST + if(2) return NORTH + if(3) return NORTHWEST + if(4) return WEST + if(5) return SOUTHWEST + if(6) return SOUTH + if(7) return SOUTHEAST diff --git a/code/defines/sd_procs/hsl.dm b/code/defines/sd_procs/hsl.dm new file mode 100644 index 00000000000..0b71948b7ec --- /dev/null +++ b/code/defines/sd_procs/hsl.dm @@ -0,0 +1,186 @@ +/* HSL procs + These procs convert between RGB (red, green, blu) and HSL (hue, saturation, light) + color spaces. The algorithms used for these procs were found at + http://www.paris-pc-gis.com/MI_Enviro/Colors/color_models.htm + + hsl2rgb(hue, sat, lgh, scale = 240) + Returns the RRGGBB format of an HSL color. + + ALTERNATE FORMAT: + hsl2rgb(HSL, scale) + ARGS: + hue - hue + sat - saturation + lgh - light/dark + HSL - a hex string in format HHSSLL where: + HH = Hue from + SS = Saturation + LL = light + scale - high end of the HSL values. Some programs (like BYOND Dream Maker) + use 240, others use 255. The H {0-360}, S {0-100}, L {0-100} + scale is not supported. + DEFAULT: 240 + RETURNS: + RGB color string in RRGGBB format. + + rgb2hsl(red, grn, blu, scale = 240) + Returns the HSL color string of an RGB color + + ALTERNATE FORMAT: + rgb2hsl(RGB, scale) + ARGS: + red - red componant {0-255} + grn - green componant {0-255} + blu - blue componant {0-255} + RGB - a hex string in format RRGGBB + scale - high end of the HSL values. Some programs (like BYOND Dream Maker) + use 240, others use 255. The H {0-360}, S {0-100}, L {0-100} + scale is not supported. + DEFAULT: 240 + RETURNS: + HHSSLL color string +*/ + +/********************************************* +* Implimentation: No need to read further. * +*********************************************/ + +proc + hsl2rgb(hue, sat, lgh, scale = 240) + /* Returns the RRGGBB format of an HSL color string + algorithm from http://www.paris-pc-gis.com/MI_Enviro/Colors/color_models.htm + ALTERNATE FORMAT: + hsl2rgb(HSL, scale) + ARGS: + hue - hue + sat - saturation + lgh - light/dark + HSL - a hex string in format HHSSLL where: + HH = Hue from + SS = Saturation + LL = light + scale - high end of the HSL values. Some programs (like BYOND Dream Maker) + use 240, others use 255. The H {0-360}, S {0-100}, L {0-100} + scale is not supported. + DEFAULT: 240 + RETURNS: + RGB color string in RRGGBB format. */ + + if(istext(hue)) // used alternate hsl2rgb("HHSSLL", scale) + if(length(hue)!=6) + CRASH("hsl2rbg('[hue]'): text argument must be a 6 character hex code.") + return + if(isnum(sat)) scale = sat + lgh = sd_base2dec(copytext(hue,5)) + sat = sd_base2dec(copytext(hue,3,5)) + hue = sd_base2dec(copytext(hue,1,3)) + + // scale decimal {0-1} + hue /= scale + sat /= scale + lgh /= scale + + var + red + grn + blu + + if(!sat) // greyscale + red = lgh + grn = lgh + blu = lgh + else + var + temp1 + temp2 + temp3 + if(lgh < 0.5) temp2 = lgh * (1 + sat) + else temp2 = lgh + sat - lgh * sat + temp1 = 2 * lgh - temp2 + + // red + temp3 = hue + 1/3 + if(temp3 > 1) temp3-- + if(6*temp3<1) red = temp1 + (temp2 - temp1) * 6 * temp3 + else if(2*temp3<1) red = temp2 + else if(3*temp3<2) red = temp1 + (temp2 - temp1) * ((2/3) - temp3) * 6 + else red = temp1 + + // green + temp3 = hue + if(6*temp3<1) grn = temp1 + (temp2 - temp1) * 6 * temp3 + else if(2*temp3<1) grn = temp2 + else if(3*temp3<2) grn = temp1 + (temp2 - temp1) * ((2/3) - temp3) * 6 + else grn = temp1 + + // blue + temp3 = hue - 1/3 + if(temp3 < 0) temp3++ + if(6*temp3<1) blu = temp1 + (temp2 - temp1) * 6 * temp3 + else if(2*temp3<1) blu = temp2 + else if(3*temp3<2) blu = temp1 + (temp2 - temp1) * ((2/3) - temp3) * 6 + else blu = temp1 + + // shift from {0-1} scale to integers {0-255} + red = round(red*255, 1) + grn = round(grn*255, 1) + blu = round(blu*255, 1) + + // return 6 digit hex string + return sd_dec2base(red,16, 2) + sd_dec2base(grn,16, 2) + sd_dec2base(blu,16, 2) + + + rgb2hsl(red, grn, blu, scale = 240) + /* Returns the HSL color string of a RGB color + algorithm from http://www.paris-pc-gis.com/MI_Enviro/Colors/color_models.htm + ALTERNATE FORMAT: + rgb2hsl(RGB, scale) + ARGS: + red - red componant {0-255} + grn - green componant {0-255} + blu - blue componant {0-255} + RGB - a hex string in format RRGGBB + scale - high end of the HSL values. Some programs (like BYOND Dream Maker) + use 240, others use 255. The H {0-360}, S {0-100}, L {0-100} + scale is not supported. + DEFAULT: 240 + RETURNS: + HHSSLL color string */ + + if(istext(red)) // used alternate rgb2hsl("RRGGBB", scale) format + if(length(red)!=6) + CRASH("rbg2hsl('[red]'): text argument must be a 6 character hex code.") + return + if(isnum(grn)) scale = grn + blu = sd_base2dec(copytext(red,5)) + grn = sd_base2dec(copytext(red,3,5)) + red = sd_base2dec(copytext(red,1,3)) + + // scale decimal {0-1} + red /= 255 + grn /= 255 + blu /= 255 + var + lo = min(red, grn, blu) + hi = max(red, grn, blu) + hue = 0 + sat = 0 + lgh = (lo + hi)/2 + + if(lo != hi) // if equal, hue and sat may both stay 0 + if(lgh < 0.5) sat = (hi - lo) / (hi + lo) + else sat = (hi - lo) / (2 - hi - lo) + // produce hue as value from 0-6 + if(red == hi) hue = (grn - blu) / (hi - lo) + else if(grn == hi) hue = 2 + (blu - red) / (hi - lo) + else hue = 4 + (red - grn) / (hi - lo) + if(hue<0) hue += 6 + + // convert decimal {0-1} to integer {0-scale} + lgh = round(lgh * scale, 1) + sat = round(sat * scale, 1) + // convert hue as decimal 0-6 to integer {0-scale} + hue = round((hue / 6) * scale, 1) + + // return 6 digit hex string + return sd_dec2base(hue,16, 2) + sd_dec2base(sat,16, 2) + sd_dec2base(lgh,16, 2) diff --git a/code/defines/sd_procs/math.dm b/code/defines/sd_procs/math.dm new file mode 100644 index 00000000000..cd3f4ea6ce3 --- /dev/null +++ b/code/defines/sd_procs/math.dm @@ -0,0 +1,117 @@ +/* Math procs + These procs contain basic math routines. + + sd_base2dec(number as text, base = 16 as num) + Accepts a number in any base (2 to 36) and returns the equivelent + value in decimal. + ARGS: + number - number to convert as a text string + base - number base + RETURNS: + decimal value of the number + + sd_dec2base(decimal,base = 16 as num,digits = 0 as num) + Accepts a decimal number and returns the equivelent value in the + new base as a string. + ARGS: + decimal - number to convert + base - new number base + digits - if output is less than digits, it will add + preceeding 0s to pad it out + RETURNS: + equivelent value in the new base as a string + + sd_get_dist(atom/A, atom/B) + Returns the mathematical 3D distance between two atoms. + + sd_get_dist_squared(atom/A, atom/B) + Returns the square of the mathematical 3D distance between two atoms. (More processor + friendly than sd_get_dist() and useful for modelling realworld physics.) +*/ + +/********************************************* +* Implimentation: No need to read further. * +*********************************************/ +proc + sd_base2dec(number as text, base = 16 as num) + /* Accepts a number in any base (2 to 36) and returns the equivelent + value in decimal. + ARGS: + number - number to convert as a text string + base - number base + RETURNS: + decimal value of the number + */ + if(!istext(number)) + world.log << "sd_base2dec: invalid number string- [number]" + return null + if(!isnum(base) || (base < 2) || (base > 36)) + world.log << "sd_base2dec: invalid base - [base]" + return null + + var/decimal = 0 + number = uppertext(number) + + for(var/loop = 1, loop <= lentext(number)) + var/digit = copytext(number,loop,++loop) + if((digit >= "0") && (digit <= "9")) + decimal = decimal * base + text2num(digit) + else if((digit >= "A") && (digit <= "Z")) + decimal = decimal * base + (text2ascii(digit) - 55) + else + break // terminate when it encounters an invalid character + + return decimal + + + sd_dec2base(decimal,base = 16 as num,digits = 0 as num) + /* Accepts a decimal number and returns the equivelent value in the + new base as a string. + ARGS: + decimal - number to convert + base - new number base + digits - if output is less than digits, it will add + preceeding 0s to pad it out + RETURNS: + equivelent value in the new base as a string + */ + if(istext(decimal)) decimal = text2num(decimal) + decimal = round(decimal) + if(!isnum(decimal) || (decimal < 0)) + world.log << "sd_dec2base: invalid decimal number - [decimal]" + return null + if(!isnum(base) || (base < 2) || (base > 36)) + world.log << "sd_dec2base: invalid base - [base]" + return null + + var/text = "" + if(!decimal) text = "0" + while(decimal) + var/n = decimal%base + if(n<10) + text = num2text(n) + text + else + text = ascii2text(55+n) + text + + decimal = (decimal - n)/base + + while(lentext(text) < digits) + text = "0" + text + + return text + + + sd_get_dist(atom/A, atom/B) + /* Returns the mathematical 3D distance between two atoms. */ + var/X = (A.x - B.x) + var/Y = (A.y - B.y) + var/Z = (A.z - B.z) + return sqrt(X * X + Y * Y + Z * Z) + + sd_get_dist_squared(atom/A, atom/B) + /* Returns the square of the mathematical 3D distance between two atoms. (More processor + friendly than sd_get_dist() and useful for modelling realworld physics.) */ + var/X = (A.x - B.x) + var/Y = (A.y - B.y) + var/Z = (A.z - B.z) + return X * X + Y * Y + Z * Z diff --git a/code/defines/sd_procs/nybble.dm b/code/defines/sd_procs/nybble.dm new file mode 100644 index 00000000000..eca85c49ec7 --- /dev/null +++ b/code/defines/sd_procs/nybble.dm @@ -0,0 +1,140 @@ +/* Nybble Colors + Nybble colors is used to compact RGB colors to "nybble" (4 bits, 1 hex + digit, or decimal numbers 0 to 15.) Since BYOND allows up to 16 bits in + bitwise mathematics, you could store up to 4 color values in a single + number. (The project inspiring these procs stores a foreground nybble + color, background nybble color, and 8 bit text character in each 16 bit + number.) + + The value of each bit is: + Bit: 4 3 2 1 + Component: Intensity Red Green Blue + + Nybble color values are: + Dec Hex Bin Color + 0 0 0000 null color. See the note below. + 1 1 0001 dark blue (navy) + 2 2 0010 dark green + 3 3 0011 dark cyan + 4 4 0100 dark red + 5 5 0101 dark magenta + 6 6 0110 brown + 7 7 0111 grey + 8 8 1000 black + 9 9 1001 blue + 10 A 1010 green + 11 B 1011 cyan + 12 C 1100 red + 13 D 1101 magenta + 14 E 1110 yellow + 15 F 1111 white + + Null color note: rgb2nybble() will return a value of 8 for black, so + that you may use 0 value nybbles for special cases in your own code. + For example, in the project that inspired these procs, color 0 + indicates the default background, which is a textured image. + nybble2rgb() will convert values of 0 or 8 to "000000" (or "000" if + you specify short rgb.) + +PROCS + sd_nybble2rgb(original, bit = 8, short = 0) + Converts a nybble color to an RGB hex color string. + ARGS: + value - the number containing the nibble + bit - the MSB (most significant bit) of the nybble. The + default value of 8 uses the lowest 4 bits of original. + DEFAULT: 8 + short - short RGB flag. If this is set, the proc returns a + 3 character RGB string. Otherwise it returns a 6 + character RGB string. + DEFAULT: 0 (return 6 characters) + RETURNS: + A 3 or 6 character hexidecimal RGB color string. + + sd_rgb2nybble(rgb, bit = 8) + Converts an rgb color string to a nybble color. + ARGS: + rgb - The color string to be converted. This may be a 3 or 6 + character color code with or without a leading "#". + Examples: "000", "000000", "#000", "#000000" all + indicate black. + bit - the MSB (most significant bit) of the nybble. You can + use this to shift the position of your nybble within + the return value. The default value of 8 uses the + lowest 4 bits. + DEFAULT: 8 + RETURNS: + A nybble color value or null if the proc failed. +*/ + +/********************************************* +* Implimentation: No need to read further. * +*********************************************/ +proc + sd_nybble2rgb(original, bit = 8, short = 0) + /* Converts a nybble color to an RGB hex color string. + ARGS: + value - the number containing the nibble + bit - the MSB (most significant bit) of the nybble. The + default value of 8 uses the lowest 4 bits of original. + DEFAULT: 8 + short - short RGB flag. If this is set, the proc returns a + 3 character RGB string. Otherwise it returns a 6 + character RGB string. + DEFAULT: 0 (return 6 characters) + RETURNS: + A 3 or 6 character hexidecimal RGB color string. */ + var {intensity = "9"; off = "0"} + if(original & bit) intensity = "F" + if(!short) + intensity += intensity + off = "00" + . = "" + for(var/loop = 1 to 3) + bit >>= 1 + if(original & bit) . += intensity + else . += off + if(. == "990") . = "940" + else if(. == "999900") . = "994400" + if(intensity == "F" && . == "000000") . = "00FF99" + + sd_rgb2nybble(rgb, bit = 8) + /* Converts an rgb color string to a nybble color. + ARGS: + rgb - The color string to be converted. This may be a 3 or 6 + character color code with or without a leading "#". + Examples: "000", "000000", "#000", "#000000" all + indicate black. + bit - the MSB (most significant bit) of the nybble. You can + use this to shift the position of your nybble within + the return value. The default value of 8 uses the + lowest 4 bits. + DEFAULT: 8 + RETURNS: + A nybble color value or null if the proc failed. */ + if(!istext(rgb)) return + if(text2ascii(rgb) == 35) // leading "#" + rgb = copytext(rgb,2) + var{char; cmp[3]; cmp_size; hi = 0; loop; pos = 1} + switch(length(rgb)) + if(3) cmp_size = 1 + if(6) cmp_size = 2 + else return + for(loop = 1 to 3) + char = copytext(rgb, pos, pos+1) + // char 0 to 3 => 0, 4 to 9 => 1, A to F => 2 + // cmp[loop] = round(sd_base2dec(char, 16) * 0.15, 1) + // previous line takes over twice as long as switch() method below + switch(char) + if("0", "1", "2", "3") cmp[loop] = 0 + if("4", "5", "6", "7", "8", "9") cmp[loop] = 1 + else cmp[loop] = 2 + if(cmp[loop] > hi) hi = cmp[loop] + pos += cmp_size + switch(hi) + if(0) return bit // color 8: black + if(2) . = bit // high intensity + else . = 0 // low intensity + for(loop = 1 to 3) + bit >>= 1 + if(cmp[loop] == hi) . |= bit diff --git a/code/defines/sd_procs/samplecolors.dm b/code/defines/sd_procs/samplecolors.dm new file mode 100644 index 00000000000..96a6bebebdb --- /dev/null +++ b/code/defines/sd_procs/samplecolors.dm @@ -0,0 +1,310 @@ +/* Sample sd_colors. This file will not automatically be included in your + projects, since you may want to define them differently. + +Colors can be defined by rgb values: + sd_color/blue + red = 0 + green = 0 + blue = 255 + +Colors can be defined by HTML values: + sd_color/green + html = "00FF00" + +Colors can be defined by just overriding selective rgb values: + sd_color/red + red = 255 + magenta + // still has red = 255, since it is a child of red + blue = 255 +*/ + +/****************************************************** +* Here 142 colors you might like to use from * +* http://www.w3schools.com/html/html_colornames.asp * +******************************************************/ +sd_color + AliceBlue + html = "F0F8FF" + AntiqueWhite + html = "FAEBD7" + Aqua + html = "00FFFF" + Aquamarine + html = "7FFFD4" + Azure + html = "F0FFFF" + Beige + html = "F5F5DC" + Bisque + html = "FFE4C4" + Black + html = "000000" + BlanchedAlmond + html = "FFEBCD" + Blue + html = "0000FF" + BlueViolet + html = "8A2BE2" + Brown + html = "A52A2A" + BurlyWood + html = "DEB887" + CadetBlue + html = "5F9EA0" + Chartreuse + html = "7FFF00" + Chocolate + html = "D2691E" + Coral + html = "FF7F50" + CornflowerBlue + html = "6495ED" + Cornsilk + html = "FFF8DC" + Crimson + html = "DC143C" + Cyan + html = "00FFFF" + DarkBlue + html = "00008B" + DarkCyan + html = "008B8B" + DarkGoldenRod + html = "B8860B" + DarkGray + html = "A9A9A9" + DarkGreen + html = "006400" + DarkKhaki + html = "BDB76B" + DarkMagenta + html = "8B008B" + DarkOliveGreen + html = "556B2F" + Darkorange + html = "FF8C00" + DarkOrchid + html = "9932CC" + DarkRed + html = "8B0000" + DarkSalmon + html = "E9967A" + DarkSeaGreen + html = "8FBC8F" + DarkSlateBlue + html = "483D8B" + DarkSlateGray + html = "2F4F4F" + DarkTurquoise + html = "00CED1" + DarkViolet + html = "9400D3" + DeepPink + html = "FF1493" + DeepSkyBlue + html = "00BFFF" + DimGray + html = "696969" + DodgerBlue + html = "1E90FF" + FireBrick + html = "B22222" + FloralWhite + html = "FFFAF0" + ForestGreen + html = "228B22" + Fuchsia + html = "FF00FF" + Gainsboro + html = "DCDCDC" + GhostWhite + html = "F8F8FF" + Gold + html = "FFD700" + GoldenRod + html = "DAA520" + Gray + html = "808080" + Green + html = "008000" + GreenYellow + html = "ADFF2F" + HoneyDew + html = "F0FFF0" + HotPink + html = "FF69B4" + IndianRed + html = "CD5C5C" + Indigo + html = "4B0082" + Ivory + html = "FFFFF0" + Khaki + html = "F0E68C" + Lavender + html = "E6E6FA" + LavenderBlush + html = "FFF0F5" + LawnGreen + html = "7CFC00" + LemonChiffon + html = "FFFACD" + LightBlue + html = "ADD8E6" + LightCoral + html = "F08080" + LightCyan + html = "E0FFFF" + LightGoldenRodYellow + html = "FAFAD2" + LightGrey + html = "D3D3D3" + LightGreen + html = "90EE90" + LightPink + html = "FFB6C1" + LightSalmon + html = "FFA07A" + LightSeaGreen + html = "20B2AA" + LightSkyBlue + html = "87CEFA" + LightSlateBlue + html = "8470FF" + LightSlateGray + html = "778899" + LightSteelBlue + html = "B0C4DE" + LightYellow + html = "FFFFE0" + Lime + html = "00FF00" + LimeGreen + html = "32CD32" + Linen + html = "FAF0E6" + Magenta + html = "FF00FF" + Maroon + html = "800000" + MediumAquaMarine + html = "66CDAA" + MediumBlue + html = "0000CD" + MediumOrchid + html = "BA55D3" + MediumPurple + html = "9370D8" + MediumSeaGreen + html = "3CB371" + MediumSlateBlue + html = "7B68EE" + MediumSpringGreen + html = "00FA9A" + MediumTurquoise + html = "48D1CC" + MediumVioletRed + html = "C71585" + MidnightBlue + html = "191970" + MintCream + html = "F5FFFA" + MistyRose + html = "FFE4E1" + Moccasin + html = "FFE4B5" + NavajoWhite + html = "FFDEAD" + Navy + html = "000080" + OldLace + html = "FDF5E6" + Olive + html = "808000" + OliveDrab + html = "6B8E23" + Orange + html = "FFA500" + OrangeRed + html = "FF4500" + Orchid + html = "DA70D6" + PaleGoldenRod + html = "EEE8AA" + PaleGreen + html = "98FB98" + PaleTurquoise + html = "AFEEEE" + PaleVioletRed + html = "D87093" + PapayaWhip + html = "FFEFD5" + PeachPuff + html = "FFDAB9" + Peru + html = "CD853F" + Pink + html = "FFC0CB" + Plum + html = "DDA0DD" + PowderBlue + html = "B0E0E6" + Purple + html = "800080" + Red + html = "FF0000" + RosyBrown + html = "BC8F8F" + RoyalBlue + html = "4169E1" + SaddleBrown + html = "8B4513" + Salmon + html = "FA8072" + SandyBrown + html = "F4A460" + SeaGreen + html = "2E8B57" + SeaShell + html = "FFF5EE" + Sienna + html = "A0522D" + Silver + html = "C0C0C0" + SkyBlue + html = "87CEEB" + SlateBlue + html = "6A5ACD" + SlateGray + html = "708090" + Snow + html = "FFFAFA" + SpringGreen + html = "00FF7F" + SteelBlue + html = "4682B4" + Tan + html = "D2B48C" + Teal + html = "008080" + Thistle + html = "D8BFD8" + Tomato + html = "FF6347" + Turquoise + html = "40E0D0" + Violet + html = "EE82EE" + VioletRed + html = "D02090" + Wheat + html = "F5DEB3" + White + html = "FFFFFF" + WhiteSmoke + html = "F5F5F5" + Yellow + html = "FFFF00" + YellowGreen + html = "9ACD32" diff --git a/code/defines/sd_procs/sd_procs.dm b/code/defines/sd_procs/sd_procs.dm new file mode 100644 index 00000000000..16de19f4743 --- /dev/null +++ b/code/defines/sd_procs/sd_procs.dm @@ -0,0 +1,161 @@ +/* sd_procs + by: Shadowdarke (shadowdarke@hotmail.com) + + A collection of general purpose procs I use often in + other projects. + +The following is a summary of all the procs and other additions included in +the sd_procs library. Please refer to the specific file for detailed information. + + +Atom (atom.dm) + These procs expand on the basic built in procs. + + Bumped(O) + Automatically called whenever a movable atom O Bump()s into src. + Proc protype designed to be overridden for specific objects. + + Trigger(O) + Automatically called whenever a movable atom O steps into the same + turf with src. + Proc protype designed to be overridden for specific objects. + + +Base 64 (base64.dm) + These procs convert plain text to a hexidecimal string to 64 encoded text and vice versa. + + sd_base64toHex(encode64, pad_code = 67) + Accepts a base 64 encoded text and returns the hexidecimal equivalent. + + sd_hex2base64(hextext, pad_char = "=") + Accepts a hexidecimal string and returns the base 64 encoded text equivalent. + + sd_hex2text(hex) + Accepts a hexidecimal string and returns the plain text equivalent. + + sd_text2hex(txt) + Accepts a plain text string and returns the hexidecimal equivalent. + + +Colors(color.dm) + sd_color + sd_color is a special datum that contains color data in various + formats. Sample colors are available in samplecolors.dm. + VARS + name // the name of the color + red // red componant of the color + green // green componant of the color + blue // red componant of the color + html // html string for the color + icon/Icon // contains the icon produced by rgb2icon() proc + + PROCS + brightness() + Returns the grayscale brightness of the RGB color set. + + html2rgb() + Calculates the rgb colors from the html colors. + + rgb2html() + Calculates the html color from the rbg colors. + + rgb2icon() + Converts the rgb value to a solid icon stored as src.Icon + +Direction procs (direction.dm) + sd_get_approx_dir(atom/ref,atom/target) + returns the approximate direction from ref to target. + + sd_degrees2dir(degrees as num) + Accepts an angle in degrees and returns the closest BYOND + direction value. + + sd_dir2degrees(dir as num) + Accepts a BYOND direction value and returns the angle North of + East in degrees. + + sd_dir2radial(dir as num) + Accepts a BYOND direction value and returns the radial direction + (0-7) North of East. + + sd_dir2radians(dir as num) + Accepts a BYOND direction value and returns the angle North of + East in radians. + + sd_dir2text(dir as num) + Accepts a BYOND direction value and returns the lowercase text + name of the direction. + + sd_dir2Text(dir as num) + Accepts a BYOND direction value and returns the Capitalized text + name of the direction + + sd_radial2dir(radial as num) + Accepts a radial direction (0-7) and returns the BYOND direction + value. + +HSL procs (hsl.dm) + hsl2rgb(hue, sat, lgh, scale = 240) + Returns the RRGGBB format of an HSL color. + ALTERNATE FORMAT: hsl2rgb(HSL, scale) + + rgb2hsl(red, grn, blu, scale = 240) + Returns the HHSSLL string of an RGB color + ALTERNATE FORMAT: rgb2hsl(RGB, scale) + +Math procs (math.dm) + sd_base2dec(number as text, base = 16 as num) + Accepts a number in any base (2 to 36) and returns the equivelent + value in decimal. + + sd_dec2base(decimal,base = 16 as num,digits = 0 as num) + Accepts a decimal number and returns the equivelent value in the + new base as a string. + + sd_get_dist(atom/A, atom/B) + Returns the mathematical 3D distance between two atoms. + + sd_get_dist_squared(atom/A, atom/B) + Returns the square of the mathematical 3D distance between two atoms. (More processor + friendly than sd_get_dist() and useful for modelling realworld physics.) + +Nybble Color procs (nybble.dm) + sd_nybble2rgb(original, bit = 8, short = 0) + Converts a nybble color to a hexidecimal RGB color string. + + sd_rgb2nybble(rgb, bit = 8) + Converts an RGB color string to a nybble color. + + +Sample sd_colors. (samplecolors.dm) + This file includes 142 predefined sd_colors. It will not automatically + be included in your projects, since you may want to define them differently. + + +Test program (test.dm) + This file provides a brief demo of some library functions. + It is not included in your projects. + + +Text procs (text.dm) + sd_findlast(maintext as text, searchtext as text) + Returns the location of the last instance of searchtext in + maintext. sd_findlast is not case sensitive. + + sd_findLast(maintext as text, searchtext as text) + Returns the location of the last instance of searchtext in + maintext. sd_findLast is case sensitive. + + sd_htmlremove(T as text) + Returns the text string with all potential html tags (anything + between < and >) removed. + + sd_replacetext(maintext as text, oldtext as text, newtext as text) + Replaces all instances of oldtext within maintext with newtext. + sd_replacetext is not case sensitive. + + sd_replaceText(maintext as text, oldtext as text, newtext as text) + Replaces all instances of oldtext within maintext with newtext. + sd_replaceText is case sensitive. + +*/ \ No newline at end of file diff --git a/code/defines/sd_procs/text.dm b/code/defines/sd_procs/text.dm new file mode 100644 index 00000000000..88b410bd2b7 --- /dev/null +++ b/code/defines/sd_procs/text.dm @@ -0,0 +1,89 @@ +/* Text procs + These procs manipulate text strings. + + sd_findlast(maintext as text, searchtext as text) + Returns the location of the last instance of searchtext in + maintext. sd_findlast is not case sensitive. + + sd_findLast(maintext as text, searchtext as text) + Returns the location of the last instance of searchtext in + maintext. sd_findLast is case sensitive. + + sd_htmlremove(T as text) + Returns the text string with all potential html tags (anything + between < and >) removed. + + sd_replacetext(maintext as text, oldtext as text, newtext as text) + Replaces all instances of oldtext within maintext with newtext. + sd_replacetext is not case sensitive. + + sd_replaceText(maintext as text, oldtext as text, newtext as text) + Replaces all instances of oldtext within maintext with newtext. + sd_replaceText is case sensitive. +*/ + +/********************************************* +* Implimentation: No need to read further. * +*********************************************/ +proc + sd_findlast(maintext as text, searchtext as text) + /* Returns the location of the last instance of searchtext in + maintext. sd_findlast is not case sensitive. */ + var/loc = 0 + var/looking = findtext(maintext, searchtext) + while(looking) + loc = looking + looking = findtext(maintext, searchtext, looking + 1) + return loc + + sd_findLast(maintext as text, searchtext as text) + /* Returns the location of the last instance of searchtext in + maintext. sd_findLast is case sensitive. */ + var/loc = 0 + var/looking = findText(maintext, searchtext) + while(looking) + loc = looking + looking = findText(maintext, searchtext, looking + 1) + return loc + + + sd_htmlremove(T as text) + /* Returns the text string with all potential html tags (anything + between < and >) removed. */ + T = sd_replacetext(T, " ","") + var/open = findtext(T,"<") + while(open) + var/close = findtext(T,">",open) + if(close) + if(close= 2)) return 0 switch(effecttype) if(STUN) - Stun((effect - (effect*getarmor(null, "laser")))/(blocked + 1)) + Stun((effect - (effect*getarmor(null, "laser")))) if(WEAKEN) - Weaken((effect - (effect*getarmor(null, "laser")))/(blocked + 1)) + Weaken((effect - (effect*getarmor(null, "laser")))) if(PARALYZE) Paralyse(effect/(blocked+1)) if(IRRADIATE) diff --git a/code/modules/mob/living/say.dm b/code/modules/mob/living/say.dm index 6a9a228a716..c76afae8228 100644 --- a/code/modules/mob/living/say.dm +++ b/code/modules/mob/living/say.dm @@ -86,22 +86,39 @@ var/channel_prefix = copytext(message, 1, 3) var/list/keys = list( - ":r" = "right ear", - ":l" = "left ear", - ":i" = "intercom", - ":h" = "department", - ":c" = "Command", - ":n" = "Science", - ":m" = "Medical", - ":e" = "Engineering", - ":s" = "Security", - ":w" = "whisper", - ":b" = "binary", - ":a" = "alientalk", - ":t" = "Syndicate", - ":d" = "Mining", - ":q" = "Cargo", - ":g" = "changeling", + ":r" = "right ear", + ":l" = "left ear", + ":i" = "intercom", + ":h" = "department", + ":c" = "Command", + ":n" = "Science", + ":m" = "Medical", + ":e" = "Engineering", + ":s" = "Security", + ":w" = "whisper", + ":b" = "binary", + ":a" = "alientalk", + ":t" = "Syndicate", + ":d" = "Mining", + ":q" = "Cargo", + ":g" = "changeling", + + ":R" = "right hand", + ":L" = "left hand", + ":I" = "intercom", + ":H" = "department", + ":C" = "Command", + ":N" = "Science", + ":M" = "Medical", + ":E" = "Engineering", + ":S" = "Security", + ":W" = "whisper", + ":B" = "binary", + ":A" = "alientalk", + ":T" = "Syndicate", + ":D" = "Mining", + ":Q" = "Cargo", + ":G" = "changeling", //kinda localization -- rastaf0 //same keys as above, but on russian keyboard layout. This file uses cp1251 as encoding. diff --git a/code/modules/mob/living/silicon/robot/robot.dm b/code/modules/mob/living/silicon/robot/robot.dm index 2fc30a57fec..66027f582da 100644 --- a/code/modules/mob/living/silicon/robot/robot.dm +++ b/code/modules/mob/living/silicon/robot/robot.dm @@ -700,6 +700,14 @@ overlays += "ov-openpanel +c" else overlays += "ov-openpanel -c" + + if(targeted_by && target_locked) + overlays += target_locked + else if(targeted_by) + target_locked = new /obj/effect/target_locked(src) + overlays += target_locked + else if(!targeted_by && target_locked) + del(target_locked) return diff --git a/code/modules/mob/living/silicon/say.dm b/code/modules/mob/living/silicon/say.dm index fa8ae87b1fd..15d24563989 100644 --- a/code/modules/mob/living/silicon/say.dm +++ b/code/modules/mob/living/silicon/say.dm @@ -15,13 +15,13 @@ return if (length(message) >= 2) - if (copytext(message, 1, 3) == ":s") + if ((copytext(message, 1, 3) == ":s") || (copytext(message, 1, 3) == ":S")) if(istype(src, /mob/living/silicon/pai)) return ..(message) message = copytext(message, 3) message = trim(copytext(sanitize(message), 1, MAX_MESSAGE_LEN)) robot_talk(message) - else if (copytext(message, 1, 3) == ":h") + else if ((copytext(message, 1, 3) == ":h") || (copytext(message, 1, 3) == ":H")) if(isAI(src)&&client)//For patching directly into AI holopads. message = copytext(message, 3) message = trim(copytext(sanitize(message), 1, MAX_MESSAGE_LEN)) diff --git a/code/modules/mob/mob_movement.dm b/code/modules/mob/mob_movement.dm index 098ca75e562..0b6f753d3d1 100644 --- a/code/modules/mob/mob_movement.dm +++ b/code/modules/mob/mob_movement.dm @@ -173,6 +173,7 @@ return 0 move_delay = world.time//set move delay + mob.last_move_intent = world.time + 10 switch(mob.m_intent) if("run") if(mob.drowsyness > 0) diff --git a/code/modules/mob/screen.dm b/code/modules/mob/screen.dm index edf60ec1f95..d646df6906b 100644 --- a/code/modules/mob/screen.dm +++ b/code/modules/mob/screen.dm @@ -25,6 +25,25 @@ var/selecting = "chest" screen_loc = "EAST+1,NORTH" +/obj/screen/gun + name = "gun" + icon = 'screen1.dmi' + master = null + + move + name = "Allow Walking" + icon_state = "no_walk" + screen_loc = ui_gun2 + + run + name = "Allow Running" + icon_state = "no_run" + screen_loc = ui_gun3 + + item + name = "Allow Item Use" + icon_state = "no_item" + screen_loc = ui_gun1 /obj/screen/zone_sel/MouseDown(location, control,params) // Changes because of 4.0 @@ -569,6 +588,37 @@ usr:inv3.icon_state = "inv3" usr:module_active = null + if("Allow Walking") + usr.AllowTargetMove() + icon_state = "walking" + name = "Disallow Walking" + + if("Disallow Walking") + usr.AllowTargetMove() + icon_state = "no_walk" + name = "Allow Walking" + + if("Allow Running") + usr.AllowTargetRun() + icon_state = "running" + name = "Disallow Running" + + if("Disallow Running") + usr.AllowTargetRun() + icon_state = "no_run" + name = "Allow Running" + + if("Allow Item Use") + name = "Disallow Item Use" + icon_state = "act_throw_off" + usr.AllowTargetClick() + + + if("Disallow Item Use") + name = "Allow Item Use" + icon_state = "no_item" + usr.AllowTargetClick() + else DblClick() return diff --git a/code/modules/projectiles/gun.dm b/code/modules/projectiles/gun.dm index 084002946f1..2e3a274a18c 100644 --- a/code/modules/projectiles/gun.dm +++ b/code/modules/projectiles/gun.dm @@ -1,5 +1,5 @@ /obj/item/weapon/gun - name = "gun" + name = "\improper Gun" desc = "Its a gun. It's pretty terrible, though." icon = 'gun.dmi' icon_state = "detective" @@ -19,6 +19,9 @@ caliber = "" silenced = 0 recoil = 0 + tmp/mob/target + tmp/lock_time = -100 + mouthshoot = 0 proc load_into_chamber() @@ -28,6 +31,13 @@ load_into_chamber() return 0 + dropped(mob/user as mob) + if(target) + target.NotTargeted(src) + del(user.item_use_icon) + del(user.gun_move_icon) + del(user.gun_run_icon) + return ..() special_check(var/mob/M) //Placeholder for any special checks, like detective's revolver. return 1 @@ -37,8 +47,16 @@ for(var/obj/O in contents) O.emp_act(severity) + attack_self() + if(target) + target.NotTargeted(src) + usr.visible_message("[usr] lowers \the [src].") + return 0 + return 1 + attack(mob/living/M as mob, mob/living/user as mob, def_zone) - if (M == user && user.zone_sel.selecting == "mouth" && load_into_chamber()) + if (M == user && user.zone_sel.selecting == "mouth" && load_into_chamber() && !mouthshoot) + mouthshoot = 1 M.visible_message("\red [user] sticks their gun in their mouth, ready to pull the trigger...") if(!do_after(user, 40)) M.visible_message("\blue [user] decided life was worth living") @@ -59,18 +77,18 @@ M.apply_damage(85, BRUTE, "chest") M.visible_message("\red [user] pulls the trigger. Ow.") del(src.in_chamber) + mouthshoot = 0 return + else if(target && M == target) + PreFire(M,user) else return ..() - afterattack(atom/target as mob|obj|turf|area, mob/living/user as mob|obj, flag, params)//TODO: go over this - if(flag) return //we're placing gun on a table or in backpack - if(istype(target, /obj/machinery/recharger) && istype(src, /obj/item/weapon/gun/energy)) return//Shouldnt flag take care of this? - + proc/Fire(atom/target as mob|obj|turf|area, mob/living/user as mob|obj, params)//TODO: go over this if(istype(user, /mob/living)) var/mob/living/M = user if ((M.mutations & CLUMSY) && prob(50)) - M << "\red The [src.name] blows up in your face." + M << "\red \the [src] blows up in your face." M.take_organ_damage(0,20) M.drop_item() del(src) @@ -113,7 +131,7 @@ playsound(user, fire_sound, 10, 1) else playsound(user, fire_sound, 50, 1) - user.visible_message("\red [user.name] fires the [src.name]!", "\red You fire the [src.name]!", "\blue You hear a [istype(in_chamber, /obj/item/projectile/beam) ? "laser blast" : "gunshot"]!") + user.visible_message("\red [user] fires the [src]!", "\red You fire the [src]!", "\blue You hear a [istype(in_chamber, /obj/item/projectile/beam) ? "laser blast" : "gunshot"]!") in_chamber.original = targloc in_chamber.loc = get_turf(user) @@ -138,3 +156,264 @@ update_icon() return + proc/Aim(var/mob/M) + if(target != M) + lock_time = world.time + if(target) + //usr.ClearRequest("Aim") + target.NotTargeted(src) + usr.visible_message("[usr] turns \the [src] on [M]!") + else + usr.visible_message("[usr] aims \a [src] at [M]!") + for(var/mob/K in viewers(usr)) + K << 'TargetOn.ogg' + M.Targeted(src) + + proc/TargetActed() + var/mob/M = loc + if(target == M) return + Fire(target,usr) + var/dir_to_fire = sd_get_approx_dir(M,target) + if(dir_to_fire != M.dir) + M.dir = dir_to_fire + + afterattack(atom/A as mob|obj|turf|area, mob/living/user as mob|obj, flag, params) + if(flag) return //we're placing gun on a table or in backpack + if(istype(target, /obj/machinery/recharger) && istype(src, /obj/item/weapon/gun/energy)) return//Shouldnt flag take care of this? + PreFire(A,user,params) + + proc/PreFire(atom/A as mob|obj|turf|area, mob/living/user as mob|obj, params) + if(usr.a_intent in list("help","grab","disarm")) + //GraphicTrace(usr.x,usr.y,A.x,A.y,usr.z) + if(lock_time > world.time - 2) return + if(!ismob(A)) +// var/mob/M = locate() in range(0,A) +// if(M && !ismob(A)) +// if(M.type == /mob) +// return FindTarget(M,user,params) + var/mob/M = GunTrace(usr.x,usr.y,A.x,A.y,usr.z,usr) + if(M && ismob(M) && !target) + Aim(M) + return + if(ismob(A) && target != A) + Aim(A) + else if(lock_time < world.time + 10) + Fire(A,user,params) + else if(!target) + Fire(A,user,params) + //else + //var/item/gun/G = usr.OHand + //if(!G) + //Fire(A,0) + //else if(istype(G)) + //G.Fire(A,3) + //Fire(A,2) + //else + //Fire(A) + var/dir_to_fire = sd_get_approx_dir(usr,A) + if(dir_to_fire != usr.dir) + usr.dir = dir_to_fire + else + Fire(A, user) + +#define SIGN(X) ((X<0)?-1:1) + +proc/GunTrace(X1,Y1,X2,Y2,Z=1,exc_obj,PX1=16,PY1=16,PX2=16,PY2=16) + //bluh << "Tracin' [X1],[Y1] to [X2],[Y2] on floor [Z]." + var/turf/T + var/mob/M + if(X1==X2) + if(Y1==Y2) return 0 //Light cannot be blocked on same tile + else + var/s = SIGN(Y2-Y1) + Y1+=s + while(1) + T = locate(X1,Y1,Z) + if(!T) return 0 + M = locate() in T + if(M) return M + M = locate() in orange(1,T)-exc_obj + if(M) return M + Y1+=s + else + var + m=(32*(Y2-Y1)+(PY2-PY1))/(32*(X2-X1)+(PX2-PX1)) + b=(Y1+PY1/32-0.015625)-m*(X1+PX1/32-0.015625) //In tiles + signX = SIGN(X2-X1) + signY = SIGN(Y2-Y1) + if(X1 I.lock_time + 10 && !T.target_can_move) //If the target moved while targeted + I.TargetActed() + I.lock_time = world.time + 5 + else if(last_move_intent > I.lock_time + 10 && !T.target_can_run && m_intent == "run") //If the target ran while targeted + I.TargetActed() + I.lock_time = world.time + 5 + if(last_target_click > I.lock_time + 10 && !T.target_can_click) //If the target clicked the map to pick something up/shoot/etc + I.TargetActed() + I.lock_time = world.time + 5 + + NotTargeted(var/obj/item/weapon/gun/I,silent) + if(!silent) + for(var/mob/M in viewers(src)) + M << 'TargetOff.ogg' + del(target_locked) + targeted_by -= I + I.target = null + var/mob/T = I.loc + if(T && ismob(T)) + del(T.item_use_icon) + del(T.gun_move_icon) + del(T.gun_run_icon) + if(!targeted_by.len) del targeted_by + +/* Captive(var/obj/item/weapon/gun/I) + Sound(src,'CounterAttack.ogg') + if(!targeted_by) targeted_by = list() + targeted_by += I + I.target = src +// Stun("Captive") + I.lock_time = world.time + 10 //Target has 1 second to realize they're targeted and stop (or target the opponent). + src << "(Your character is being held captive. They have 1 second to stop any click or move actions. While held, they may \ + drag and drop items in or into the map, speak, and click on interface buttons. Clicking on the map or their items \ + (other than a weapon to de-target) will result in being attacked. The aggressor may also attack manually, \ + so try not to get on their bad side.)" + if(targeted_by.len == 1) + var/mob/T = I.loc + while(targeted_by) + sleep(1) + if(last_target_click > I.lock_time + 10 && !T.target_can_click) //If the target clicked the map to pick something up/shoot/etc + I.TargetActed() + + NotCaptive(var/obj/item/weapon/gun/I,silent) + if(!silent) Sound(src,'SwordSheath.ogg') +// UnStun("Captive") + targeted_by -= I + I.target = null + if(!targeted_by.len) del targeted_by*/ + +/obj/effect +// target_locking +// icon = 'icons/effects/Targeted.dmi' +// icon_state = "locking" +// layer = 99 + target_locked + icon = 'icons/effects/Targeted.dmi' + icon_state = "locked" + layer = 99 +// captured +// icon = 'Captured.dmi' +// layer = 99 + +mob/var + target_can_move = 0 + target_can_run = 0 + target_can_click = 0 +mob/Move() + . = ..() + for(var/obj/item/weapon/gun/G in targeted_by) + var/mob/M = G.loc + if(!(M in view(src))) + //ClearRequest("Aim") + NotTargeted(G) + for(var/obj/item/weapon/gun/G in src) + if(G.target) + if(!(G.target in view(src))) + //ClearRequest("Aim") + G.target.NotTargeted(G) +mob/verb + AllowTargetMove() + set hidden=1 + spawn(1) target_can_move = !target_can_move + if(!target_can_move) +// winset(usr,"default.target_can_move","is-flat=true;border=sunken") + usr << "Target may now walk." + gun_run_icon = new /obj/screen/gun/run(null) + if(client) + client.screen += gun_run_icon + else +// winset(usr,"default.target_can_move","is-flat=false;border=none") + usr << "Target may no longer move." + target_can_run = 0 + del(gun_run_icon) + for(var/obj/item/weapon/gun/G in src) + G.lock_time = world.time + 5 + if(G.target) + if(!target_can_move) + G.target << "Your character may now walk at the discretion of their targeter." + else + G.target << "Your character will now be shot if they move." + AllowTargetRun() + set hidden=1 + spawn(1) target_can_run = !target_can_run + if(!target_can_run) +// winset(usr,"default.target_can_move","is-flat=true;border=sunken") + usr << "Target may now run." + else +// winset(usr,"default.target_can_move","is-flat=false;border=none") + usr << "Target may no longer run." + for(var/obj/item/weapon/gun/G in src) + G.lock_time = world.time + 5 + if(G.target) + if(!target_can_run) + G.target << "Your character may now run at the discretion of their targeter." + else + G.target << "Your character will now be shot if they run." + AllowTargetClick() + set hidden=1 + spawn(1) target_can_click = !target_can_click + if(!target_can_click) +// winset(usr,"default.target_can_click","is-flat=true;border=sunken") + usr << "Target may now use items." + else +// winset(usr,"default.target_can_click","is-flat=false;border=none") + usr << "Target may no longer use items." + for(var/obj/item/weapon/gun/G in src) + G.lock_time = world.time + 5 + if(G.target) + if(!target_can_click) + G.target << "Your character may now use items at the discretion of their targeter." + else + G.target << "Your character will now be shot if they use items." \ No newline at end of file diff --git a/code/modules/projectiles/guns/energy.dm b/code/modules/projectiles/guns/energy.dm index e739ea24bbf..84d069df95f 100644 --- a/code/modules/projectiles/guns/energy.dm +++ b/code/modules/projectiles/guns/energy.dm @@ -1,6 +1,6 @@ /obj/item/weapon/gun/energy icon_state = "energy" - name = "energy gun" + name = "\improper Energy gun" desc = "A basic energy-based gun with two settings: Stun and kill." fire_sound = 'Taser.ogg' diff --git a/code/modules/projectiles/guns/energy/laser.dm b/code/modules/projectiles/guns/energy/laser.dm index 489b7ac91ba..52349e64642 100644 --- a/code/modules/projectiles/guns/energy/laser.dm +++ b/code/modules/projectiles/guns/energy/laser.dm @@ -1,5 +1,5 @@ /obj/item/weapon/gun/energy/laser - name = "laser gun" + name = "\improper Laser Gun" desc = "a basic weapon designed kill with concentrated energy bolts" icon_state = "laser" item_state = "laser" @@ -11,7 +11,7 @@ obj/item/weapon/gun/energy/laser/retro - name ="retro laser" + name ="\improper Retro Laser" icon_state = "retro" desc = "An older model of the basic lasergun, no longer used by Nanotrasen's security or military forces. Nevertheless, it is still quite deadly and easy to maintain, making it a favorite amongst pirates and other outlaws." @@ -58,7 +58,7 @@ obj/item/weapon/gun/energy/laser/retro /obj/item/weapon/gun/energy/lasercannon - name = "laser cannon" + name = "\improper Laser Cannon" desc = "With the L.A.S.E.R. cannon, the lasing medium is enclosed in a tube lined with uranium-235 and subjected to high neutron flux in a nuclear reactor core. This incredible technology may help YOU achieve high excitation rates with small laser volumes!" icon_state = "lasercannon" fire_sound = 'lasercannonfire.ogg' diff --git a/code/modules/projectiles/guns/energy/nuclear.dm b/code/modules/projectiles/guns/energy/nuclear.dm index 7b791c15775..ba8e3acc6e6 100644 --- a/code/modules/projectiles/guns/energy/nuclear.dm +++ b/code/modules/projectiles/guns/energy/nuclear.dm @@ -1,6 +1,6 @@ /obj/item/weapon/gun/energy/gun icon_state = "energy" - name = "energy gun" + name = "\improper Energy Gun" desc = "A basic energy-based gun with two settings: Stun and kill." fire_sound = 'Taser.ogg' @@ -13,26 +13,27 @@ attack_self(mob/living/user as mob) - switch(mode) - if(0) - mode = 1 - charge_cost = 100 - fire_sound = 'Laser.ogg' - user << "\red [src.name] is now set to kill." - projectile_type = "/obj/item/projectile/beam" - if(1) - mode = 0 - charge_cost = 100 - fire_sound = 'Taser.ogg' - user << "\red [src.name] is now set to stun." - projectile_type = "/obj/item/projectile/energy/electrode" - update_icon() + if(..()) + switch(mode) + if(0) + mode = 1 + charge_cost = 100 + fire_sound = 'Laser.ogg' + user << "\red [src] is now set to kill." + projectile_type = "/obj/item/projectile/beam" + if(1) + mode = 0 + charge_cost = 100 + fire_sound = 'Taser.ogg' + user << "\red [src] is now set to stun." + projectile_type = "/obj/item/projectile/energy/electrode" + update_icon() return /obj/item/weapon/gun/energy/gun/nuclear - name = "Advanced Energy Gun" + name = "\improper Advanced Energy Gun" desc = "An energy gun with an experimental miniaturized reactor." origin_tech = "combat=3;materials=5;powerstorage=3" var/lightfail = 0 diff --git a/code/modules/projectiles/guns/energy/pulse.dm b/code/modules/projectiles/guns/energy/pulse.dm index 449ac729797..79814620688 100644 --- a/code/modules/projectiles/guns/energy/pulse.dm +++ b/code/modules/projectiles/guns/energy/pulse.dm @@ -1,5 +1,5 @@ /obj/item/weapon/gun/energy/pulse_rifle - name = "pulse rifle" + name = "\improper Pulse Rifle" desc = "A heavy-duty, pulse-based energy weapon, preferred by front-line combat personnel." icon_state = "pulse" force = 10 @@ -11,40 +11,42 @@ attack_self(mob/living/user as mob) - switch(mode) - if(2) - mode = 0 - charge_cost = 100 - fire_sound = 'Taser.ogg' - user << "\red [src.name] is now set to stun." - projectile_type = "/obj/item/projectile/energy/electrode" - if(0) - mode = 1 - charge_cost = 100 - fire_sound = 'Laser.ogg' - user << "\red [src.name] is now set to kill." - projectile_type = "/obj/item/projectile/beam" - if(1) - mode = 2 - charge_cost = 200 - fire_sound = 'pulse.ogg' - user << "\red [src.name] is now set to DESTROY." - projectile_type = "/obj/item/projectile/beam/pulse" + if(..()) + switch(mode) + if(2) + mode = 0 + charge_cost = 100 + fire_sound = 'Taser.ogg' + user << "\red [src] is now set to stun." + projectile_type = "/obj/item/projectile/energy/electrode" + if(0) + mode = 1 + charge_cost = 100 + fire_sound = 'Laser.ogg' + user << "\red [src] is now set to kill." + projectile_type = "/obj/item/projectile/beam" + if(1) + mode = 2 + charge_cost = 200 + fire_sound = 'pulse.ogg' + user << "\red [src] is now set to DESTROY." + projectile_type = "/obj/item/projectile/beam/pulse" return /obj/item/weapon/gun/energy/pulse_rifle/destroyer - name = "pulse destroyer" + name = "\improper Pulse Destroyer" desc = "A heavy-duty, pulse-based energy weapon." cell_type = "/obj/item/weapon/cell/infinite" attack_self(mob/living/user as mob) - user << "\red [src.name] has three settings, and they are all DESTROY." + if(..()) + user << "\red [src] has three settings, and they are all DESTROY." /obj/item/weapon/gun/energy/pulse_rifle/M1911 - name = "m1911-P" + name = "\improper M1911-P" desc = "It's not the size of the gun, it's the size of the hole it puts through people." icon_state = "m1911-p" cell_type = "/obj/item/weapon/cell/infinite" diff --git a/code/modules/projectiles/guns/energy/special.dm b/code/modules/projectiles/guns/energy/special.dm index 828c05db823..817d23d96ab 100644 --- a/code/modules/projectiles/guns/energy/special.dm +++ b/code/modules/projectiles/guns/energy/special.dm @@ -1,5 +1,5 @@ /obj/item/weapon/gun/energy/ionrifle - name = "ion rifle" + name = "\improper Ion Rifle" desc = "A man portable anti-armor weapon designed to disable mechanical threats" icon_state = "ionrifle" fire_sound = 'Laser.ogg' @@ -12,7 +12,7 @@ /obj/item/weapon/gun/energy/decloner - name = "biological demolecularisor" + name = "\improper Biological Demolecularisor" desc = "A gun that discharges high amounts of controlled radiation to slowly break a target into component elements." icon_state = "decloner" fire_sound = 'pulse3.ogg' @@ -21,7 +21,7 @@ projectile_type = "/obj/item/projectile/energy/declone" obj/item/weapon/gun/energy/staff - name = "staff of change" + name = "\improper Staff of Change" desc = "an artefact that spits bolts of coruscating energy which cause the target's very form to reshape itself" icon = 'gun.dmi' icon_state = "staffofchange" diff --git a/code/modules/projectiles/guns/energy/stun.dm b/code/modules/projectiles/guns/energy/stun.dm index e3177e7438b..348f32f75a7 100644 --- a/code/modules/projectiles/guns/energy/stun.dm +++ b/code/modules/projectiles/guns/energy/stun.dm @@ -1,6 +1,6 @@ /obj/item/weapon/gun/energy/taser - name = "taser gun" + name = "\improper Taser Gun" desc = "A small, low capacity gun used for non-lethal takedowns." icon_state = "taser" fire_sound = 'Taser.ogg' @@ -24,7 +24,7 @@ /obj/item/weapon/gun/energy/stunrevolver - name = "stun revolver" + name = "\improper Stun Revolver" desc = "A high-tech revolver that fires stun cartridges. The stun cartridges can be recharged using a conventional energy weapon recharger." icon_state = "stunrevolver" fire_sound = 'Gunshot.ogg' @@ -36,7 +36,7 @@ /obj/item/weapon/gun/energy/crossbow - name = "mini energy-crossbow" + name = "\improper Mini Energy-Crossbow" desc = "A weapon favored by many of the syndicates stealth specialists." icon_state = "crossbow" w_class = 2.0 @@ -75,7 +75,7 @@ /obj/item/weapon/gun/energy/crossbow/largecrossbow - name = "Energy Crossbow" + name = "\improper Energy Crossbow" desc = "A weapon favored by syndicate infiltration teams." w_class = 4.0 force = 10 diff --git a/code/modules/projectiles/guns/energy/temperature.dm b/code/modules/projectiles/guns/energy/temperature.dm index 3c2d5e64e5d..b9fa50739a2 100644 --- a/code/modules/projectiles/guns/energy/temperature.dm +++ b/code/modules/projectiles/guns/energy/temperature.dm @@ -1,5 +1,5 @@ /obj/item/weapon/gun/energy/temperature - name = "temperature gun" + name = "\improper Temperature Gun" icon_state = "freezegun" fire_sound = 'pulse3.ogg' desc = "A gun that changes temperatures." @@ -23,20 +23,21 @@ attack_self(mob/living/user as mob) - user.machine = src - var/temp_text = "" - if(temperature > (T0C - 50)) - temp_text = "[temperature] ([round(temperature-T0C)]°C) ([round(temperature*1.8-459.67)]°F)" - else - temp_text = "[temperature] ([round(temperature-T0C)]°C) ([round(temperature*1.8-459.67)]°F)" + if(..()) + user.machine = src + var/temp_text = "" + if(temperature > (T0C - 50)) + temp_text = "[temperature] ([round(temperature-T0C)]°C) ([round(temperature*1.8-459.67)]°F)" + else + temp_text = "[temperature] ([round(temperature-T0C)]°C) ([round(temperature*1.8-459.67)]°F)" - var/dat = {"Freeze Gun Configuration:
- Current output temperature: [temp_text]
- Target output temperature: - - - [current_temperature] + + +
- "} + var/dat = {"Freeze Gun Configuration:
+ Current output temperature: [temp_text]
+ Target output temperature: - - - [current_temperature] + + +
+ "} - user << browse(dat, "window=freezegun;size=450x300") - onclose(user, "freezegun") + user << browse(dat, "window=freezegun;size=450x300") + onclose(user, "freezegun") Topic(href, href_list) diff --git a/code/modules/projectiles/guns/projectile.dm b/code/modules/projectiles/guns/projectile.dm index 9d17671303f..f4e4e7a3d83 100644 --- a/code/modules/projectiles/guns/projectile.dm +++ b/code/modules/projectiles/guns/projectile.dm @@ -1,6 +1,6 @@ /obj/item/weapon/gun/projectile desc = "A classic revolver. Uses 357 ammo" - name = "revolver" + name = "\improper Revolver" icon_state = "revolver" caliber = "357" origin_tech = "combat=2;materials=2" diff --git a/code/modules/projectiles/guns/projectile/automatic.dm b/code/modules/projectiles/guns/projectile/automatic.dm index 43024098039..46086b8e48d 100644 --- a/code/modules/projectiles/guns/projectile/automatic.dm +++ b/code/modules/projectiles/guns/projectile/automatic.dm @@ -1,5 +1,5 @@ /obj/item/weapon/gun/projectile/automatic //Hopefully someone will find a way to make these fire in bursts or something. --Superxpdude - name = "Submachine Gun" + name = "\improper Submachine Gun" desc = "A lightweight, fast firing gun. Uses 9mm rounds." icon_state = "saber" w_class = 3.0 @@ -11,7 +11,7 @@ /obj/item/weapon/gun/projectile/automatic/mini_uzi - name = "Mini-Uzi" + name = "\improper Mini-Uzi" desc = "A lightweight, fast firing gun, for when you want someone dead. Uses .45 rounds." icon_state = "mini-uzi" w_class = 3.0 @@ -23,7 +23,7 @@ /obj/item/weapon/gun/projectile/automatic/c20r - name = "C-20r SMG" + name = "\improper C-20r SMG" desc = "A lightweight, fast firing gun, for when you REALLY need someone dead. Uses 12mm rounds. Has a 'Scarborough Arms - Per falcis, per pravitas' buttstamp" icon_state = "c20r" item_state = "c20r" diff --git a/code/modules/projectiles/guns/projectile/pistol.dm b/code/modules/projectiles/guns/projectile/pistol.dm index 394649e92f1..f02112fecfe 100644 --- a/code/modules/projectiles/guns/projectile/pistol.dm +++ b/code/modules/projectiles/guns/projectile/pistol.dm @@ -1,5 +1,5 @@ /obj/item/weapon/gun/projectile/silenced - name = "Silenced Pistol" + name = "\improper Silenced Pistol" desc = "A small, quiet, easily concealable gun. Uses .45 rounds." icon_state = "silenced_pistol" w_class = 3.0 @@ -12,7 +12,7 @@ /obj/item/weapon/gun/projectile/deagle - name = "Desert Eagle" + name = "\improper Desert Eagle" desc = "A robust handgun that uses 357 magnum ammo" icon_state = "deagle" force = 14.0 @@ -21,7 +21,7 @@ /obj/item/weapon/gun/projectile/deagle/gold - name = "Desert Eagle" + name = "\improper Desert Eagle" desc = "A gold plated gun folded over a million times by superior martian gunsmiths. Uses 357 ammo." icon_state = "deagleg" item_state = "deagleg" @@ -29,7 +29,7 @@ /obj/item/weapon/gun/projectile/deagle/camo - name = "Desert Eagle" + name = "\improper Desert Eagle" desc = "A Deagle brand Deagle for operators operating operationally. Uses 357 ammo." icon_state = "deaglecamo" item_state = "deagleg" @@ -37,7 +37,7 @@ /obj/item/weapon/gun/projectile/gyropistol - name = "Gyrojet Pistol" + name = "\improper Gyrojet Pistol" desc = "A bulky pistol designed to fire self propelled rounds" icon_state = "gyropistol" max_shells = 8 diff --git a/code/modules/projectiles/guns/projectile/revolver.dm b/code/modules/projectiles/guns/projectile/revolver.dm index ee4ed93f46d..859e734d05b 100644 --- a/code/modules/projectiles/guns/projectile/revolver.dm +++ b/code/modules/projectiles/guns/projectile/revolver.dm @@ -1,6 +1,6 @@ /obj/item/weapon/gun/projectile/detective desc = "A cheap Martian knock-off of a Smith & Wesson Model 10. Uses .38-Special rounds." - name = "revolver" + name = "\improper Revolver" icon_state = "detective" caliber = "38" origin_tech = "combat=2;materials=2" @@ -38,7 +38,7 @@ /obj/item/weapon/gun/projectile/mateba - name = "mateba" + name = "\improper Mateba" desc = "When you absolutely, positively need a 10mm hole in the other guy. Uses .357 ammo." icon_state = "mateba" origin_tech = "combat=2;materials=2" \ No newline at end of file diff --git a/code/modules/projectiles/guns/projectile/shotgun.dm b/code/modules/projectiles/guns/projectile/shotgun.dm index c334fb755d4..eb6746cbc29 100644 --- a/code/modules/projectiles/guns/projectile/shotgun.dm +++ b/code/modules/projectiles/guns/projectile/shotgun.dm @@ -1,5 +1,5 @@ /obj/item/weapon/gun/projectile/shotgun - name = "shotgun" + name = "\improper Shotgun" desc = "Useful for sweeping alleys." icon_state = "shotgun" max_shells = 2 @@ -21,11 +21,12 @@ attack_self(mob/living/user as mob) - if(recentpump) return - pump() - recentpump = 1 - spawn(10) - recentpump = 0 + if(..()) + if(recentpump) return + pump() + recentpump = 1 + spawn(10) + recentpump = 0 return @@ -48,7 +49,7 @@ /obj/item/weapon/gun/projectile/shotgun/combat - name = "combat shotgun" + name = "\improper Combat Shotgun" icon_state = "cshotgun" max_shells = 8 ammo_type = "/obj/item/ammo_casing/shotgun" @@ -56,7 +57,7 @@ /obj/item/weapon/gun/projectile/shotgun/combat2 - name = "security combat shotgun" + name = "\improper Security Combat Shotgun" icon_state = "cshotgun" max_shells = 4 diff --git a/code/modules/projectiles/projectile.dm b/code/modules/projectiles/projectile.dm index 4b6bef3f3b1..2757b672231 100644 --- a/code/modules/projectiles/projectile.dm +++ b/code/modules/projectiles/projectile.dm @@ -10,7 +10,7 @@ */ /obj/item/projectile - name = "projectile" + name = "\improper Projectile" icon = 'projectiles.dmi' icon_state = "bullet" density = 1 @@ -70,7 +70,7 @@ return // nope.avi if(!silenced) - visible_message("\red [A.name] is hit by the [src.name]!")//X has fired Y is now given by the guns so you cant tell who shot you if you could not see the shooter + visible_message("\red [A] is hit by the [src]!")//X has fired Y is now given by the guns so you cant tell who shot you if you could not see the shooter else M << "\red You've been shot!" if(istype(firer, /mob)) diff --git a/code/modules/projectiles/projectile/beams.dm b/code/modules/projectiles/projectile/beams.dm index 7812fe4bff3..803fb597fa4 100644 --- a/code/modules/projectiles/projectile/beams.dm +++ b/code/modules/projectiles/projectile/beams.dm @@ -1,5 +1,5 @@ /obj/item/projectile/beam - name = "laser" + name = "\improper Laser" icon_state = "laser" pass_flags = PASSTABLE | PASSGLASS | PASSGRILLE damage = 20 @@ -49,19 +49,19 @@ del(src) /obj/item/projectile/beam/heavylaser - name = "heavy laser" + name = "\improper Heavy Laser" icon_state = "heavylaser" damage = 40 /obj/item/projectile/beam/pulse - name = "pulse" + name = "\improper Pulse" icon_state = "u_laser" damage = 50 /obj/item/projectile/beam/deathlaser - name = "death laser" + name = "\improper Death Laser" icon_state = "heavylaser" damage = 60 diff --git a/code/modules/projectiles/projectile/bullets.dm b/code/modules/projectiles/projectile/bullets.dm index f12dd9f2467..28566f9e90a 100644 --- a/code/modules/projectiles/projectile/bullets.dm +++ b/code/modules/projectiles/projectile/bullets.dm @@ -1,5 +1,5 @@ /obj/item/projectile/bullet - name = "bullet" + name = "\improper Bullet" icon_state = "bullet" damage = 60 damage_type = BRUTE @@ -20,24 +20,24 @@ eyeblur = 3 /obj/item/projectile/bullet/suffocationbullet//How does this even work? - name = "co bullet" +// name = "\improper ullet" damage = 20 damage_type = OXY /obj/item/projectile/bullet/cyanideround - name = "poison bullet" + name = "\improper Poison Bullet" damage = 40 damage_type = TOX /obj/item/projectile/bullet/burstbullet//I think this one needs something for the on hit - name = "exploding bullet" + name = "\improper Exploding Bullet" damage = 20 /obj/item/projectile/bullet/stunshot - name = "stunshot" + name = "\improper Stunshot" damage = 5 stun = 10 weaken = 10 diff --git a/code/modules/projectiles/projectile/change.dm b/code/modules/projectiles/projectile/change.dm index 02ff86c2ed2..eea3f22a741 100644 --- a/code/modules/projectiles/projectile/change.dm +++ b/code/modules/projectiles/projectile/change.dm @@ -1,5 +1,5 @@ /obj/item/projectile/change - name = "bolt of change" + name = "\improper Bolt of Change" icon_state = "ice_1" damage = 0 damage_type = BURN diff --git a/code/modules/projectiles/projectile/energy.dm b/code/modules/projectiles/projectile/energy.dm index 95d7931e850..bb8f30ad3ff 100644 --- a/code/modules/projectiles/projectile/energy.dm +++ b/code/modules/projectiles/projectile/energy.dm @@ -1,5 +1,5 @@ /obj/item/projectile/energy - name = "energy" + name = "\improper Energy" icon_state = "spark" damage = 0 damage_type = BURN @@ -7,17 +7,17 @@ /obj/item/projectile/energy/electrode - name = "electrode" + name = "\improper Electrode" icon_state = "spark" nodamage = 1 - stun = 10 - weaken = 10 + stun = 15 + weaken = 15 stutter = 10 - flag = "melee" //Give it a better chance to be blocked. + flag = "laser" //Give it a better chance to be blocked. /obj/item/projectile/energy/declone - name = "declown" + name = "\improper Decloner Bolt" icon_state = "declone" nodamage = 1 damage_type = CLONE @@ -25,7 +25,7 @@ /obj/item/projectile/energy/dart - name = "dart" + name = "\improper Dart" icon_state = "toxin" damage = 5 damage_type = TOX @@ -33,7 +33,7 @@ /obj/item/projectile/energy/bolt - name = "bolt" + name = "\improper Bolt" icon_state = "cbbolt" damage = 10 damage_type = TOX @@ -43,7 +43,7 @@ /obj/item/projectile/energy/bolt/large - name = "largebolt" + name = "\improper Large Bolt" damage = 20 diff --git a/code/modules/projectiles/projectile/special.dm b/code/modules/projectiles/projectile/special.dm index ae20b7ca630..c8ead597efd 100644 --- a/code/modules/projectiles/projectile/special.dm +++ b/code/modules/projectiles/projectile/special.dm @@ -1,5 +1,5 @@ /obj/item/projectile/ion - name = "ion bolt" + name = "\improper Ion Bolt" icon_state = "ion" damage = 0 damage_type = BURN @@ -13,7 +13,7 @@ /obj/item/projectile/bullet/gyro - name ="gyro" + name ="\improper Rocket" icon_state= "bolter" damage = 50 flag = "bullet" @@ -24,7 +24,7 @@ return 1 /obj/item/projectile/temp - name = "freeze beam" + name = "\improper Freeze Beam" icon_state = "ice_2" damage = 0 damage_type = BURN diff --git a/code/modules/recycling/disposal.dm b/code/modules/recycling/disposal.dm index 4671aa7c228..3163332c5cf 100644 --- a/code/modules/recycling/disposal.dm +++ b/code/modules/recycling/disposal.dm @@ -86,7 +86,7 @@ if(ismob(G.affecting)) var/mob/GM = G.affecting for (var/mob/V in viewers(usr)) - V.show_message("[usr] starts putting [GM.name] into the disposal.", 3) + V.show_message("[usr] starts putting [GM] into the disposal.", 3) if(do_after(usr, 20)) if (GM.client) GM.client.perspective = EYE_PERSPECTIVE diff --git a/icons/effects/Targeted.dmi b/icons/effects/Targeted.dmi new file mode 100644 index 00000000000..f0d4b95f64f Binary files /dev/null and b/icons/effects/Targeted.dmi differ diff --git a/icons/mob/screen1.dmi b/icons/mob/screen1.dmi index d631ff02ce2..3b56a6cd6c9 100644 Binary files a/icons/mob/screen1.dmi and b/icons/mob/screen1.dmi differ diff --git a/icons/mob/screen1_old.dmi b/icons/mob/screen1_old.dmi index 1918ebce9fe..c214d6441dd 100644 Binary files a/icons/mob/screen1_old.dmi and b/icons/mob/screen1_old.dmi differ diff --git a/icons/mob/screen1_robot.dmi b/icons/mob/screen1_robot.dmi index 636a7208420..da10c176b44 100644 Binary files a/icons/mob/screen1_robot.dmi and b/icons/mob/screen1_robot.dmi differ diff --git a/sound/weapons/TargetOff.ogg b/sound/weapons/TargetOff.ogg new file mode 100644 index 00000000000..b8657aab27e Binary files /dev/null and b/sound/weapons/TargetOff.ogg differ diff --git a/sound/weapons/TargetOn.ogg b/sound/weapons/TargetOn.ogg new file mode 100644 index 00000000000..93a2f68f326 Binary files /dev/null and b/sound/weapons/TargetOn.ogg differ