diff --git a/code/_onclick/hud/parallax.dm b/code/_onclick/hud/parallax.dm index f364bac76f..a9971895a7 100755 --- a/code/_onclick/hud/parallax.dm +++ b/code/_onclick/hud/parallax.dm @@ -247,7 +247,7 @@ /obj/screen/parallax_layer/Initialize(mapload, view) - ..() + . = ..() if (!view) view = world.view update_o(view) diff --git a/code/game/area/ai_monitored.dm b/code/game/area/ai_monitored.dm index f5700625c8..75548ff81e 100644 --- a/code/game/area/ai_monitored.dm +++ b/code/game/area/ai_monitored.dm @@ -1,30 +1,30 @@ -/area/ai_monitored - name = "AI Monitored Area" - var/list/obj/machinery/camera/motioncameras = list() - var/list/motionTargets = list() - -/area/ai_monitored/Initialize(mapload) - ..() - if(mapload) - for (var/obj/machinery/camera/M in src) - if(M.isMotion()) - motioncameras.Add(M) - M.area_motion = src - -//Only need to use one camera - -/area/ai_monitored/Entered(atom/movable/O) - ..() - if (ismob(O) && motioncameras.len) - for(var/X in motioncameras) - var/obj/machinery/camera/cam = X - cam.newTarget(O) - return - -/area/ai_monitored/Exited(atom/movable/O) - ..() - if (ismob(O) && motioncameras.len) - for(var/X in motioncameras) - var/obj/machinery/camera/cam = X - cam.lostTarget(O) - return \ No newline at end of file +/area/ai_monitored + name = "AI Monitored Area" + var/list/obj/machinery/camera/motioncameras = list() + var/list/motionTargets = list() + +/area/ai_monitored/Initialize(mapload) + . = ..() + if(mapload) + for (var/obj/machinery/camera/M in src) + if(M.isMotion()) + motioncameras.Add(M) + M.area_motion = src + +//Only need to use one camera + +/area/ai_monitored/Entered(atom/movable/O) + ..() + if (ismob(O) && motioncameras.len) + for(var/X in motioncameras) + var/obj/machinery/camera/cam = X + cam.newTarget(O) + return + +/area/ai_monitored/Exited(atom/movable/O) + ..() + if (ismob(O) && motioncameras.len) + for(var/X in motioncameras) + var/obj/machinery/camera/cam = X + cam.lostTarget(O) + return diff --git a/code/game/area/areas.dm b/code/game/area/areas.dm index 5acc64fbb8..fafd057fea 100644 --- a/code/game/area/areas.dm +++ b/code/game/area/areas.dm @@ -120,7 +120,7 @@ GLOBAL_LIST_EMPTY(teleportlocs) if(dynamic_lighting == DYNAMIC_LIGHTING_IFSTARLIGHT) dynamic_lighting = config.starlight ? DYNAMIC_LIGHTING_ENABLED : DYNAMIC_LIGHTING_DISABLED - ..() + . = ..() power_change() // all machines set to current power level, also updates icon diff --git a/code/game/gamemodes/blob/blobs/blob_mobs.dm b/code/game/gamemodes/blob/blobs/blob_mobs.dm index d9e803f3a0..7ddc71eecc 100644 --- a/code/game/gamemodes/blob/blobs/blob_mobs.dm +++ b/code/game/gamemodes/blob/blobs/blob_mobs.dm @@ -106,7 +106,7 @@ if(istype(linked_node)) factory = linked_node factory.spores += src - ..() + . = ..() /mob/living/simple_animal/hostile/blob/blobspore/Life() if(!is_zombie && isturf(src.loc)) @@ -223,7 +223,7 @@ var/independent = FALSE /mob/living/simple_animal/hostile/blob/blobbernaut/Initialize() - ..() + . = ..() if(!independent) //no pulling people deep into the blob verbs -= /mob/living/verb/pulled diff --git a/code/game/gamemodes/blob/overmind.dm b/code/game/gamemodes/blob/overmind.dm index 247b660dbc..e22b2747e0 100644 --- a/code/game/gamemodes/blob/overmind.dm +++ b/code/game/gamemodes/blob/overmind.dm @@ -50,7 +50,7 @@ if(blob_core) blob_core.update_icon() - ..() + .= ..() /mob/camera/blob/Life() if(!blob_core) diff --git a/code/game/gamemodes/wizard/spellbook.dm b/code/game/gamemodes/wizard/spellbook.dm index 2d18c1f9e9..31060fffc3 100644 --- a/code/game/gamemodes/wizard/spellbook.dm +++ b/code/game/gamemodes/wizard/spellbook.dm @@ -553,7 +553,7 @@ to_chat(user, "It appears to have no author.") /obj/item/spellbook/Initialize() - ..() + . = ..() prepare_spells() /obj/item/spellbook/proc/prepare_spells() diff --git a/code/game/objects/effects/anomalies.dm b/code/game/objects/effects/anomalies.dm index 3692af855b..ee11c009fd 100644 --- a/code/game/objects/effects/anomalies.dm +++ b/code/game/objects/effects/anomalies.dm @@ -18,7 +18,7 @@ var/obj/effect/countdown/anomaly/countdown /obj/effect/anomaly/Initialize(mapload, new_lifespan) - ..() + . = ..() GLOB.poi_list |= src START_PROCESSING(SSobj, src) impact_area = get_area(src) diff --git a/code/game/objects/effects/decals/cleanable.dm b/code/game/objects/effects/decals/cleanable.dm index 75e8fbc02d..2aca5c534b 100644 --- a/code/game/objects/effects/decals/cleanable.dm +++ b/code/game/objects/effects/decals/cleanable.dm @@ -1,91 +1,91 @@ -/obj/effect/decal/cleanable - gender = PLURAL - layer = ABOVE_NORMAL_TURF_LAYER - var/list/random_icon_states = list() - var/blood_state = "" //I'm sorry but cleanable/blood code is ass, and so is blood_DNA - var/bloodiness = 0 //0-100, amount of blood in this decal, used for making footprints and affecting the alpha of bloody footprints - var/mergeable_decal = 1 //when two of these are on a same tile or do we need to merge them into just one? - -/obj/effect/decal/cleanable/Initialize(mapload) - if (random_icon_states && length(src.random_icon_states) > 0) - src.icon_state = pick(src.random_icon_states) - create_reagents(300) - if(src.loc && isturf(src.loc)) - for(var/obj/effect/decal/cleanable/C in src.loc) - if(C != src && C.type == src.type) - replace_decal(C) - ..() - - - -/obj/effect/decal/cleanable/proc/replace_decal(obj/effect/decal/cleanable/C) - if(mergeable_decal) - qdel(C) - -/obj/effect/decal/cleanable/attackby(obj/item/W, mob/user, params) - if(istype(W, /obj/item/reagent_containers/glass) || istype(W, /obj/item/reagent_containers/food/drinks)) - if(src.reagents && W.reagents) - . = 1 //so the containers don't splash their content on the src while scooping. - if(!src.reagents.total_volume) - to_chat(user, "[src] isn't thick enough to scoop up!") - return - if(W.reagents.total_volume >= W.reagents.maximum_volume) - to_chat(user, "[W] is full!") - return - to_chat(user, "You scoop up [src] into [W]!") - reagents.trans_to(W, reagents.total_volume) - if(!reagents.total_volume) //scooped up all of it - qdel(src) - return - if(W.is_hot()) //todo: make heating a reagent holder proc - if(istype(W, /obj/item/clothing/mask/cigarette)) - return - else - var/hotness = W.is_hot() - var/added_heat = (hotness / 100) - src.reagents.chem_temp = min(src.reagents.chem_temp + added_heat, hotness) - src.reagents.handle_reactions() - to_chat(user, "You heat [src] with [W]!") - else - return ..() - -/obj/effect/decal/cleanable/ex_act() - if(reagents) - for(var/datum/reagent/R in reagents.reagent_list) - R.on_ex_act() - ..() - -/obj/effect/decal/cleanable/fire_act(exposed_temperature, exposed_volume) - if(reagents) - reagents.chem_temp += 30 - reagents.handle_reactions() - ..() - - -//Add "bloodiness" of this blood's type, to the human's shoes -//This is on /cleanable because fuck this ancient mess -/obj/effect/decal/cleanable/Crossed(atom/movable/O) - if(ishuman(O)) - var/mob/living/carbon/human/H = O - if(H.shoes && blood_state && bloodiness) - var/obj/item/clothing/shoes/S = H.shoes - var/add_blood = 0 - if(bloodiness >= BLOOD_GAIN_PER_STEP) - add_blood = BLOOD_GAIN_PER_STEP - else - add_blood = bloodiness - bloodiness -= add_blood - S.bloody_shoes[blood_state] = min(MAX_SHOE_BLOODINESS,S.bloody_shoes[blood_state]+add_blood) - if(blood_DNA && blood_DNA.len) - S.add_blood(blood_DNA) - S.blood_state = blood_state - update_icon() - H.update_inv_shoes() - - - -/obj/effect/decal/cleanable/proc/can_bloodcrawl_in() - if((blood_state != BLOOD_STATE_OIL) && (blood_state != BLOOD_STATE_NOT_BLOODY)) - return bloodiness - else - return 0 +/obj/effect/decal/cleanable + gender = PLURAL + layer = ABOVE_NORMAL_TURF_LAYER + var/list/random_icon_states = list() + var/blood_state = "" //I'm sorry but cleanable/blood code is ass, and so is blood_DNA + var/bloodiness = 0 //0-100, amount of blood in this decal, used for making footprints and affecting the alpha of bloody footprints + var/mergeable_decal = 1 //when two of these are on a same tile or do we need to merge them into just one? + +/obj/effect/decal/cleanable/Initialize(mapload) + if (random_icon_states && length(src.random_icon_states) > 0) + src.icon_state = pick(src.random_icon_states) + create_reagents(300) + if(src.loc && isturf(src.loc)) + for(var/obj/effect/decal/cleanable/C in src.loc) + if(C != src && C.type == src.type) + replace_decal(C) + . = ..() + + + +/obj/effect/decal/cleanable/proc/replace_decal(obj/effect/decal/cleanable/C) + if(mergeable_decal) + qdel(C) + +/obj/effect/decal/cleanable/attackby(obj/item/W, mob/user, params) + if(istype(W, /obj/item/reagent_containers/glass) || istype(W, /obj/item/reagent_containers/food/drinks)) + if(src.reagents && W.reagents) + . = 1 //so the containers don't splash their content on the src while scooping. + if(!src.reagents.total_volume) + to_chat(user, "[src] isn't thick enough to scoop up!") + return + if(W.reagents.total_volume >= W.reagents.maximum_volume) + to_chat(user, "[W] is full!") + return + to_chat(user, "You scoop up [src] into [W]!") + reagents.trans_to(W, reagents.total_volume) + if(!reagents.total_volume) //scooped up all of it + qdel(src) + return + if(W.is_hot()) //todo: make heating a reagent holder proc + if(istype(W, /obj/item/clothing/mask/cigarette)) + return + else + var/hotness = W.is_hot() + var/added_heat = (hotness / 100) + src.reagents.chem_temp = min(src.reagents.chem_temp + added_heat, hotness) + src.reagents.handle_reactions() + to_chat(user, "You heat [src] with [W]!") + else + return ..() + +/obj/effect/decal/cleanable/ex_act() + if(reagents) + for(var/datum/reagent/R in reagents.reagent_list) + R.on_ex_act() + ..() + +/obj/effect/decal/cleanable/fire_act(exposed_temperature, exposed_volume) + if(reagents) + reagents.chem_temp += 30 + reagents.handle_reactions() + ..() + + +//Add "bloodiness" of this blood's type, to the human's shoes +//This is on /cleanable because fuck this ancient mess +/obj/effect/decal/cleanable/Crossed(atom/movable/O) + if(ishuman(O)) + var/mob/living/carbon/human/H = O + if(H.shoes && blood_state && bloodiness) + var/obj/item/clothing/shoes/S = H.shoes + var/add_blood = 0 + if(bloodiness >= BLOOD_GAIN_PER_STEP) + add_blood = BLOOD_GAIN_PER_STEP + else + add_blood = bloodiness + bloodiness -= add_blood + S.bloody_shoes[blood_state] = min(MAX_SHOE_BLOODINESS,S.bloody_shoes[blood_state]+add_blood) + if(blood_DNA && blood_DNA.len) + S.add_blood(blood_DNA) + S.blood_state = blood_state + update_icon() + H.update_inv_shoes() + + + +/obj/effect/decal/cleanable/proc/can_bloodcrawl_in() + if((blood_state != BLOOD_STATE_OIL) && (blood_state != BLOOD_STATE_NOT_BLOODY)) + return bloodiness + else + return 0 diff --git a/code/game/objects/effects/decals/cleanable/humans.dm b/code/game/objects/effects/decals/cleanable/humans.dm index 72a721911f..5566a91d88 100644 --- a/code/game/objects/effects/decals/cleanable/humans.dm +++ b/code/game/objects/effects/decals/cleanable/humans.dm @@ -19,7 +19,7 @@ bloodiness = 0 /obj/effect/decal/cleanable/blood/old/Initialize() - ..() + . = ..() icon_state += "-old" //This IS necessary because the parent /blood type uses icon randomization. blood_DNA["Non-human DNA"] = "A+" @@ -54,7 +54,7 @@ mergeable_decal = 0 /obj/effect/decal/cleanable/blood/gibs/Initialize() - ..() + . = ..() reagents.add_reagent("liquidgibs", 5) /obj/effect/decal/cleanable/blood/gibs/ex_act(severity, target) @@ -94,7 +94,7 @@ bloodiness = 0 /obj/effect/decal/cleanable/blood/gibs/old/Initialize() - ..() + . = ..() setDir(pick(1,2,4,8)) icon_state += "-old" blood_DNA["Non-human DNA"] = "A+" diff --git a/code/game/objects/effects/decals/cleanable/misc.dm b/code/game/objects/effects/decals/cleanable/misc.dm index 35c32b26e6..4be49d12f8 100644 --- a/code/game/objects/effects/decals/cleanable/misc.dm +++ b/code/game/objects/effects/decals/cleanable/misc.dm @@ -12,7 +12,7 @@ mergeable_decal = 0 /obj/effect/decal/cleanable/ash/Initialize() - ..() + . = ..() reagents.add_reagent("ash", 30) pixel_x = rand(-5, 5) pixel_y = rand(-5, 5) @@ -22,7 +22,7 @@ icon_state = "big_ash" /obj/effect/decal/cleanable/ash/large/Initialize() - ..() + . = ..() reagents.add_reagent("ash", 30) //double the amount of ash. @@ -44,7 +44,7 @@ icon_state = "greenglow" /obj/effect/decal/cleanable/greenglow/Initialize(mapload) - ..() + . = ..() set_light(1) /obj/effect/decal/cleanable/greenglow/ex_act() @@ -102,7 +102,7 @@ desc = "You try not to look at the chunks, and fail." /obj/effect/decal/cleanable/vomit/old/Initialize() - ..() + . = ..() icon_state += "-old" /obj/effect/decal/cleanable/tomato_smudge @@ -153,7 +153,7 @@ /obj/effect/decal/cleanable/shreds/Initialize() pixel_x = rand(-10, 10) pixel_y = rand(-10, 10) - ..() + . = ..() /obj/effect/decal/cleanable/salt name = "salt pile" diff --git a/code/game/objects/effects/decals/cleanable/robots.dm b/code/game/objects/effects/decals/cleanable/robots.dm index e91c273903..b9d6e36b51 100644 --- a/code/game/objects/effects/decals/cleanable/robots.dm +++ b/code/game/objects/effects/decals/cleanable/robots.dm @@ -48,7 +48,7 @@ bloodiness = MAX_SHOE_BLOODINESS /obj/effect/decal/cleanable/oil/Initialize() - ..() + . = ..() reagents.add_reagent("oil", 30) /obj/effect/decal/cleanable/oil/streak diff --git a/code/game/objects/effects/decals/crayon.dm b/code/game/objects/effects/decals/crayon.dm index eb84caf15f..7ca3bd9462 100644 --- a/code/game/objects/effects/decals/crayon.dm +++ b/code/game/objects/effects/decals/crayon.dm @@ -7,7 +7,7 @@ var/do_icon_rotate = TRUE /obj/effect/decal/cleanable/crayon/Initialize(mapload, main = "#FFFFFF", var/type = "rune1", var/e_name = "rune", var/rotation = 0, var/alt_icon = null) - ..() + . = ..() name = e_name desc = "A [name] vandalizing the station." diff --git a/code/game/objects/effects/decals/misc.dm b/code/game/objects/effects/decals/misc.dm index 45a9ba3f35..2187bc6311 100644 --- a/code/game/objects/effects/decals/misc.dm +++ b/code/game/objects/effects/decals/misc.dm @@ -6,7 +6,7 @@ duration = 25 /obj/effect/temp_visual/point/Initialize(mapload, set_invis = 0) - ..() + . = ..() var/atom/old_loc = loc loc = get_turf(src) pixel_x = old_loc.pixel_x diff --git a/code/game/objects/items/devices/instruments.dm b/code/game/objects/items/devices/instruments.dm index 73fa510bc7..8418e61146 100644 --- a/code/game/objects/items/devices/instruments.dm +++ b/code/game/objects/items/devices/instruments.dm @@ -1,65 +1,65 @@ -//copy pasta of the space piano, don't hurt me -Pete -/obj/item/device/instrument - name = "generic instrument" - resistance_flags = FLAMMABLE - max_integrity = 100 +//copy pasta of the space piano, don't hurt me -Pete +/obj/item/device/instrument + name = "generic instrument" + resistance_flags = FLAMMABLE + max_integrity = 100 icon = 'icons/obj/musician.dmi' lefthand_file = 'icons/mob/inhands/equipment/instruments_lefthand.dmi' righthand_file = 'icons/mob/inhands/equipment/instruments_righthand.dmi' - var/datum/song/handheld/song - var/instrumentId = "generic" + var/datum/song/handheld/song + var/instrumentId = "generic" var/instrumentExt = "mid" - + /obj/item/device/instrument/Initialize() . = ..() song = new(instrumentId, src, instrumentExt) - -/obj/item/device/instrument/Destroy() - qdel(song) - song = null - return ..() - -/obj/item/device/instrument/suicide_act(mob/user) - user.visible_message("[user] begins to play 'Gloomy Sunday'! It looks like [user.p_theyre()] trying to commit suicide!") - return (BRUTELOSS) - -/obj/item/device/instrument/Initialize(mapload) - ..() - if(mapload) - song.tempo = song.sanitize_tempo(song.tempo) // tick_lag isn't set when the map is loaded - -/obj/item/device/instrument/attack_self(mob/user) - if(!user.IsAdvancedToolUser()) - to_chat(user, "You don't have the dexterity to do this!") - return 1 - interact(user) - -/obj/item/device/instrument/interact(mob/user) - if(!user) - return - - if(!isliving(user) || user.stat || user.restrained() || user.lying) - return - - user.set_machine(src) - song.interact(user) - -/obj/item/device/instrument/violin - name = "space violin" - desc = "A wooden musical instrument with four strings and a bow. \"The devil went down to space, he was looking for an assistant to grief.\"" - icon_state = "violin" - item_state = "violin" - force = 10 - hitsound = "swing_hit" - instrumentId = "violin" - -/obj/item/device/instrument/violin/golden - name = "golden violin" - desc = "A golden musical instrument with four strings and a bow. \"The devil went down to space, he was looking for an assistant to grief.\"" - icon_state = "golden_violin" - item_state = "golden_violin" - resistance_flags = LAVA_PROOF | FIRE_PROOF | ACID_PROOF - + +/obj/item/device/instrument/Destroy() + qdel(song) + song = null + return ..() + +/obj/item/device/instrument/suicide_act(mob/user) + user.visible_message("[user] begins to play 'Gloomy Sunday'! It looks like [user.p_theyre()] trying to commit suicide!") + return (BRUTELOSS) + +/obj/item/device/instrument/Initialize(mapload) + . = ..() + if(mapload) + song.tempo = song.sanitize_tempo(song.tempo) // tick_lag isn't set when the map is loaded + +/obj/item/device/instrument/attack_self(mob/user) + if(!user.IsAdvancedToolUser()) + to_chat(user, "You don't have the dexterity to do this!") + return 1 + interact(user) + +/obj/item/device/instrument/interact(mob/user) + if(!user) + return + + if(!isliving(user) || user.stat || user.restrained() || user.lying) + return + + user.set_machine(src) + song.interact(user) + +/obj/item/device/instrument/violin + name = "space violin" + desc = "A wooden musical instrument with four strings and a bow. \"The devil went down to space, he was looking for an assistant to grief.\"" + icon_state = "violin" + item_state = "violin" + force = 10 + hitsound = "swing_hit" + instrumentId = "violin" + +/obj/item/device/instrument/violin/golden + name = "golden violin" + desc = "A golden musical instrument with four strings and a bow. \"The devil went down to space, he was looking for an assistant to grief.\"" + icon_state = "golden_violin" + item_state = "golden_violin" + resistance_flags = LAVA_PROOF | FIRE_PROOF | ACID_PROOF + /obj/item/device/instrument/piano_synth name = "synthesizer" desc = "An advanced electronic synthesizer that can be used as various instruments." @@ -74,26 +74,26 @@ song.instrumentDir = name song.instrumentExt = insTypes[name] -/obj/item/device/instrument/guitar - name = "guitar" - desc = "It's made of wood and has bronze strings." - icon_state = "guitar" - item_state = "guitar" +/obj/item/device/instrument/guitar + name = "guitar" + desc = "It's made of wood and has bronze strings." + icon_state = "guitar" + item_state = "guitar" instrumentExt = "ogg" - force = 10 - attack_verb = list("played metal on", "serenaded", "crashed", "smashed") - hitsound = 'sound/weapons/stringsmash.ogg' - instrumentId = "guitar" - -/obj/item/device/instrument/eguitar - name = "electric guitar" - desc = "Makes all your shredding needs possible." - icon_state = "eguitar" - item_state = "eguitar" - force = 12 - attack_verb = list("played metal on", "shredded", "crashed", "smashed") - hitsound = 'sound/weapons/stringsmash.ogg' - instrumentId = "eguitar" + force = 10 + attack_verb = list("played metal on", "serenaded", "crashed", "smashed") + hitsound = 'sound/weapons/stringsmash.ogg' + instrumentId = "guitar" + +/obj/item/device/instrument/eguitar + name = "electric guitar" + desc = "Makes all your shredding needs possible." + icon_state = "eguitar" + item_state = "eguitar" + force = 12 + attack_verb = list("played metal on", "shredded", "crashed", "smashed") + hitsound = 'sound/weapons/stringsmash.ogg' + instrumentId = "eguitar" instrumentExt = "ogg" /obj/item/device/instrument/glockenspiel diff --git a/code/game/objects/items/stacks/rods.dm b/code/game/objects/items/stacks/rods.dm index 8e35e5a6d6..6ea8d7e40d 100644 --- a/code/game/objects/items/stacks/rods.dm +++ b/code/game/objects/items/stacks/rods.dm @@ -23,7 +23,7 @@ GLOBAL_LIST_INIT(rod_recipes, list ( \ novariants = TRUE /obj/item/stack/rods/Initialize(mapload, new_amount, merge = TRUE) - ..() + . = ..() recipes = GLOB.rod_recipes update_icon() diff --git a/code/game/objects/structures/musician.dm b/code/game/objects/structures/musician.dm index cd3d09536b..ed0deef7d9 100644 --- a/code/game/objects/structures/musician.dm +++ b/code/game/objects/structures/musician.dm @@ -1,69 +1,69 @@ - + #define MUSICIAN_HEARCHECK_MINDELAY 4 #define MUSIC_MAXLINES 300 #define MUSIC_MAXLINECHARS 50 - -/datum/song - var/name = "Untitled" - var/list/lines = new() - var/tempo = 5 // delay between notes - - var/playing = 0 // if we're playing - var/help = 0 // if help is open - var/edit = 1 // if we're in editing mode - var/repeat = 0 // number of times remaining to repeat - var/max_repeats = 10 // maximum times we can repeat - - var/instrumentDir = "piano" // the folder with the sounds - var/instrumentExt = "ogg" // the file extension - var/obj/instrumentObj = null // the associated obj playing the sound + +/datum/song + var/name = "Untitled" + var/list/lines = new() + var/tempo = 5 // delay between notes + + var/playing = 0 // if we're playing + var/help = 0 // if help is open + var/edit = 1 // if we're in editing mode + var/repeat = 0 // number of times remaining to repeat + var/max_repeats = 10 // maximum times we can repeat + + var/instrumentDir = "piano" // the folder with the sounds + var/instrumentExt = "ogg" // the file extension + var/obj/instrumentObj = null // the associated obj playing the sound var/last_hearcheck = 0 var/list/hearing_mobs - + /datum/song/New(dir, obj, ext = "ogg") - tempo = sanitize_tempo(tempo) - instrumentDir = dir - instrumentObj = obj + tempo = sanitize_tempo(tempo) + instrumentDir = dir + instrumentObj = obj instrumentExt = ext - -/datum/song/Destroy() - instrumentObj = null - return ..() - -// note is a number from 1-7 for A-G -// acc is either "b", "n", or "#" -// oct is 1-8 (or 9 for C) -/datum/song/proc/playnote(note, acc as text, oct) - // handle accidental -> B<>C of E<>F - if(acc == "b" && (note == 3 || note == 6)) // C or F - if(note == 3) - oct-- - note-- - acc = "n" - else if(acc == "#" && (note == 2 || note == 5)) // B or E - if(note == 2) - oct++ - note++ - acc = "n" - else if(acc == "#" && (note == 7)) //G# - note = 1 - acc = "b" - else if(acc == "#") // mass convert all sharps to flats, octave jump already handled - acc = "b" - note++ - - // check octave, C is allowed to go to 9 - if(oct < 1 || (note == 3 ? oct > 9 : oct > 8)) - return - - // now generate name + +/datum/song/Destroy() + instrumentObj = null + return ..() + +// note is a number from 1-7 for A-G +// acc is either "b", "n", or "#" +// oct is 1-8 (or 9 for C) +/datum/song/proc/playnote(note, acc as text, oct) + // handle accidental -> B<>C of E<>F + if(acc == "b" && (note == 3 || note == 6)) // C or F + if(note == 3) + oct-- + note-- + acc = "n" + else if(acc == "#" && (note == 2 || note == 5)) // B or E + if(note == 2) + oct++ + note++ + acc = "n" + else if(acc == "#" && (note == 7)) //G# + note = 1 + acc = "b" + else if(acc == "#") // mass convert all sharps to flats, octave jump already handled + acc = "b" + note++ + + // check octave, C is allowed to go to 9 + if(oct < 1 || (note == 3 ? oct > 9 : oct > 8)) + return + + // now generate name var/soundfile = "sound/instruments/[instrumentDir]/[ascii2text(note+64)][acc][oct].[instrumentExt]" - soundfile = file(soundfile) - // make sure the note exists - if(!fexists(soundfile)) - return - // and play - var/turf/source = get_turf(instrumentObj) + soundfile = file(soundfile) + // make sure the note exists + if(!fexists(soundfile)) + return + // and play + var/turf/source = get_turf(instrumentObj) if((world.time - MUSICIAN_HEARCHECK_MINDELAY) > last_hearcheck) LAZYCLEARLIST(hearing_mobs) for(var/mob/M in get_hearers_in_view(15, source)) @@ -76,321 +76,321 @@ for(var/i in hearing_mobs) var/mob/M = i M.playsound_local(source, null, 100, falloff = 5, S = music_played) - -/datum/song/proc/updateDialog(mob/user) - instrumentObj.updateDialog() // assumes it's an object in world, override if otherwise - -/datum/song/proc/shouldStopPlaying(mob/user) - if(instrumentObj) - if(!user.canUseTopic(instrumentObj)) + +/datum/song/proc/updateDialog(mob/user) + instrumentObj.updateDialog() // assumes it's an object in world, override if otherwise + +/datum/song/proc/shouldStopPlaying(mob/user) + if(instrumentObj) + if(!user.canUseTopic(instrumentObj)) return TRUE - return !instrumentObj.anchored // add special cases to stop in subclasses - else + return !instrumentObj.anchored // add special cases to stop in subclasses + else return TRUE - -/datum/song/proc/playsong(mob/user) - while(repeat >= 0) - var/cur_oct[7] - var/cur_acc[7] - for(var/i = 1 to 7) - cur_oct[i] = 3 - cur_acc[i] = "n" - - for(var/line in lines) - //to_chat(world, line) - for(var/beat in splittext(lowertext(line), ",")) - //to_chat(world, "beat: [beat]") - var/list/notes = splittext(beat, "/") - for(var/note in splittext(notes[1], "-")) - //to_chat(world, "note: [note]") - if(!playing || shouldStopPlaying(user))//If the instrument is playing, or special case + +/datum/song/proc/playsong(mob/user) + while(repeat >= 0) + var/cur_oct[7] + var/cur_acc[7] + for(var/i = 1 to 7) + cur_oct[i] = 3 + cur_acc[i] = "n" + + for(var/line in lines) + //to_chat(world, line) + for(var/beat in splittext(lowertext(line), ",")) + //to_chat(world, "beat: [beat]") + var/list/notes = splittext(beat, "/") + for(var/note in splittext(notes[1], "-")) + //to_chat(world, "note: [note]") + if(!playing || shouldStopPlaying(user))//If the instrument is playing, or special case playing = FALSE hearing_mobs = null - return + return if(!lentext(note)) - continue - //to_chat(world, "Parse: [copytext(note,1,2)]") - var/cur_note = text2ascii(note) - 96 - if(cur_note < 1 || cur_note > 7) - continue - for(var/i=2 to lentext(note)) - var/ni = copytext(note,i,i+1) - if(!text2num(ni)) - if(ni == "#" || ni == "b" || ni == "n") - cur_acc[cur_note] = ni - else if(ni == "s") - cur_acc[cur_note] = "#" // so shift is never required - else - cur_oct[cur_note] = text2num(ni) - if(user.dizziness > 0 && prob(user.dizziness / 2)) - cur_note = Clamp(cur_note + rand(round(-user.dizziness / 10), round(user.dizziness / 10)), 1, 7) - if(user.dizziness > 0 && prob(user.dizziness / 5)) - if(prob(30)) - cur_acc[cur_note] = "#" - else if(prob(42)) - cur_acc[cur_note] = "b" - else if(prob(75)) - cur_acc[cur_note] = "n" - playnote(cur_note, cur_acc[cur_note], cur_oct[cur_note]) - if(notes.len >= 2 && text2num(notes[2])) - sleep(sanitize_tempo(tempo / text2num(notes[2]))) - else - sleep(tempo) - repeat-- + continue + //to_chat(world, "Parse: [copytext(note,1,2)]") + var/cur_note = text2ascii(note) - 96 + if(cur_note < 1 || cur_note > 7) + continue + for(var/i=2 to lentext(note)) + var/ni = copytext(note,i,i+1) + if(!text2num(ni)) + if(ni == "#" || ni == "b" || ni == "n") + cur_acc[cur_note] = ni + else if(ni == "s") + cur_acc[cur_note] = "#" // so shift is never required + else + cur_oct[cur_note] = text2num(ni) + if(user.dizziness > 0 && prob(user.dizziness / 2)) + cur_note = Clamp(cur_note + rand(round(-user.dizziness / 10), round(user.dizziness / 10)), 1, 7) + if(user.dizziness > 0 && prob(user.dizziness / 5)) + if(prob(30)) + cur_acc[cur_note] = "#" + else if(prob(42)) + cur_acc[cur_note] = "b" + else if(prob(75)) + cur_acc[cur_note] = "n" + playnote(cur_note, cur_acc[cur_note], cur_oct[cur_note]) + if(notes.len >= 2 && text2num(notes[2])) + sleep(sanitize_tempo(tempo / text2num(notes[2]))) + else + sleep(tempo) + repeat-- hearing_mobs = null playing = FALSE - repeat = 0 - updateDialog(user) - -/datum/song/proc/interact(mob/user) - var/dat = "" - - if(lines.len > 0) - dat += "

