From 8d605c33d54f7d5546fe4f09cea7d10429fdc606 Mon Sep 17 00:00:00 2001 From: Ren Erthilo Date: Tue, 1 May 2012 18:42:23 +0100 Subject: [PATCH] TG: Minor fixes to the tensioner, changes to the borg deathsquad from 6->3 and fixes their cell Changes changling unstun time to 45 from 25 Fix for the datumvars file which had spaces instead of tabs Adds the starts of a rather robust erping system! In time, we can make SS13 as realistic an ERP simulator as it is an atmos one. Adds metadata support for clients, mostly to hold ERPing notes. This is included in the savefile. Adds code support for a parrot in! Just needs a sprite Bugfix to the 'resist' button, unless I don't understand how it works. I don't see how it could have ever worked before. Preferences are now attached to a mob Revision: r3386 Author: VivianFoxfoot --- code/datums/configuration.dm | 4 + .../mob/living/carbon/alien/humanoid/life.dm | 4 + .../mob/living/carbon/alien/larva/life.dm | 2 + code/modules/mob/living/carbon/brain/life.dm | 2 + code/modules/mob/living/carbon/human/life.dm | 10 +- .../modules/mob/living/carbon/metroid/life.dm | 1 + code/modules/mob/living/carbon/monkey/life.dm | 2 + code/modules/mob/living/living.dm | 36 ++++++++ code/modules/mob/living/say.dm | 3 +- code/modules/mob/mob_defines.dm | 3 +- code/modules/mob/new_player/preferences.dm | 24 +++++ code/modules/mob/new_player/savefile.dm | 7 ++ code/modules/mob/screen.dm | 19 ++-- code/modules/mob/simple_animal/parrot.dm | 91 +++++++++++++++++++ code/setup.dm | 2 + config/config.txt | 4 + 16 files changed, 202 insertions(+), 12 deletions(-) create mode 100644 code/modules/mob/simple_animal/parrot.dm diff --git a/code/datums/configuration.dm b/code/datums/configuration.dm index 46b38c2f745..3cef703980d 100644 --- a/code/datums/configuration.dm +++ b/code/datums/configuration.dm @@ -33,6 +33,7 @@ var/traitor_scaling = 0 //if amount of traitors scales based on amount of players var/protect_roles_from_antagonist = 0// If security and such can be tratior/cult/other var/Tensioner_Active = 0 // If the tensioner is running. + var/allow_Metadata = 0 // Metadata is supported. var/popup_admin_pm = 0 //adminPMs to non-admins show in a pop-up 'reply' window when set to 1. var/list/mode_names = list() @@ -234,6 +235,9 @@ if ("feature_object_spell_system") config.feature_object_spell_system = 1 + if ("allow_metadata") + config.allow_Metadata = 1 + if ("traitor_scaling") config.traitor_scaling = 1 diff --git a/code/modules/mob/living/carbon/alien/humanoid/life.dm b/code/modules/mob/living/carbon/alien/humanoid/life.dm index a0ca95b0413..1388a1314c1 100644 --- a/code/modules/mob/living/carbon/alien/humanoid/life.dm +++ b/code/modules/mob/living/carbon/alien/humanoid/life.dm @@ -14,8 +14,12 @@ if (src.monkeyizing) return + ..() + if (src.stat != 2) //still breathing + + //First, resolve location and get a breath if(air_master.current_cycle%4==2) diff --git a/code/modules/mob/living/carbon/alien/larva/life.dm b/code/modules/mob/living/carbon/alien/larva/life.dm index ae61bbfa032..b975d969cbe 100644 --- a/code/modules/mob/living/carbon/alien/larva/life.dm +++ b/code/modules/mob/living/carbon/alien/larva/life.dm @@ -14,6 +14,8 @@ if (monkeyizing) return + ..() + if (stat != 2) //still breathing //First, resolve location and get a breath diff --git a/code/modules/mob/living/carbon/brain/life.dm b/code/modules/mob/living/carbon/brain/life.dm index 581179cdd8b..4106a1b0144 100644 --- a/code/modules/mob/living/carbon/brain/life.dm +++ b/code/modules/mob/living/carbon/brain/life.dm @@ -4,6 +4,8 @@ set invisibility = 0 set background = 1 + ..() + var/datum/gas_mixture/environment // Added to prevent null location errors-- TLE if(loc) environment = loc.return_air() diff --git a/code/modules/mob/living/carbon/human/life.dm b/code/modules/mob/living/carbon/human/life.dm index 7aeed963ce2..317e9824c8e 100644 --- a/code/modules/mob/living/carbon/human/life.dm +++ b/code/modules/mob/living/carbon/human/life.dm @@ -25,6 +25,8 @@ if(!loc) // Fixing a null error that occurs when the mob isn't found in the world -- TLE return + ..() + //Being buckled to a chair or bed check_if_buckled() @@ -125,8 +127,6 @@ if(!currentTurf.sd_lumcount) playsound_local(src,pick(scarySounds),50, 1, -1) - ..() //for organs - src.moved_recently = max(0, moved_recently-1) /mob/living/carbon/human @@ -457,8 +457,10 @@ return null update_canmove() - if(paralysis || resting || stunned || weakened || buckled || (changeling && changeling.changeling_fakedeath)) canmove = 0 - else canmove = 1 + if(paralysis || stunned || weakened || resting || buckled || (changeling && changeling.changeling_fakedeath)) + canmove = 0 + else + canmove = 1 handle_breath(datum/gas_mixture/breath) if(nodamage || (mutations & mNobreath)) diff --git a/code/modules/mob/living/carbon/metroid/life.dm b/code/modules/mob/living/carbon/metroid/life.dm index 737872121ca..a4b12e934ce 100644 --- a/code/modules/mob/living/carbon/metroid/life.dm +++ b/code/modules/mob/living/carbon/metroid/life.dm @@ -5,6 +5,7 @@ if (src.monkeyizing) return + ..() var/datum/gas_mixture/environment // Added to prevent null location errors-- TLE if(src.loc) diff --git a/code/modules/mob/living/carbon/monkey/life.dm b/code/modules/mob/living/carbon/monkey/life.dm index f5780ed9c83..ab616822cee 100644 --- a/code/modules/mob/living/carbon/monkey/life.dm +++ b/code/modules/mob/living/carbon/monkey/life.dm @@ -23,6 +23,8 @@ if (src.monkeyizing) return + ..() + var/datum/gas_mixture/environment // Added to prevent null location errors-- TLE if(src.loc) environment = loc.return_air() diff --git a/code/modules/mob/living/living.dm b/code/modules/mob/living/living.dm index 28b98787c1d..f272027a12a 100644 --- a/code/modules/mob/living/living.dm +++ b/code/modules/mob/living/living.dm @@ -1,3 +1,19 @@ +/mob/living/Life() + + ..() + + // While I'm doing a terriblly lazy way of initalizing things, why don't I make it so people's preferences tag along with them. This could be useful in fixing the fucking cloned-as-unknown thing, making me not have to dynamically load them during tensioner, and of course, storing metadata. + + if(!src.storedpreferences) + src.storedpreferences = new + storedpreferences.savefile_load(src, 0) + + + + + return + + /mob/living/verb/succumb() set hidden = 1 if ((src.health < 0 && src.health > -95.0)) @@ -227,6 +243,26 @@ else density = !lying + +/mob/living/proc/Examine_OOC() + set name = "Examine Meta-Info (OOC)" + set category = "OOC" + set src in view() + + if(config.allow_Metadata) + usr << "[src]'s Metainfo:" + + if(src.storedpreferences) + usr << "[src]'s OOC Notes: [src.storedpreferences.metadata]" + + else + usr << "[src] does not have any stored infomation!" + + else + usr << "OOC Metadata is not supported by this server!" + + return + /mob/living/attack_animal(mob/M) attack_paw(M) // treat it like a normal non-human attack diff --git a/code/modules/mob/living/say.dm b/code/modules/mob/living/say.dm index 096a517213e..1c459ef1769 100644 --- a/code/modules/mob/living/say.dm +++ b/code/modules/mob/living/say.dm @@ -142,8 +142,9 @@ //world << "channel_prefix=[channel_prefix]; message_mode=[message_mode]" if (message_mode) message = trim(copytext(message, 3)) - if (!ishuman(src) && (message_mode=="department" || (message_mode in radiochannels))) + if (!(ishuman(src) || istype(src, /mob/living/simple_animal)) && (message_mode=="department" || (message_mode in radiochannels))) message_mode = null //only humans can use headsets + // Check removed so parrots can use headsets! if (!message) return diff --git a/code/modules/mob/mob_defines.dm b/code/modules/mob/mob_defines.dm index a727014738f..87c6a95b5cb 100644 --- a/code/modules/mob/mob_defines.dm +++ b/code/modules/mob/mob_defines.dm @@ -282,9 +282,10 @@ the mob is also allowed to move without any sort of restriction. For instance, i var/digitalcamo = 0 // Can they be tracked by the AI? - var/list/organs = list( ) //List of organs. var/list/organs2 = list() //Singularity wants you! var/grav_delay = 0 var/being_strangled = 0 + + var/datum/preferences/storedpreferences = null \ No newline at end of file diff --git a/code/modules/mob/new_player/preferences.dm b/code/modules/mob/new_player/preferences.dm index 194f4af8c92..54ac7295b6d 100644 --- a/code/modules/mob/new_player/preferences.dm +++ b/code/modules/mob/new_player/preferences.dm @@ -129,6 +129,10 @@ datum/preferences skill_specialization = null list/skills = list() // skills can range from 0 to 3 + // OOC Metadata: + metadata = "" + + New() hair_style = new/datum/sprite_accessory/hair/short facial_hair_style = new/datum/sprite_accessory/facial_hair/shaved @@ -243,6 +247,8 @@ datum/preferences dat += "UI Style: [UI == UI_NEW ? "New" : "Old"]
" dat += "Play admin midis: [midis == 1 ? "Yes" : "No"]
" dat += "Ghost ears: [ghost_ears == 0 ? "Nearest Creatures" : "All Speech"]
" + if(config.allow_Metadata) + dat += "OOC Notes: Edit
" if((user.client) && (user.client.holder) && (user.client.holder.rank) && (user.client.holder.rank == "Game Master")) dat += "
OOC
" @@ -640,6 +646,24 @@ datum/preferences if("random") age = rand (20, 45) + if(link_tags["OOC"]) + var/tempnote = "" + tempnote = input(user, "Please enter your OOC Notes!:", "OOC notes" , metadata) as text + var/list/bad_characters = list("_", "\"", "<", ">", ";", "\[", "\]", "{", "}", "|", "\\","0","1","2","3","4","5","6","7","8","9") + + for(var/c in bad_characters) + tempnote = dd_replacetext(tempnote, c, "") + + if(length(tempnote) >= 255) + alert("That name is too long. (255 character max, please)") + return + + metadata = tempnote + return + + + + if(link_tags["b_type"]) switch(link_tags["b_type"]) if("input") diff --git a/code/modules/mob/new_player/savefile.dm b/code/modules/mob/new_player/savefile.dm index 39f01512710..61c55fa852e 100644 --- a/code/modules/mob/new_player/savefile.dm +++ b/code/modules/mob/new_player/savefile.dm @@ -150,6 +150,8 @@ datum/preferences/proc/savefile_save(mob/user, slot) F["skills"] << src.skills F["skill_specialization"] << src.skill_specialization + F["OOC_Notes"] << src.metadata + return 1 // loads the savefile corresponding to the mob's ckey @@ -244,6 +246,11 @@ datum/preferences/proc/savefile_load(mob/user, slot) if(!job_alt_titles) job_alt_titles = new() + F["OOC_Notes"] >> src.metadata + + if(isnull(metadata)) + metadata = "" + //NOTE: Conversion things go inside this if statement //When updating the save file remember to add 1 to BOTH the savefile constants //Also take the old conversion things that no longer apply out of this if diff --git a/code/modules/mob/screen.dm b/code/modules/mob/screen.dm index bdc63af18e5..07343b0c6c8 100644 --- a/code/modules/mob/screen.dm +++ b/code/modules/mob/screen.dm @@ -456,13 +456,16 @@ if("hand") usr:swap_hand() if("resist") - if(usr.next_move < world.time) + if(usr.next_move > world.time) return usr.next_move = world.time + 20 if ((!( usr.stat ) && usr.canmove && !( usr.restrained() ))) + var/resisting = 0 for(var/obj/O in usr.requests) del(O) + resisting++ for(var/obj/item/weapon/grab/G in usr.grabbed_by) + resisting++ if (G.state == 1) del(G) else @@ -477,9 +480,9 @@ for(var/mob/O in viewers(usr, null)) O.show_message(text("\red [] has broken free of []'s headlock!", usr, G.assailant), 1) del(G) - for(var/mob/O in viewers(usr, null)) - O.show_message(text("\red [] resists!", usr), 1) - + if(resisting) + for(var/mob/O in viewers(usr, null)) + O.show_message(text("\red [] resists!", usr), 1) if(usr:handcuffed && usr:canmove && (usr.last_special <= world.time)) var/breakouttime = 1200 var/displaytime = 2 @@ -494,7 +497,8 @@ O.show_message(text("\red [] is trying to break the handcuffs!", usr), 1) spawn(0) if(do_after(usr, 50)) - if(!usr:handcuffed || usr:buckled) return + if(!usr:handcuffed || usr:buckled) + return for(var/mob/O in viewers(usr)) O.show_message(text("\red [] manages to break the handcuffs!", usr), 1) usr << "\green You successfully break your handcuffs." @@ -569,11 +573,14 @@ O.show_message(text("\red [] attempts to unbuckle themself!", usr), 1) spawn(0) if(do_after(usr, 1200)) - if(!usr:buckled) return + if(!usr:buckled) + return for(var/mob/O in viewers(usr)) O.show_message(text("\red [] manages to unbuckle themself!", usr), 1) usr << "\blue You successfully unbuckle yourself." usr:buckled.manual_unbuckle(usr) + + if("module") if(issilicon(usr)) if(usr:module) diff --git a/code/modules/mob/simple_animal/parrot.dm b/code/modules/mob/simple_animal/parrot.dm new file mode 100644 index 00000000000..fd2135060f3 --- /dev/null +++ b/code/modules/mob/simple_animal/parrot.dm @@ -0,0 +1,91 @@ +/mob/living/simple_animal/parrot + name = "\improper Parrot" + desc = "It's a parrot! No dirty words!" + icon = 'mob.dmi' + icon_state = "cat" + icon_living = "cat" + icon_dead = "cat_dead" + speak = list("Hi","Hello!","Cracker?","BAWWWWK george mellons griffing me") + speak_emote = list("squawks","says","yells") + emote_hear = list("squawks","bawks") + emote_see = list("flutters its wings", "glares at you") + speak_chance = 1 + turns_per_move = 5 + meat_type = /obj/item/weapon/reagent_containers/food/snacks/cracker/ + response_help = "pets the" + response_disarm = "gently moves aside the" + response_harm = "swats the" + + ears = new /obj/item/device/radio/headset/heads/ce() + +/mob/living/simple_animal/parrot/DrProfessor + name = "Doctor Professor Parrot, PhD" + desc = "That's the Doctor Professor. He has more degrees than all of the engineering team put together, and has several published papers on quantum cracker theory." + speak = list(":e Check the singlo, you chucklefucks!",":e Wire the solars, you lazy bums!",":e WHO TOOK THE DAMN RIG SUIT?",":e OH GOD ITS FREE CALL THE SHUTTLE") + response_harm = "is attacked in the face by" + +/obj/item/weapon/reagent_containers/food/snacks/cracker/ + name = "Cracker" + desc = "It's a salted cracker." + +/mob/living/simple_animal/parrot/show_inv(mob/user as mob) + user.machine = src + if(user.stat) return + + var/dat = "
Inventory of [name]