Playback

" - if(!playing) - dat += "Play Stop

" - dat += "Repeat Song: " - dat += repeat > 0 ? "--" : "--" - dat += " [repeat] times " - dat += repeat < max_repeats ? "++" : "++" - dat += "
" - else - dat += "Play Stop
" - dat += "Repeats left: [repeat]
" - if(!edit) - dat += "
Show Editor
" - else - dat += "

Editing

" - dat += "Hide Editor" - dat += " Start a New Song" - dat += " Import a Song

" - var/bpm = round(600 / tempo) - dat += "Tempo: - [bpm] BPM +

" - var/linecount = 0 - for(var/line in lines) - linecount += 1 - dat += "Line [linecount]: Edit X [line]
" - dat += "Add Line

" - if(help) - dat += "Hide Help
" - dat += {" + repeat = 0 + updateDialog(user) + +/datum/song/proc/interact(mob/user) + var/dat = "" + + if(lines.len > 0) + dat += "

Playback

" + if(!playing) + dat += "Play Stop

" + dat += "Repeat Song: " + dat += repeat > 0 ? "--" : "--" + dat += " [repeat] times " + dat += repeat < max_repeats ? "++" : "++" + dat += "
" + else + dat += "Play Stop
" + dat += "Repeats left: [repeat]
" + if(!edit) + dat += "
Show Editor
" + else + dat += "

Editing

" + dat += "Hide Editor" + dat += " Start a New Song" + dat += " Import a Song

" + var/bpm = round(600 / tempo) + dat += "Tempo: - [bpm] BPM +

" + var/linecount = 0 + for(var/line in lines) + linecount += 1 + dat += "Line [linecount]: Edit X [line]
" + dat += "Add Line

" + if(help) + dat += "Hide Help
" + dat += {" Lines are a series of chords, separated by commas (,), each with notes separated by hyphens (-).
- Every note in a chord will play together, with chord timed by the tempo.
-
- Notes are played by the names of the note, and optionally, the accidental, and/or the octave number.
- By default, every note is natural and in octave 3. Defining otherwise is remembered for each note.
- Example: C,D,E,F,G,A,B will play a C major scale.
- After a note has an accidental placed, it will be remembered: C,C4,C,C3 is C3,C4,C4,C3
- Chords can be played simply by seperating each note with a hyphon: A-C#,Cn-E,E-G#,Gn-B
- A pause may be denoted by an empty chord: C,E,,C,G
- To make a chord be a different time, end it with /x, where the chord length will be length
- defined by tempo / x: C,G/2,E/4
- Combined, an example is: E-E4/4,F#/2,G#/8,B/8,E3-E4/4 -
+ Every note in a chord will play together, with chord timed by the tempo.
+
+ Notes are played by the names of the note, and optionally, the accidental, and/or the octave number.
+ By default, every note is natural and in octave 3. Defining otherwise is remembered for each note.
+ Example: C,D,E,F,G,A,B will play a C major scale.
+ After a note has an accidental placed, it will be remembered: C,C4,C,C3 is C3,C4,C4,C3
+ Chords can be played simply by seperating each note with a hyphon: A-C#,Cn-E,E-G#,Gn-B
+ A pause may be denoted by an empty chord: C,E,,C,G
+ To make a chord be a different time, end it with /x, where the chord length will be length
+ defined by tempo / x: C,G/2,E/4
+ Combined, an example is: E-E4/4,F#/2,G#/8,B/8,E3-E4/4 +
Lines may be up to [MUSIC_MAXLINECHARS] characters.
A song may only contain up to [MUSIC_MAXLINES] lines.
- "} - else - dat += "Show Help
" - - var/datum/browser/popup = new(user, "instrument", instrumentObj.name, 700, 500) - popup.set_content(dat) - popup.set_title_image(user.browse_rsc_icon(instrumentObj.icon, instrumentObj.icon_state)) - popup.open() - -/datum/song/proc/ParseSong(text) - set waitfor = FALSE - //split into lines - lines = splittext(text, "\n") - if(lines.len) - if(copytext(lines[1],1,6) == "BPM: ") - tempo = sanitize_tempo(600 / text2num(copytext(lines[1],6))) - lines.Cut(1,2) - else - tempo = sanitize_tempo(5) // default 120 BPM + "} + else + dat += "Show Help
" + + var/datum/browser/popup = new(user, "instrument", instrumentObj.name, 700, 500) + popup.set_content(dat) + popup.set_title_image(user.browse_rsc_icon(instrumentObj.icon, instrumentObj.icon_state)) + popup.open() + +/datum/song/proc/ParseSong(text) + set waitfor = FALSE + //split into lines + lines = splittext(text, "\n") + if(lines.len) + if(copytext(lines[1],1,6) == "BPM: ") + tempo = sanitize_tempo(600 / text2num(copytext(lines[1],6))) + lines.Cut(1,2) + else + tempo = sanitize_tempo(5) // default 120 BPM if(lines.len > MUSIC_MAXLINES) - to_chat(usr, "Too many lines!") + to_chat(usr, "Too many lines!") lines.Cut(MUSIC_MAXLINES + 1) - var/linenum = 1 - for(var/l in lines) + var/linenum = 1 + for(var/l in lines) if(lentext(l) > MUSIC_MAXLINECHARS) - to_chat(usr, "Line [linenum] too long!") - lines.Remove(l) - else - linenum++ - updateDialog(usr) // make sure updates when complete - -/datum/song/Topic(href, href_list) - if(!usr.canUseTopic(instrumentObj)) - usr << browse(null, "window=instrument") - usr.unset_machine() - return - - instrumentObj.add_fingerprint(usr) - - if(href_list["newsong"]) - lines = new() - tempo = sanitize_tempo(5) // default 120 BPM - name = "" - - else if(href_list["import"]) - var/t = "" - do - t = html_encode(input(usr, "Please paste the entire song, formatted:", text("[]", name), t) as message) - if(!in_range(instrumentObj, usr)) - return - + to_chat(usr, "Line [linenum] too long!") + lines.Remove(l) + else + linenum++ + updateDialog(usr) // make sure updates when complete + +/datum/song/Topic(href, href_list) + if(!usr.canUseTopic(instrumentObj)) + usr << browse(null, "window=instrument") + usr.unset_machine() + return + + instrumentObj.add_fingerprint(usr) + + if(href_list["newsong"]) + lines = new() + tempo = sanitize_tempo(5) // default 120 BPM + name = "" + + else if(href_list["import"]) + var/t = "" + do + t = html_encode(input(usr, "Please paste the entire song, formatted:", text("[]", name), t) as message) + if(!in_range(instrumentObj, usr)) + return + if(lentext(t) >= MUSIC_MAXLINES * MUSIC_MAXLINECHARS) - var/cont = input(usr, "Your message is too long! Would you like to continue editing it?", "", "yes") in list("yes", "no") - if(cont == "no") - break + var/cont = input(usr, "Your message is too long! Would you like to continue editing it?", "", "yes") in list("yes", "no") + if(cont == "no") + break while(lentext(t) > MUSIC_MAXLINES * MUSIC_MAXLINECHARS) - ParseSong(t) - - else if(href_list["help"]) - help = text2num(href_list["help"]) - 1 - - else if(href_list["edit"]) - edit = text2num(href_list["edit"]) - 1 - - if(href_list["repeat"]) //Changing this from a toggle to a number of repeats to avoid infinite loops. - if(playing) - return //So that people cant keep adding to repeat. If the do it intentionally, it could result in the server crashing. - repeat += round(text2num(href_list["repeat"])) - if(repeat < 0) - repeat = 0 - if(repeat > max_repeats) - repeat = max_repeats - - else if(href_list["tempo"]) - tempo = sanitize_tempo(tempo + text2num(href_list["tempo"])) - - else if(href_list["play"]) + ParseSong(t) + + else if(href_list["help"]) + help = text2num(href_list["help"]) - 1 + + else if(href_list["edit"]) + edit = text2num(href_list["edit"]) - 1 + + if(href_list["repeat"]) //Changing this from a toggle to a number of repeats to avoid infinite loops. + if(playing) + return //So that people cant keep adding to repeat. If the do it intentionally, it could result in the server crashing. + repeat += round(text2num(href_list["repeat"])) + if(repeat < 0) + repeat = 0 + if(repeat > max_repeats) + repeat = max_repeats + + else if(href_list["tempo"]) + tempo = sanitize_tempo(tempo + text2num(href_list["tempo"])) + + else if(href_list["play"]) playing = TRUE - spawn() - playsong(usr) - - else if(href_list["newline"]) - var/newline = html_encode(input("Enter your line: ", instrumentObj.name) as text|null) - if(!newline || !in_range(instrumentObj, usr)) - return + spawn() + playsong(usr) + + else if(href_list["newline"]) + var/newline = html_encode(input("Enter your line: ", instrumentObj.name) as text|null) + if(!newline || !in_range(instrumentObj, usr)) + return if(lines.len > MUSIC_MAXLINES) - return + return if(lentext(newline) > MUSIC_MAXLINECHARS) newline = copytext(newline, 1, MUSIC_MAXLINECHARS) - lines.Add(newline) - - else if(href_list["deleteline"]) - var/num = round(text2num(href_list["deleteline"])) - if(num > lines.len || num < 1) - return - lines.Cut(num, num+1) - - else if(href_list["modifyline"]) - var/num = round(text2num(href_list["modifyline"]),1) - var/content = html_encode(input("Enter your line: ", instrumentObj.name, lines[num]) as text|null) - if(!content || !in_range(instrumentObj, usr)) - return + lines.Add(newline) + + else if(href_list["deleteline"]) + var/num = round(text2num(href_list["deleteline"])) + if(num > lines.len || num < 1) + return + lines.Cut(num, num+1) + + else if(href_list["modifyline"]) + var/num = round(text2num(href_list["modifyline"]),1) + var/content = html_encode(input("Enter your line: ", instrumentObj.name, lines[num]) as text|null) + if(!content || !in_range(instrumentObj, usr)) + return if(lentext(content) > MUSIC_MAXLINECHARS) content = copytext(content, 1, MUSIC_MAXLINECHARS) - if(num > lines.len || num < 1) - return - lines[num] = content - - else if(href_list["stop"]) + if(num > lines.len || num < 1) + return + lines[num] = content + + else if(href_list["stop"]) playing = FALSE hearing_mobs = null - - updateDialog(usr) - return - -/datum/song/proc/sanitize_tempo(new_tempo) - new_tempo = abs(new_tempo) - return max(round(new_tempo, world.tick_lag), world.tick_lag) - -// subclass for handheld instruments, like violin -/datum/song/handheld - -/datum/song/handheld/updateDialog(mob/user) - instrumentObj.interact(user) - -/datum/song/handheld/shouldStopPlaying() - if(instrumentObj) - return !isliving(instrumentObj.loc) - else + + updateDialog(usr) + return + +/datum/song/proc/sanitize_tempo(new_tempo) + new_tempo = abs(new_tempo) + return max(round(new_tempo, world.tick_lag), world.tick_lag) + +// subclass for handheld instruments, like violin +/datum/song/handheld + +/datum/song/handheld/updateDialog(mob/user) + instrumentObj.interact(user) + +/datum/song/handheld/shouldStopPlaying() + if(instrumentObj) + return !isliving(instrumentObj.loc) + else return TRUE - - -////////////////////////////////////////////////////////////////////////// - - -/obj/structure/piano - name = "space minimoog" - icon = 'icons/obj/musician.dmi' - icon_state = "minimoog" + + +////////////////////////////////////////////////////////////////////////// + + +/obj/structure/piano + name = "space minimoog" + icon = 'icons/obj/musician.dmi' + icon_state = "minimoog" anchored = TRUE density = TRUE - var/datum/song/song - - -/obj/structure/piano/New() - ..() - song = new("piano", src) - - if(prob(50)) - name = "space minimoog" - desc = "This is a minimoog, like a space piano, but more spacey!" - icon_state = "minimoog" - else - name = "space piano" - desc = "This is a space piano, like a regular piano, but always in tune! Even if the musician isn't." - icon_state = "piano" - -/obj/structure/piano/Destroy() - qdel(song) - song = null - return ..() - -/obj/structure/piano/Initialize(mapload) - ..() - if(mapload) - song.tempo = song.sanitize_tempo(song.tempo) // tick_lag isn't set when the map is loaded - -/obj/structure/piano/attack_hand(mob/user) - if(!user.IsAdvancedToolUser()) - to_chat(user, "You don't have the dexterity to do this!") - return 1 - interact(user) - -/obj/structure/piano/attack_paw(mob/user) - return src.attack_hand(user) - -/obj/structure/piano/interact(mob/user) - if(!user || !anchored) - return - - user.set_machine(src) - song.interact(user) - -/obj/structure/piano/attackby(obj/item/O, mob/user, params) - if (istype(O, /obj/item/wrench)) - if (!anchored && !isinspace()) + var/datum/song/song + + +/obj/structure/piano/New() + ..() + song = new("piano", src) + + if(prob(50)) + name = "space minimoog" + desc = "This is a minimoog, like a space piano, but more spacey!" + icon_state = "minimoog" + else + name = "space piano" + desc = "This is a space piano, like a regular piano, but always in tune! Even if the musician isn't." + icon_state = "piano" + +/obj/structure/piano/Destroy() + qdel(song) + song = null + return ..() + +/obj/structure/piano/Initialize(mapload) + . = ..() + if(mapload) + song.tempo = song.sanitize_tempo(song.tempo) // tick_lag isn't set when the map is loaded + +/obj/structure/piano/attack_hand(mob/user) + if(!user.IsAdvancedToolUser()) + to_chat(user, "You don't have the dexterity to do this!") + return 1 + interact(user) + +/obj/structure/piano/attack_paw(mob/user) + return src.attack_hand(user) + +/obj/structure/piano/interact(mob/user) + if(!user || !anchored) + return + + user.set_machine(src) + song.interact(user) + +/obj/structure/piano/attackby(obj/item/O, mob/user, params) + if (istype(O, /obj/item/wrench)) + if (!anchored && !isinspace()) playsound(src, O.usesound, 50, 1) - to_chat(user, " You begin to tighten \the [src] to the floor...") - if (do_after(user, 20*O.toolspeed, target = src)) - user.visible_message( \ - "[user] tightens \the [src]'s casters.", \ - "You tighten \the [src]'s casters. Now it can be played again.", \ - "You hear ratchet.") + to_chat(user, " You begin to tighten \the [src] to the floor...") + if (do_after(user, 20*O.toolspeed, target = src)) + user.visible_message( \ + "[user] tightens \the [src]'s casters.", \ + "You tighten \the [src]'s casters. Now it can be played again.", \ + "You hear ratchet.") anchored = TRUE - else if(anchored) + else if(anchored) playsound(src, O.usesound, 50, 1) - to_chat(user, " You begin to loosen \the [src]'s casters...") - if (do_after(user, 40*O.toolspeed, target = src)) - user.visible_message( \ - "[user] loosens \the [src]'s casters.", \ - "You loosen \the [src]. Now it can be pulled somewhere else.", \ - "You hear ratchet.") + to_chat(user, " You begin to loosen \the [src]'s casters...") + if (do_after(user, 40*O.toolspeed, target = src)) + user.visible_message( \ + "[user] loosens \the [src]'s casters.", \ + "You loosen \the [src]. Now it can be pulled somewhere else.", \ + "You hear ratchet.") anchored = FALSE - else - return ..() + else + return ..() diff --git a/code/game/objects/structures/noticeboard.dm b/code/game/objects/structures/noticeboard.dm index 9648e80993..cdf294fded 100644 --- a/code/game/objects/structures/noticeboard.dm +++ b/code/game/objects/structures/noticeboard.dm @@ -1,127 +1,127 @@ -/obj/structure/noticeboard - name = "notice board" - desc = "A board for pinning important notices upon." - icon = 'icons/obj/stationobjs.dmi' - icon_state = "nboard00" +/obj/structure/noticeboard + name = "notice board" + desc = "A board for pinning important notices upon." + icon = 'icons/obj/stationobjs.dmi' + icon_state = "nboard00" density = FALSE anchored = TRUE - max_integrity = 150 - var/notices = 0 - -/obj/structure/noticeboard/Initialize(mapload) - ..() - - if(!mapload) - return - - for(var/obj/item/I in loc) - if(notices > 4) break - if(istype(I, /obj/item/paper)) - I.loc = src - notices++ - icon_state = "nboard0[notices]" - -//attaching papers!! -/obj/structure/noticeboard/attackby(obj/item/O, mob/user, params) - if(istype(O, /obj/item/paper) || istype(O, /obj/item/photo)) - if(!allowed(user)) - to_chat(user, "You are not authorized to add notices") - return - if(notices < 5) - if(!user.transferItemToLoc(O, src)) - return - notices++ - icon_state = "nboard0[notices]" - to_chat(user, "You pin the [O] to the noticeboard.") - else - to_chat(user, "The notice board is full") - else - return ..() - -/obj/structure/noticeboard/attack_hand(mob/user) - var/auth = allowed(user) - var/dat = "[name]
" - for(var/obj/item/P in src) - if(istype(P, /obj/item/paper)) - dat += "[P.name] [auth ? "Write Remove" : ""]
" - else - dat += "[P.name] [auth ? "Remove" : ""]
" - user << browse("Notices[dat]","window=noticeboard") - onclose(user, "noticeboard") - -/obj/structure/noticeboard/Topic(href, href_list) - ..() - usr.set_machine(src) - if(href_list["remove"]) - if((usr.stat || usr.restrained())) //For when a player is handcuffed while they have the notice window open - return - var/obj/item/I = locate(href_list["remove"]) in contents - if(istype(I) && I.loc == src) - I.loc = usr.loc - usr.put_in_hands(I) - notices-- - icon_state = "nboard0[notices]" - - if(href_list["write"]) - if((usr.stat || usr.restrained())) //For when a player is handcuffed while they have the notice window open - return - var/obj/item/P = locate(href_list["write"]) in contents - if(istype(P) && P.loc == src) - var/obj/item/I = usr.is_holding_item_of_type(/obj/item/pen) - if(I) - add_fingerprint(usr) - P.attackby(I, usr) - else - to_chat(usr, "You'll need something to write with!") - - if(href_list["read"]) - var/obj/item/I = locate(href_list["read"]) in contents - if(istype(I) && I.loc == src) - usr.examinate(I) - -/obj/structure/noticeboard/deconstruct(disassembled = TRUE) + max_integrity = 150 + var/notices = 0 + +/obj/structure/noticeboard/Initialize(mapload) + . = ..() + + if(!mapload) + return + + for(var/obj/item/I in loc) + if(notices > 4) break + if(istype(I, /obj/item/paper)) + I.loc = src + notices++ + icon_state = "nboard0[notices]" + +//attaching papers!! +/obj/structure/noticeboard/attackby(obj/item/O, mob/user, params) + if(istype(O, /obj/item/paper) || istype(O, /obj/item/photo)) + if(!allowed(user)) + to_chat(user, "You are not authorized to add notices") + return + if(notices < 5) + if(!user.transferItemToLoc(O, src)) + return + notices++ + icon_state = "nboard0[notices]" + to_chat(user, "You pin the [O] to the noticeboard.") + else + to_chat(user, "The notice board is full") + else + return ..() + +/obj/structure/noticeboard/attack_hand(mob/user) + var/auth = allowed(user) + var/dat = "[name]
" + for(var/obj/item/P in src) + if(istype(P, /obj/item/paper)) + dat += "[P.name] [auth ? "Write Remove" : ""]
" + else + dat += "[P.name] [auth ? "Remove" : ""]
" + user << browse("Notices[dat]","window=noticeboard") + onclose(user, "noticeboard") + +/obj/structure/noticeboard/Topic(href, href_list) + ..() + usr.set_machine(src) + if(href_list["remove"]) + if((usr.stat || usr.restrained())) //For when a player is handcuffed while they have the notice window open + return + var/obj/item/I = locate(href_list["remove"]) in contents + if(istype(I) && I.loc == src) + I.loc = usr.loc + usr.put_in_hands(I) + notices-- + icon_state = "nboard0[notices]" + + if(href_list["write"]) + if((usr.stat || usr.restrained())) //For when a player is handcuffed while they have the notice window open + return + var/obj/item/P = locate(href_list["write"]) in contents + if(istype(P) && P.loc == src) + var/obj/item/I = usr.is_holding_item_of_type(/obj/item/pen) + if(I) + add_fingerprint(usr) + P.attackby(I, usr) + else + to_chat(usr, "You'll need something to write with!") + + if(href_list["read"]) + var/obj/item/I = locate(href_list["read"]) in contents + if(istype(I) && I.loc == src) + usr.examinate(I) + +/obj/structure/noticeboard/deconstruct(disassembled = TRUE) if(!(flags_1 & NODECONSTRUCT_1)) - new /obj/item/stack/sheet/metal (loc, 1) - qdel(src) - -// Notice boards for the heads of staff (plus the qm) - -/obj/structure/noticeboard/captain - name = "Captain's Notice Board" - desc = "Important notices from the Captain." + new /obj/item/stack/sheet/metal (loc, 1) + qdel(src) + +// Notice boards for the heads of staff (plus the qm) + +/obj/structure/noticeboard/captain + name = "Captain's Notice Board" + desc = "Important notices from the Captain." req_access = list(ACCESS_CAPTAIN) - -/obj/structure/noticeboard/hop - name = "Head of Personnel's Notice Board" - desc = "Important notices from the Head of Personnel." + +/obj/structure/noticeboard/hop + name = "Head of Personnel's Notice Board" + desc = "Important notices from the Head of Personnel." req_access = list(ACCESS_HOP) - -/obj/structure/noticeboard/ce - name = "Chief Engineer's Notice Board" - desc = "Important notices from the Chief Engineer." + +/obj/structure/noticeboard/ce + name = "Chief Engineer's Notice Board" + desc = "Important notices from the Chief Engineer." req_access = list(ACCESS_CE) - -/obj/structure/noticeboard/hos - name = "Head of Security's Notice Board" - desc = "Important notices from the Head of Security." + +/obj/structure/noticeboard/hos + name = "Head of Security's Notice Board" + desc = "Important notices from the Head of Security." req_access = list(ACCESS_HOS) - -/obj/structure/noticeboard/cmo - name = "Chief Medical Officer's Notice Board" - desc = "Important notices from the Chief Medical Officer." + +/obj/structure/noticeboard/cmo + name = "Chief Medical Officer's Notice Board" + desc = "Important notices from the Chief Medical Officer." req_access = list(ACCESS_CMO) - -/obj/structure/noticeboard/rd - name = "Research Director's Notice Board" - desc = "Important notices from the Research Director." + +/obj/structure/noticeboard/rd + name = "Research Director's Notice Board" + desc = "Important notices from the Research Director." req_access = list(ACCESS_RD) - -/obj/structure/noticeboard/qm - name = "Quartermaster's Notice Board" - desc = "Important notices from the Quartermaster." + +/obj/structure/noticeboard/qm + name = "Quartermaster's Notice Board" + desc = "Important notices from the Quartermaster." req_access = list(ACCESS_QM) - -/obj/structure/noticeboard/staff - name = "Staff Notice Board" - desc = "Important notices from the heads of staff." + +/obj/structure/noticeboard/staff + name = "Staff Notice Board" + desc = "Important notices from the heads of staff." req_access = list(ACCESS_HEADS) diff --git a/code/modules/atmospherics/machinery/airalarm.dm b/code/modules/atmospherics/machinery/airalarm.dm index c08a7a0613..58a450bec9 100644 --- a/code/modules/atmospherics/machinery/airalarm.dm +++ b/code/modules/atmospherics/machinery/airalarm.dm @@ -158,7 +158,7 @@ return ..() /obj/machinery/airalarm/Initialize(mapload) - ..() + . = ..() set_frequency(frequency) /obj/machinery/airalarm/ui_status(mob/user) diff --git a/code/modules/atmospherics/machinery/other/meter.dm b/code/modules/atmospherics/machinery/other/meter.dm index b73fd986f8..bcb6305344 100644 --- a/code/modules/atmospherics/machinery/other/meter.dm +++ b/code/modules/atmospherics/machinery/other/meter.dm @@ -130,5 +130,5 @@ /obj/machinery/meter/turf /obj/machinery/meter/turf/Initialize() - ..() + . = ..() src.target = loc diff --git a/code/modules/awaymissions/capture_the_flag.dm b/code/modules/awaymissions/capture_the_flag.dm index 6d36f5f140..0bed5b94c7 100644 --- a/code/modules/awaymissions/capture_the_flag.dm +++ b/code/modules/awaymissions/capture_the_flag.dm @@ -152,7 +152,7 @@ var/static/arena_reset = FALSE /obj/machinery/capture_the_flag/Initialize() - ..() + . = ..() if(!ctf_object_typecache) ctf_object_typecache = typecacheof(list( /turf, @@ -614,7 +614,7 @@ icon_state = "barrier0" /obj/effect/ctf/dead_barricade/Initialize(mapload) - ..() + . = ..() for(var/obj/machinery/capture_the_flag/CTF in GLOB.machines) CTF.dead_barricades += src diff --git a/code/modules/clothing/chameleon.dm b/code/modules/clothing/chameleon.dm index c4c3da7303..cacd8f7c64 100644 --- a/code/modules/clothing/chameleon.dm +++ b/code/modules/clothing/chameleon.dm @@ -431,7 +431,7 @@ chameleon_action.initialize_disguises() /obj/item/gun/energy/laser/chameleon/Initialize() - ..() + . = ..() projectile_copy_vars = list("name", "icon", "icon_state", "item_state", "speed", "color", "hitsound", "forcedodge", "impact_effect_type", "range", "suppressed", "hitsound_wall", "impact_effect_type", "pass_flags") chameleon_projectile_vars = list("name" = "practice laser", "icon" = 'icons/obj/projectiles.dmi', "icon_state" = "laser") gun_copy_vars = list("fire_sound", "burst_size", "fire_delay") diff --git a/code/modules/clothing/head/helmet.dm b/code/modules/clothing/head/helmet.dm index 0884bc618f..d89671d06d 100644 --- a/code/modules/clothing/head/helmet.dm +++ b/code/modules/clothing/head/helmet.dm @@ -19,7 +19,7 @@ /obj/item/clothing/head/helmet/Initialize() - ..() + . = ..() /obj/item/clothing/head/helmet/sec can_flashlight = 1 @@ -195,7 +195,7 @@ flags_2 = NONE /obj/item/clothing/head/helmet/knight/Initialize(mapload) - ..() + . = ..() /obj/item/clothing/head/helmet/knight/blue icon_state = "knight_blue" diff --git a/code/modules/events/spacevine.dm b/code/modules/events/spacevine.dm index 5ea8c20e32..287635742f 100644 --- a/code/modules/events/spacevine.dm +++ b/code/modules/events/spacevine.dm @@ -285,7 +285,7 @@ var/list/mutations = list() /obj/structure/spacevine/Initialize() - ..() + . = ..() add_atom_colour("#ffffff", FIXED_COLOUR_PRIORITY) /obj/structure/spacevine/examine(mob/user) diff --git a/code/modules/flufftext/Hallucination.dm b/code/modules/flufftext/Hallucination.dm index ca27d00c19..75f8aa7184 100644 --- a/code/modules/flufftext/Hallucination.dm +++ b/code/modules/flufftext/Hallucination.dm @@ -99,7 +99,7 @@ GLOBAL_LIST_INIT(hallucinations_major, list( var/active = TRUE //qdelery /obj/effect/hallucination/simple/Initialize(mapload, var/mob/living/carbon/T) - ..() + . = ..() target = T current_image = GetImage() if(target.client) @@ -206,7 +206,7 @@ GLOBAL_LIST_INIT(hallucinations_major, list( image_state = "alienh_pounce" /obj/effect/hallucination/simple/xeno/Initialize(mapload, mob/living/carbon/T) - ..() + . = ..() name = "alien hunter ([rand(1, 1000)])" /obj/effect/hallucination/simple/xeno/throw_impact(A) diff --git a/code/modules/holiday/halloween.dm b/code/modules/holiday/halloween.dm index dd26f289ff..f8716870e1 100644 --- a/code/modules/holiday/halloween.dm +++ b/code/modules/holiday/halloween.dm @@ -130,7 +130,7 @@ var/timer = 0 /mob/living/simple_animal/shade/howling_ghost/Initialize() - ..() + . = ..() icon_state = pick("ghost","ghostian","ghostian2","ghostking","ghost1","ghost2") icon_living = icon_state status_flags |= GODMODE @@ -194,7 +194,7 @@ var/timer /mob/living/simple_animal/hostile/retaliate/clown/insane/Initialize() - ..() + . = ..() timer = rand(5,15) status_flags = (status_flags | GODMODE) return diff --git a/code/modules/mining/aux_base_camera.dm b/code/modules/mining/aux_base_camera.dm index 1b245c209f..4270b54b0a 100644 --- a/code/modules/mining/aux_base_camera.dm +++ b/code/modules/mining/aux_base_camera.dm @@ -7,7 +7,7 @@ var/area/starting_area /mob/camera/aiEye/remote/base_construction/Initialize() - ..() + . = ..() starting_area = get_area(loc) /mob/camera/aiEye/remote/base_construction/setLoc(var/t) @@ -54,7 +54,7 @@ RCD = new(src) /obj/machinery/computer/camera_advanced/base_construction/Initialize(mapload) - ..() + . = ..() if(mapload) //Map spawned consoles have a filled RCD and stocked special structures RCD.matter = RCD.max_matter fans_remaining = 4 diff --git a/code/modules/mining/lavaland/necropolis_chests.dm b/code/modules/mining/lavaland/necropolis_chests.dm index b9fd781629..3562314458 100644 --- a/code/modules/mining/lavaland/necropolis_chests.dm +++ b/code/modules/mining/lavaland/necropolis_chests.dm @@ -173,7 +173,7 @@ SSblackbox.add_details("wisp_lantern","Returned") /obj/item/device/wisp_lantern/Initialize() - ..() + . = ..() wisp = new(src) /obj/item/device/wisp_lantern/Destroy() @@ -242,7 +242,7 @@ teleport_color = "#FD3F48" /obj/item/device/warp_cube/red/Initialize() - ..() + . = ..() if(!linked) var/obj/item/device/warp_cube/blue = new(src.loc) linked = blue @@ -397,7 +397,7 @@ desc = "Somehow, it's in two places at once." /obj/item/device/shared_storage/red/Initialize() - ..() + . = ..() if(!bag) var/obj/item/storage/backpack/shared/S = new(src) var/obj/item/device/shared_storage/blue = new(src.loc) @@ -703,7 +703,7 @@ var/list/mob/dead/observer/spirits /obj/item/melee/ghost_sword/Initialize() - ..() + . = ..() spirits = list() START_PROCESSING(SSobj, src) GLOB.poi_list |= src diff --git a/code/modules/mining/minebot.dm b/code/modules/mining/minebot.dm index 2f2d3c0a7e..58f091fd4c 100644 --- a/code/modules/mining/minebot.dm +++ b/code/modules/mining/minebot.dm @@ -48,7 +48,7 @@ var/datum/action/innate/minedrone/dump_ore/dump_ore_action /mob/living/simple_animal/hostile/mining_drone/Initialize() - ..() + . = ..() toggle_light_action = new() toggle_light_action.Grant(src) toggle_mode_action = new() diff --git a/code/modules/mining/ores_coins.dm b/code/modules/mining/ores_coins.dm index 7c1465d926..858bec6607 100644 --- a/code/modules/mining/ores_coins.dm +++ b/code/modules/mining/ores_coins.dm @@ -295,7 +295,7 @@ qdel(src) /obj/item/ore/Initialize() - ..() + . = ..() pixel_x = rand(0,16)-8 pixel_y = rand(0,8)-8 @@ -322,7 +322,7 @@ var/value = 1 /obj/item/coin/Initialize() - ..() + . = ..() pixel_x = rand(0,16)-8 pixel_y = rand(0,8)-8 diff --git a/code/modules/mob/living/brain/brain.dm b/code/modules/mob/living/brain/brain.dm index 5161f94808..c437daef48 100644 --- a/code/modules/mob/living/brain/brain.dm +++ b/code/modules/mob/living/brain/brain.dm @@ -7,7 +7,7 @@ see_invisible = SEE_INVISIBLE_LIVING /mob/living/brain/Initialize() - ..() + . = ..() create_dna(src) stored_dna.initialize_dna(random_blood_type()) if(isturf(loc)) //not spawned in an MMI or brain organ (most likely adminspawned) diff --git a/code/modules/mob/living/brain/posibrain.dm b/code/modules/mob/living/brain/posibrain.dm index 175e04dcac..d158eb9576 100644 --- a/code/modules/mob/living/brain/posibrain.dm +++ b/code/modules/mob/living/brain/posibrain.dm @@ -149,7 +149,7 @@ GLOBAL_VAR(posibrain_notify_cooldown) to_chat(user, msg) /obj/item/device/mmi/posibrain/Initialize() - ..() + . = ..() brainmob = new(src) var/new_name if(!LAZYLEN(possible_names)) diff --git a/code/modules/mob/living/carbon/human/human.dm b/code/modules/mob/living/carbon/human/human.dm index dc7542fbab..0fd685e77c 100644 --- a/code/modules/mob/living/carbon/human/human.dm +++ b/code/modules/mob/living/carbon/human/human.dm @@ -34,7 +34,7 @@ INITIALIZE_IMMEDIATE(/mob/living/carbon/human/dummy) handcrafting = new() - ..() + . = ..() /mob/living/carbon/human/create_internal_organs() if(!(NOHUNGER in dna.species.species_traits)) diff --git a/code/modules/mob/living/carbon/human/interactive.dm b/code/modules/mob/living/carbon/human/interactive.dm index 7a80758eae..6add1cb80c 100644 --- a/code/modules/mob/living/carbon/human/interactive.dm +++ b/code/modules/mob/living/carbon/human/interactive.dm @@ -370,7 +370,7 @@ faction += "hostile" /mob/living/carbon/human/interactive/Initialize() - ..() + . = ..() set_species(/datum/species/synth) @@ -1591,7 +1591,7 @@ TRAITS |= TRAIT_ROBUST TRAITS |= TRAIT_MEAN faction += "bot_angry" - ..() + . = ..() /mob/living/carbon/human/interactive/friendly/Initialize() TRAITS |= TRAIT_FRIENDLY @@ -1599,7 +1599,7 @@ faction += "bot_friendly" faction += "neutral" functions -= "combat" - ..() + . = ..() /mob/living/carbon/human/interactive/greytide/Initialize() TRAITS |= TRAIT_ROBUST @@ -1610,7 +1610,7 @@ targetInterestShift = 2 // likewise faction += "bot_grey" graytide = 1 - ..() + . = ..() //Walk softly and carry a big stick /mob/living/carbon/human/interactive/robust/Initialize() @@ -1618,4 +1618,4 @@ TRAITS |= TRAIT_ROBUST TRAITS |= TRAIT_SMART faction += "bot_power" - ..() \ No newline at end of file + . = ..() diff --git a/code/modules/mob/living/carbon/monkey/monkey.dm b/code/modules/mob/living/carbon/monkey/monkey.dm index 8adde0b69c..81e918e152 100644 --- a/code/modules/mob/living/carbon/monkey/monkey.dm +++ b/code/modules/mob/living/carbon/monkey/monkey.dm @@ -147,7 +147,7 @@ aggressive = TRUE /mob/living/carbon/monkey/angry/Initialize() - ..() + . = ..() if(prob(10)) var/obj/item/clothing/head/helmet/justice/escape/helmet = new(src) equip_to_slot_or_del(helmet,slot_head) diff --git a/code/modules/mob/living/carbon/monkey/punpun.dm b/code/modules/mob/living/carbon/monkey/punpun.dm index 52ca8c8226..be716e26ba 100644 --- a/code/modules/mob/living/carbon/monkey/punpun.dm +++ b/code/modules/mob/living/carbon/monkey/punpun.dm @@ -21,7 +21,7 @@ else name = pick(pet_monkey_names) gender = pick(MALE, FEMALE) - ..() + . = ..() //These have to be after the parent new to ensure that the monkey //bodyparts are actually created before we try to equip things to diff --git a/code/modules/mob/living/silicon/robot/robot.dm b/code/modules/mob/living/silicon/robot/robot.dm index 09d2570b72..8fab4c3286 100644 --- a/code/modules/mob/living/silicon/robot/robot.dm +++ b/code/modules/mob/living/silicon/robot/robot.dm @@ -824,7 +824,7 @@ var/set_module = /obj/item/robot_module/syndicate /mob/living/silicon/robot/syndicate/Initialize() - ..() + . = ..() cell.maxcharge = 25000 cell.charge = 25000 radio = new /obj/item/device/radio/borg/syndicate(src) diff --git a/code/modules/mob/living/simple_animal/guardian/types/assassin.dm b/code/modules/mob/living/simple_animal/guardian/types/assassin.dm index ed21310cd9..9632ce3ff9 100644 --- a/code/modules/mob/living/simple_animal/guardian/types/assassin.dm +++ b/code/modules/mob/living/simple_animal/guardian/types/assassin.dm @@ -17,7 +17,7 @@ var/obj/screen/alert/instealthalert /mob/living/simple_animal/hostile/guardian/assassin/Initialize() - ..() + . = ..() stealthcooldown = 0 /mob/living/simple_animal/hostile/guardian/assassin/Life() diff --git a/code/modules/mob/living/simple_animal/hostile/bees.dm b/code/modules/mob/living/simple_animal/hostile/bees.dm index b3070a8db6..dea21157c6 100644 --- a/code/modules/mob/living/simple_animal/hostile/bees.dm +++ b/code/modules/mob/living/simple_animal/hostile/bees.dm @@ -56,7 +56,7 @@ /mob/living/simple_animal/hostile/poison/bees/Initialize() - ..() + . = ..() generate_bee_visuals() @@ -275,7 +275,7 @@ /obj/item/queen_bee/bought/Initialize() - ..() + . = ..() queen = new(src) diff --git a/code/modules/mob/living/simple_animal/hostile/mecha_pilot.dm b/code/modules/mob/living/simple_animal/hostile/mecha_pilot.dm index f4195a93b3..b84f3c8682 100644 --- a/code/modules/mob/living/simple_animal/hostile/mecha_pilot.dm +++ b/code/modules/mob/living/simple_animal/hostile/mecha_pilot.dm @@ -40,7 +40,7 @@ search_objects = 2 /mob/living/simple_animal/hostile/syndicate/mecha_pilot/no_mech/Initialize() - ..() + . = ..() wanted_objects = typecacheof(/obj/mecha/combat, ignore_root_path=TRUE) /mob/living/simple_animal/hostile/syndicate/mecha_pilot/nanotrasen //nanotrasen are syndies! no it's just a weird path. @@ -60,7 +60,7 @@ /mob/living/simple_animal/hostile/syndicate/mecha_pilot/Initialize() - ..() + . = ..() if(spawn_mecha_type) var/obj/mecha/M = new spawn_mecha_type (get_turf(src)) if(istype(M)) diff --git a/code/modules/mob/living/simple_animal/hostile/megafauna/bubblegum.dm b/code/modules/mob/living/simple_animal/hostile/megafauna/bubblegum.dm index 2e11a152a9..6e6237aab5 100644 --- a/code/modules/mob/living/simple_animal/hostile/megafauna/bubblegum.dm +++ b/code/modules/mob/living/simple_animal/hostile/megafauna/bubblegum.dm @@ -105,11 +105,10 @@ Difficulty: Hard /mob/living/simple_animal/hostile/megafauna/bubblegum/Initialize() - ..() + . = ..() for(var/mob/living/simple_animal/hostile/megafauna/bubblegum/B in GLOB.mob_list) if(B != src) - qdel(src) //There can be only one - return + return INITIALIZE_HINT_QDEL //There can be only one var/obj/effect/proc_holder/spell/bloodcrawl/bloodspell = new AddSpell(bloodspell) if(istype(loc, /obj/effect/dummy/slaughter)) diff --git a/code/modules/mob/living/simple_animal/hostile/megafauna/colossus.dm b/code/modules/mob/living/simple_animal/hostile/megafauna/colossus.dm index ab39c35413..480408eab4 100644 --- a/code/modules/mob/living/simple_animal/hostile/megafauna/colossus.dm +++ b/code/modules/mob/living/simple_animal/hostile/megafauna/colossus.dm @@ -93,7 +93,7 @@ Difficulty: Very Hard /mob/living/simple_animal/hostile/megafauna/colossus/Initialize() - ..() + . = ..() internal = new/obj/item/device/gps/internal/colossus(src) /obj/effect/temp_visual/at_shield diff --git a/code/modules/mob/living/simple_animal/hostile/mimic.dm b/code/modules/mob/living/simple_animal/hostile/mimic.dm index 131abbec2d..abe095779b 100644 --- a/code/modules/mob/living/simple_animal/hostile/mimic.dm +++ b/code/modules/mob/living/simple_animal/hostile/mimic.dm @@ -1,268 +1,268 @@ -/mob/living/simple_animal/hostile/mimic - name = "crate" - desc = "A rectangular steel crate." - icon = 'icons/obj/crates.dmi' - icon_state = "crate" - icon_living = "crate" - - response_help = "touches" - response_disarm = "pushes" - response_harm = "hits" - speed = 0 - maxHealth = 250 - health = 250 - gender = NEUTER - - harm_intent_damage = 5 - melee_damage_lower = 8 - melee_damage_upper = 12 - attacktext = "attacks" - attack_sound = 'sound/weapons/punch1.ogg' - emote_taunt = list("growls") - speak_emote = list("creaks") - taunt_chance = 30 - - atmos_requirements = list("min_oxy" = 0, "max_oxy" = 0, "min_tox" = 0, "max_tox" = 0, "min_co2" = 0, "max_co2" = 0, "min_n2" = 0, "max_n2" = 0) - minbodytemp = 0 - - faction = list("mimic") - move_to_delay = 9 - gold_core_spawnable = 1 - del_on_death = 1 - -// Aggro when you try to open them. Will also pickup loot when spawns and drop it when dies. -/mob/living/simple_animal/hostile/mimic/crate - attacktext = "bites" - speak_emote = list("clatters") - stop_automated_movement = 1 - wander = 0 +/mob/living/simple_animal/hostile/mimic + name = "crate" + desc = "A rectangular steel crate." + icon = 'icons/obj/crates.dmi' + icon_state = "crate" + icon_living = "crate" + + response_help = "touches" + response_disarm = "pushes" + response_harm = "hits" + speed = 0 + maxHealth = 250 + health = 250 + gender = NEUTER + + harm_intent_damage = 5 + melee_damage_lower = 8 + melee_damage_upper = 12 + attacktext = "attacks" + attack_sound = 'sound/weapons/punch1.ogg' + emote_taunt = list("growls") + speak_emote = list("creaks") + taunt_chance = 30 + + atmos_requirements = list("min_oxy" = 0, "max_oxy" = 0, "min_tox" = 0, "max_tox" = 0, "min_co2" = 0, "max_co2" = 0, "min_n2" = 0, "max_n2" = 0) + minbodytemp = 0 + + faction = list("mimic") + move_to_delay = 9 + gold_core_spawnable = 1 + del_on_death = 1 + +// Aggro when you try to open them. Will also pickup loot when spawns and drop it when dies. +/mob/living/simple_animal/hostile/mimic/crate + attacktext = "bites" + speak_emote = list("clatters") + stop_automated_movement = 1 + wander = 0 var/attempt_open = FALSE - -// Pickup loot -/mob/living/simple_animal/hostile/mimic/crate/Initialize(mapload) - ..() - if(mapload) //eat shit - for(var/obj/item/I in loc) - I.loc = src - -/mob/living/simple_animal/hostile/mimic/crate/DestroySurroundings() - ..() - if(prob(90)) - icon_state = "[initial(icon_state)]open" - else - icon_state = initial(icon_state) - -/mob/living/simple_animal/hostile/mimic/crate/ListTargets() - if(attempt_open) - return ..() - return ..(1) - -/mob/living/simple_animal/hostile/mimic/crate/FindTarget() - . = ..() - if(.) - trigger() - -/mob/living/simple_animal/hostile/mimic/crate/AttackingTarget() - . = ..() - if(.) - icon_state = initial(icon_state) - if(prob(15) && iscarbon(target)) - var/mob/living/carbon/C = target - C.Knockdown(40) - C.visible_message("\The [src] knocks down \the [C]!", \ - "\The [src] knocks you down!") - -/mob/living/simple_animal/hostile/mimic/crate/proc/trigger() - if(!attempt_open) - visible_message("[src] starts to move!") + +// Pickup loot +/mob/living/simple_animal/hostile/mimic/crate/Initialize(mapload) + . = ..() + if(mapload) //eat shit + for(var/obj/item/I in loc) + I.loc = src + +/mob/living/simple_animal/hostile/mimic/crate/DestroySurroundings() + ..() + if(prob(90)) + icon_state = "[initial(icon_state)]open" + else + icon_state = initial(icon_state) + +/mob/living/simple_animal/hostile/mimic/crate/ListTargets() + if(attempt_open) + return ..() + return ..(1) + +/mob/living/simple_animal/hostile/mimic/crate/FindTarget() + . = ..() + if(.) + trigger() + +/mob/living/simple_animal/hostile/mimic/crate/AttackingTarget() + . = ..() + if(.) + icon_state = initial(icon_state) + if(prob(15) && iscarbon(target)) + var/mob/living/carbon/C = target + C.Knockdown(40) + C.visible_message("\The [src] knocks down \the [C]!", \ + "\The [src] knocks you down!") + +/mob/living/simple_animal/hostile/mimic/crate/proc/trigger() + if(!attempt_open) + visible_message("[src] starts to move!") attempt_open = TRUE - -/mob/living/simple_animal/hostile/mimic/crate/adjustHealth(amount, updating_health = TRUE, forced = FALSE) - trigger() - . = ..() - -/mob/living/simple_animal/hostile/mimic/crate/LoseTarget() - ..() - icon_state = initial(icon_state) - -/mob/living/simple_animal/hostile/mimic/crate/death() - var/obj/structure/closet/crate/C = new(get_turf(src)) - // Put loot in crate - for(var/obj/O in src) - O.loc = C - ..() - -GLOBAL_LIST_INIT(protected_objects, list(/obj/structure/table, /obj/structure/cable, /obj/structure/window)) - -/mob/living/simple_animal/hostile/mimic/copy - health = 100 - maxHealth = 100 - var/mob/living/creator = null // the creator - var/destroy_objects = 0 - var/knockdown_people = 0 - var/static/mutable_appearance/googly_eyes = mutable_appearance('icons/mob/mob.dmi', "googly_eyes") - gold_core_spawnable = 0 - -/mob/living/simple_animal/hostile/mimic/copy/Initialize(mapload, obj/copy, mob/living/creator, destroy_original = 0) - ..() - CopyObject(copy, creator, destroy_original) - -/mob/living/simple_animal/hostile/mimic/copy/Life() - ..() - if(!target && !ckey) //Objects eventually revert to normal if no one is around to terrorize - adjustBruteLoss(1) - for(var/mob/living/M in contents) //a fix for animated statues from the flesh to stone spell - death() - -/mob/living/simple_animal/hostile/mimic/copy/death() - for(var/atom/movable/M in src) - M.loc = get_turf(src) - ..() - -/mob/living/simple_animal/hostile/mimic/copy/ListTargets() - . = ..() - return . - creator - -/mob/living/simple_animal/hostile/mimic/copy/proc/ChangeOwner(mob/owner) - if(owner != creator) - LoseTarget() - creator = owner - faction |= "\ref[owner]" - -/mob/living/simple_animal/hostile/mimic/copy/proc/CheckObject(obj/O) - if((isitem(O) || istype(O, /obj/structure)) && !is_type_in_list(O, GLOB.protected_objects)) - return 1 - return 0 - -/mob/living/simple_animal/hostile/mimic/copy/proc/CopyObject(obj/O, mob/living/user, destroy_original = 0) - if(destroy_original || CheckObject(O)) - O.loc = src - name = O.name - desc = O.desc - icon = O.icon - icon_state = O.icon_state - icon_living = icon_state - copy_overlays(O) - add_overlay(googly_eyes) - if(istype(O, /obj/structure) || istype(O, /obj/machinery)) - health = (anchored * 50) + 50 - destroy_objects = 1 - if(O.density && O.anchored) - knockdown_people = 1 - melee_damage_lower *= 2 - melee_damage_upper *= 2 - else if(isitem(O)) - var/obj/item/I = O - health = 15 * I.w_class - melee_damage_lower = 2 + I.force - melee_damage_upper = 2 + I.force - move_to_delay = 2 * I.w_class + 1 - maxHealth = health - if(user) - creator = user - faction += "\ref[creator]" // very unique - if(destroy_original) - qdel(O) - return 1 - -/mob/living/simple_animal/hostile/mimic/copy/DestroySurroundings() - if(destroy_objects) - ..() - -/mob/living/simple_animal/hostile/mimic/copy/AttackingTarget() - . = ..() - if(knockdown_people && . && prob(15) && iscarbon(target)) - var/mob/living/carbon/C = target - C.Knockdown(40) - C.visible_message("\The [src] knocks down \the [C]!", \ - "\The [src] knocks you down!") - -/mob/living/simple_animal/hostile/mimic/copy/machine - speak = list("HUMANS ARE IMPERFECT!", "YOU SHALL BE ASSIMILATED!", "YOU ARE HARMING YOURSELF", "You have been deemed hazardous. Will you comply?", \ - "My logic is undeniable.", "One of us.", "FLESH IS WEAK", "THIS ISN'T WAR, THIS IS EXTERMINATION!") - speak_chance = 7 - -/mob/living/simple_animal/hostile/mimic/copy/machine/CanAttack(atom/the_target) - if(the_target == creator) // Don't attack our creator AI. - return 0 - if(iscyborg(the_target)) - var/mob/living/silicon/robot/R = the_target - if(R.connected_ai == creator) // Only attack robots that aren't synced to our creator AI. - return 0 - return ..() - - - -/mob/living/simple_animal/hostile/mimic/copy/ranged - var/obj/item/gun/TrueGun = null - var/obj/item/gun/magic/Zapstick - var/obj/item/gun/ballistic/Pewgun - var/obj/item/gun/energy/Zapgun - -/mob/living/simple_animal/hostile/mimic/copy/ranged/CopyObject(obj/O, mob/living/creator, destroy_original = 0) - if(..()) - emote_see = list("aims menacingly") - obj_damage = 0 - environment_smash = ENVIRONMENT_SMASH_NONE //needed? seems weird for them to do so - ranged = 1 - retreat_distance = 1 //just enough to shoot - minimum_distance = 6 - var/obj/item/gun/G = O - melee_damage_upper = G.force - melee_damage_lower = G.force - max(0, (G.force / 2)) - move_to_delay = 2 * G.w_class + 1 - projectilesound = G.fire_sound - TrueGun = G - if(istype(G, /obj/item/gun/magic)) - Zapstick = G - var/obj/item/ammo_casing/magic/M = Zapstick.ammo_type - projectiletype = initial(M.projectile_type) - if(istype(G, /obj/item/gun/ballistic)) - Pewgun = G - var/obj/item/ammo_box/magazine/M = Pewgun.mag_type - casingtype = initial(M.ammo_type) - if(istype(G, /obj/item/gun/energy)) - Zapgun = G - var/selectfiresetting = Zapgun.select - var/obj/item/ammo_casing/energy/E = Zapgun.ammo_type[selectfiresetting] - projectiletype = initial(E.projectile_type) - -/mob/living/simple_animal/hostile/mimic/copy/ranged/OpenFire(the_target) - if(Zapgun) - if(Zapgun.cell) - var/obj/item/ammo_casing/energy/shot = Zapgun.ammo_type[Zapgun.select] - if(Zapgun.cell.charge >= shot.e_cost) - Zapgun.cell.use(shot.e_cost) - Zapgun.update_icon() - ..() - else if(Zapstick) - if(Zapstick.charges) - Zapstick.charges-- - Zapstick.update_icon() - ..() - else if(Pewgun) - if(Pewgun.chambered) - if(Pewgun.chambered.BB) - qdel(Pewgun.chambered.BB) - Pewgun.chambered.BB = null //because qdel takes too long, ensures icon update - Pewgun.chambered.update_icon() - ..() - else - visible_message("The [src] clears a jam!") - Pewgun.chambered.loc = loc //rip revolver immersions, blame shotgun snowflake procs - Pewgun.chambered = null - if(Pewgun.magazine && Pewgun.magazine.stored_ammo.len) - Pewgun.chambered = Pewgun.magazine.get_round(0) - Pewgun.chambered.loc = Pewgun - Pewgun.update_icon() - else if(Pewgun.magazine && Pewgun.magazine.stored_ammo.len) //only true for pumpguns i think - Pewgun.chambered = Pewgun.magazine.get_round(0) - Pewgun.chambered.loc = Pewgun - visible_message("The [src] cocks itself!") - else - ranged = 0 //BANZAIIII - retreat_distance = 0 - minimum_distance = 1 - return - icon_state = TrueGun.icon_state - icon_living = TrueGun.icon_state + +/mob/living/simple_animal/hostile/mimic/crate/adjustHealth(amount, updating_health = TRUE, forced = FALSE) + trigger() + . = ..() + +/mob/living/simple_animal/hostile/mimic/crate/LoseTarget() + ..() + icon_state = initial(icon_state) + +/mob/living/simple_animal/hostile/mimic/crate/death() + var/obj/structure/closet/crate/C = new(get_turf(src)) + // Put loot in crate + for(var/obj/O in src) + O.loc = C + ..() + +GLOBAL_LIST_INIT(protected_objects, list(/obj/structure/table, /obj/structure/cable, /obj/structure/window)) + +/mob/living/simple_animal/hostile/mimic/copy + health = 100 + maxHealth = 100 + var/mob/living/creator = null // the creator + var/destroy_objects = 0 + var/knockdown_people = 0 + var/static/mutable_appearance/googly_eyes = mutable_appearance('icons/mob/mob.dmi', "googly_eyes") + gold_core_spawnable = 0 + +/mob/living/simple_animal/hostile/mimic/copy/Initialize(mapload, obj/copy, mob/living/creator, destroy_original = 0) + . = ..() + CopyObject(copy, creator, destroy_original) + +/mob/living/simple_animal/hostile/mimic/copy/Life() + ..() + if(!target && !ckey) //Objects eventually revert to normal if no one is around to terrorize + adjustBruteLoss(1) + for(var/mob/living/M in contents) //a fix for animated statues from the flesh to stone spell + death() + +/mob/living/simple_animal/hostile/mimic/copy/death() + for(var/atom/movable/M in src) + M.loc = get_turf(src) + ..() + +/mob/living/simple_animal/hostile/mimic/copy/ListTargets() + . = ..() + return . - creator + +/mob/living/simple_animal/hostile/mimic/copy/proc/ChangeOwner(mob/owner) + if(owner != creator) + LoseTarget() + creator = owner + faction |= "\ref[owner]" + +/mob/living/simple_animal/hostile/mimic/copy/proc/CheckObject(obj/O) + if((isitem(O) || istype(O, /obj/structure)) && !is_type_in_list(O, GLOB.protected_objects)) + return 1 + return 0 + +/mob/living/simple_animal/hostile/mimic/copy/proc/CopyObject(obj/O, mob/living/user, destroy_original = 0) + if(destroy_original || CheckObject(O)) + O.loc = src + name = O.name + desc = O.desc + icon = O.icon + icon_state = O.icon_state + icon_living = icon_state + copy_overlays(O) + add_overlay(googly_eyes) + if(istype(O, /obj/structure) || istype(O, /obj/machinery)) + health = (anchored * 50) + 50 + destroy_objects = 1 + if(O.density && O.anchored) + knockdown_people = 1 + melee_damage_lower *= 2 + melee_damage_upper *= 2 + else if(isitem(O)) + var/obj/item/I = O + health = 15 * I.w_class + melee_damage_lower = 2 + I.force + melee_damage_upper = 2 + I.force + move_to_delay = 2 * I.w_class + 1 + maxHealth = health + if(user) + creator = user + faction += "\ref[creator]" // very unique + if(destroy_original) + qdel(O) + return 1 + +/mob/living/simple_animal/hostile/mimic/copy/DestroySurroundings() + if(destroy_objects) + ..() + +/mob/living/simple_animal/hostile/mimic/copy/AttackingTarget() + . = ..() + if(knockdown_people && . && prob(15) && iscarbon(target)) + var/mob/living/carbon/C = target + C.Knockdown(40) + C.visible_message("\The [src] knocks down \the [C]!", \ + "\The [src] knocks you down!") + +/mob/living/simple_animal/hostile/mimic/copy/machine + speak = list("HUMANS ARE IMPERFECT!", "YOU SHALL BE ASSIMILATED!", "YOU ARE HARMING YOURSELF", "You have been deemed hazardous. Will you comply?", \ + "My logic is undeniable.", "One of us.", "FLESH IS WEAK", "THIS ISN'T WAR, THIS IS EXTERMINATION!") + speak_chance = 7 + +/mob/living/simple_animal/hostile/mimic/copy/machine/CanAttack(atom/the_target) + if(the_target == creator) // Don't attack our creator AI. + return 0 + if(iscyborg(the_target)) + var/mob/living/silicon/robot/R = the_target + if(R.connected_ai == creator) // Only attack robots that aren't synced to our creator AI. + return 0 + return ..() + + + +/mob/living/simple_animal/hostile/mimic/copy/ranged + var/obj/item/gun/TrueGun = null + var/obj/item/gun/magic/Zapstick + var/obj/item/gun/ballistic/Pewgun + var/obj/item/gun/energy/Zapgun + +/mob/living/simple_animal/hostile/mimic/copy/ranged/CopyObject(obj/O, mob/living/creator, destroy_original = 0) + if(..()) + emote_see = list("aims menacingly") + obj_damage = 0 + environment_smash = ENVIRONMENT_SMASH_NONE //needed? seems weird for them to do so + ranged = 1 + retreat_distance = 1 //just enough to shoot + minimum_distance = 6 + var/obj/item/gun/G = O + melee_damage_upper = G.force + melee_damage_lower = G.force - max(0, (G.force / 2)) + move_to_delay = 2 * G.w_class + 1 + projectilesound = G.fire_sound + TrueGun = G + if(istype(G, /obj/item/gun/magic)) + Zapstick = G + var/obj/item/ammo_casing/magic/M = Zapstick.ammo_type + projectiletype = initial(M.projectile_type) + if(istype(G, /obj/item/gun/ballistic)) + Pewgun = G + var/obj/item/ammo_box/magazine/M = Pewgun.mag_type + casingtype = initial(M.ammo_type) + if(istype(G, /obj/item/gun/energy)) + Zapgun = G + var/selectfiresetting = Zapgun.select + var/obj/item/ammo_casing/energy/E = Zapgun.ammo_type[selectfiresetting] + projectiletype = initial(E.projectile_type) + +/mob/living/simple_animal/hostile/mimic/copy/ranged/OpenFire(the_target) + if(Zapgun) + if(Zapgun.cell) + var/obj/item/ammo_casing/energy/shot = Zapgun.ammo_type[Zapgun.select] + if(Zapgun.cell.charge >= shot.e_cost) + Zapgun.cell.use(shot.e_cost) + Zapgun.update_icon() + ..() + else if(Zapstick) + if(Zapstick.charges) + Zapstick.charges-- + Zapstick.update_icon() + ..() + else if(Pewgun) + if(Pewgun.chambered) + if(Pewgun.chambered.BB) + qdel(Pewgun.chambered.BB) + Pewgun.chambered.BB = null //because qdel takes too long, ensures icon update + Pewgun.chambered.update_icon() + ..() + else + visible_message("The [src] clears a jam!") + Pewgun.chambered.loc = loc //rip revolver immersions, blame shotgun snowflake procs + Pewgun.chambered = null + if(Pewgun.magazine && Pewgun.magazine.stored_ammo.len) + Pewgun.chambered = Pewgun.magazine.get_round(0) + Pewgun.chambered.loc = Pewgun + Pewgun.update_icon() + else if(Pewgun.magazine && Pewgun.magazine.stored_ammo.len) //only true for pumpguns i think + Pewgun.chambered = Pewgun.magazine.get_round(0) + Pewgun.chambered.loc = Pewgun + visible_message("The [src] cocks itself!") + else + ranged = 0 //BANZAIIII + retreat_distance = 0 + minimum_distance = 1 + return + icon_state = TrueGun.icon_state + icon_living = TrueGun.icon_state diff --git a/code/modules/mob/living/simple_animal/hostile/mining_mobs/goldgrub.dm b/code/modules/mob/living/simple_animal/hostile/mining_mobs/goldgrub.dm index bc682e4be5..85329c76ec 100644 --- a/code/modules/mob/living/simple_animal/hostile/mining_mobs/goldgrub.dm +++ b/code/modules/mob/living/simple_animal/hostile/mining_mobs/goldgrub.dm @@ -33,7 +33,7 @@ var/will_burrow = TRUE /mob/living/simple_animal/hostile/asteroid/goldgrub/Initialize() - ..() + . = ..() var/i = rand(1,3) while(i) loot += pick(/obj/item/ore/silver, /obj/item/ore/gold, /obj/item/ore/uranium, /obj/item/ore/diamond) diff --git a/code/modules/mob/living/simple_animal/hostile/mining_mobs/gutlunch.dm b/code/modules/mob/living/simple_animal/hostile/mining_mobs/gutlunch.dm index 321e176309..11188a9023 100644 --- a/code/modules/mob/living/simple_animal/hostile/mining_mobs/gutlunch.dm +++ b/code/modules/mob/living/simple_animal/hostile/mining_mobs/gutlunch.dm @@ -76,7 +76,7 @@ gender = MALE /mob/living/simple_animal/hostile/asteroid/gutlunch/gubbuck/Initialize() - ..() + . = ..() add_atom_colour(pick("#E39FBB", "#D97D64", "#CF8C4A"), FIXED_COLOUR_PRIORITY) resize = 0.85 update_transform() diff --git a/code/modules/mob/living/simple_animal/hostile/mining_mobs/hivelord.dm b/code/modules/mob/living/simple_animal/hostile/mining_mobs/hivelord.dm index 100327ea72..d2980bbdaf 100644 --- a/code/modules/mob/living/simple_animal/hostile/mining_mobs/hivelord.dm +++ b/code/modules/mob/living/simple_animal/hostile/mining_mobs/hivelord.dm @@ -84,7 +84,7 @@ del_on_death = 1 /mob/living/simple_animal/hostile/asteroid/hivelordbrood/Initialize() - ..() + . = ..() addtimer(CALLBACK(src, .proc/death), 100) //Legion diff --git a/code/modules/mob/living/simple_animal/hostile/statue.dm b/code/modules/mob/living/simple_animal/hostile/statue.dm index 1235d81bbe..b4dc7c8fac 100644 --- a/code/modules/mob/living/simple_animal/hostile/statue.dm +++ b/code/modules/mob/living/simple_animal/hostile/statue.dm @@ -55,7 +55,7 @@ // No movement while seen code. /mob/living/simple_animal/hostile/statue/Initialize(mapload, var/mob/living/creator) - ..() + . = ..() // Give spells mob_spell_list += new /obj/effect/proc_holder/spell/aoe_turf/flicker_lights(src) mob_spell_list += new /obj/effect/proc_holder/spell/aoe_turf/blindness(src) diff --git a/code/modules/mob/living/simple_animal/hostile/wizard.dm b/code/modules/mob/living/simple_animal/hostile/wizard.dm index c30e573a79..f53b5b8f50 100644 --- a/code/modules/mob/living/simple_animal/hostile/wizard.dm +++ b/code/modules/mob/living/simple_animal/hostile/wizard.dm @@ -37,7 +37,7 @@ var/next_cast = 0 /mob/living/simple_animal/hostile/wizard/Initialize() - ..() + . = ..() fireball = new /obj/effect/proc_holder/spell/aimed/fireball fireball.clothes_req = 0 fireball.human_req = 0 diff --git a/code/modules/power/smes.dm b/code/modules/power/smes.dm index 6cbc8f095d..70776b5c05 100644 --- a/code/modules/power/smes.dm +++ b/code/modules/power/smes.dm @@ -45,7 +45,7 @@ to_chat(user, "This SMES has no power terminal!") /obj/machinery/power/smes/Initialize() - ..() + . = ..() dir_loop: for(var/d in GLOB.cardinals) var/turf/T = get_step(src, d)