" + if(ears) + dat += "
Headset: [ears] (Remove)" + else + dat += "
Headset: Nothing" + + user << browse(dat, text("window=mob[];size=325x500", name)) + onclose(user, "mob[real_name]") + return + + + +/mob/living/simple_animal/parrot/Topic(href, href_list) + if(usr.stat) return + + //Removing from inventory + if(href_list["remove_inv"]) + if(get_dist(src,usr) > 1 || !(ishuman(usr) || ismonkey(usr) || isrobot(usr) || isalienadult(usr))) + return + var/remove_from = href_list["remove_inv"] + switch(remove_from) + if("ears") + if(ears) + src.say(":e BAWWWWWK LEAVE THE HEADSET BAWKKKKK!") + ears.loc = src.loc + ears = null + else + usr << "\red There is nothing to remove from its [remove_from]." + return + + //Adding things to inventory + else if(href_list["add_inv"]) + if(get_dist(src,usr) > 1 || !(ishuman(usr) || ismonkey(usr) || isrobot(usr) || isalienadult(usr))) + return + var/add_to = href_list["add_inv"] + if(!usr.get_active_hand()) + usr << "\red You have nothing in your hand to put on its [add_to]." + return + switch(add_to) + if("ears") + if(ears) + usr << "\red It's already wearing something." + return + else + var/obj/item/item_to_add = usr.get_active_hand() + if(!item_to_add) + return + + if( !istype(item_to_add, /obj/item/device/radio/headset) ) + usr << "\red This object won't fit." + return + + usr.drop_item() + item_to_add.loc = src + src.ears = item_to_add + else + ..() diff --git a/code/setup.dm b/code/setup.dm index c3e5a03ce55..26847325425 100644 --- a/code/setup.dm +++ b/code/setup.dm @@ -1,3 +1,5 @@ +#define PI 3.1415 + #define R_IDEAL_GAS_EQUATION 8.31 //kPa*L/(K*mol) #define ONE_ATMOSPHERE 101.325 //kPa diff --git a/config/config.txt b/config/config.txt index 9baff060164..1ba35446cc4 100644 --- a/config/config.txt +++ b/config/config.txt @@ -80,6 +80,10 @@ TRAITOR_SCALING ## If the auto-tensioner is active by default. It creates more tratiors/other antagonists if it consideers the round slowing down. #TENSIONER_ACTIVE + +## If metadata is supported +ALLOW_METADATA + ## allow players to initiate a restart vote ALLOW_VOTE_RESTART