From 49c8c6f2cb699d4004f78ee2a078e780fc3bda5a Mon Sep 17 00:00:00 2001 From: Whitellama Date: Sun, 10 Aug 2014 02:23:36 -0700 Subject: [PATCH] Made arcane tomes a subtype of books, fixes #5838 --- code/datums/mind.dm | 4 +- code/game/gamemodes/cult/cult_items.dm | 7 +-- code/game/gamemodes/cult/ritual.dm | 16 ++--- code/game/gamemodes/cult/runes.dm | 4 +- code/modules/admin/verbs/debug.dm | 2 +- code/modules/library/lib_machines.dm | 41 +++++++------ code/modules/mob/dead/observer/observer.dm | 68 +++++++++++----------- 7 files changed, 73 insertions(+), 69 deletions(-) diff --git a/code/datums/mind.dm b/code/datums/mind.dm index 936eea26d1..111c93d9d7 100644 --- a/code/datums/mind.dm +++ b/code/datums/mind.dm @@ -668,7 +668,7 @@ datum/mind if("tome") var/mob/living/carbon/human/H = current if (istype(H)) - var/obj/item/weapon/tome/T = new(H) + var/obj/item/weapon/book/tome/T = new(H) var/list/slots = list ( "backpack" = slot_in_backpack, @@ -1136,7 +1136,7 @@ datum/mind var/mob/living/carbon/human/H = current if (istype(H)) - var/obj/item/weapon/tome/T = new(H) + var/obj/item/weapon/book/tome/T = new(H) var/list/slots = list ( "backpack" = slot_in_backpack, diff --git a/code/game/gamemodes/cult/cult_items.dm b/code/game/gamemodes/cult/cult_items.dm index d55417c5f5..2917788815 100644 --- a/code/game/gamemodes/cult/cult_items.dm +++ b/code/game/gamemodes/cult/cult_items.dm @@ -56,7 +56,7 @@ item_state = "cultrobes" flags = FPRINT | TABLEPASS body_parts_covered = UPPER_TORSO|LOWER_TORSO|LEGS|ARMS - allowed = list(/obj/item/weapon/tome,/obj/item/weapon/melee/cultblade) + allowed = list(/obj/item/weapon/book/tome,/obj/item/weapon/melee/cultblade) armor = list(melee = 50, bullet = 30, laser = 50,energy = 20, bomb = 25, bio = 10, rad = 0) flags_inv = HIDEJUMPSUIT siemens_coefficient = 0 @@ -78,12 +78,11 @@ item_state = "magusred" flags = FPRINT | TABLEPASS body_parts_covered = UPPER_TORSO|LOWER_TORSO|LEGS|ARMS - allowed = list(/obj/item/weapon/tome,/obj/item/weapon/melee/cultblade) + allowed = list(/obj/item/weapon/book/tome,/obj/item/weapon/melee/cultblade) armor = list(melee = 50, bullet = 30, laser = 50,energy = 20, bomb = 25, bio = 10, rad = 0) flags_inv = HIDEGLOVES|HIDESHOES|HIDEJUMPSUIT siemens_coefficient = 0 - /obj/item/clothing/head/helmet/space/cult name = "cult helmet" desc = "A space worthy helmet used by the followers of Nar-Sie" @@ -98,7 +97,7 @@ item_state = "cult_armour" desc = "A bulky suit of armour, bristling with spikes. It looks space proof." w_class = 3 - allowed = list(/obj/item/weapon/tome,/obj/item/weapon/melee/cultblade,/obj/item/weapon/tank/emergency_oxygen,/obj/item/device/suit_cooling_unit) + allowed = list(/obj/item/weapon/book/tome,/obj/item/weapon/melee/cultblade,/obj/item/weapon/tank/emergency_oxygen,/obj/item/device/suit_cooling_unit) slowdown = 1 armor = list(melee = 60, bullet = 50, laser = 30,energy = 15, bomb = 30, bio = 30, rad = 30) siemens_coefficient = 0 \ No newline at end of file diff --git a/code/game/gamemodes/cult/ritual.dm b/code/game/gamemodes/cult/ritual.dm index 24f3ba27c7..e60795f5fd 100644 --- a/code/game/gamemodes/cult/ritual.dm +++ b/code/game/gamemodes/cult/ritual.dm @@ -91,7 +91,7 @@ var/engwords = list("travel", "blood", "join", "hell", "destroy", "technology", attackby(I as obj, user as mob) - if(istype(I, /obj/item/weapon/tome) && iscultist(user)) + if(istype(I, /obj/item/weapon/book/tome) && iscultist(user)) user << "You retrace your steps, carefully undoing the lines of the rune." del(src) return @@ -178,13 +178,15 @@ var/engwords = list("travel", "blood", "join", "hell", "destroy", "technology", check_icon() icon = get_uristrune_cult(word1, word2, word3) -/obj/item/weapon/tome +/obj/item/weapon/book/tome name = "arcane tome" + icon = 'icons/obj/weapons.dmi' icon_state ="tome" throw_speed = 1 throw_range = 5 w_class = 2.0 flags = FPRINT | TABLEPASS + unique = 1 var/notedat = "" var/tomedat = "" var/list/words = list("ire" = "ire", "ego" = "ego", "nahlizet" = "nahlizet", "certum" = "certum", "veri" = "veri", "jatkaa" = "jatkaa", "balaq" = "balaq", "mgar" = "mgar", "karazet" = "karazet", "geeri" = "geeri") @@ -313,7 +315,7 @@ var/engwords = list("travel", "blood", "join", "hell", "destroy", "technology", [words[10]] is [words[words[10]]] Clear
"} usr << browse("[notedat]", "window=notes") -// call(/obj/item/weapon/tome/proc/edit_notes)() +// call(/obj/item/weapon/book/tome/proc/edit_notes)() else usr << browse(null, "window=notes") return @@ -408,7 +410,7 @@ var/engwords = list("travel", "blood", "join", "hell", "destroy", "technology", [words[9]] is [words[words[9]]] Clear
[words[10]] is [words[words[10]]] Clear
"} -// call(/obj/item/weapon/tome/proc/edit_notes)() +// call(/obj/item/weapon/book/tome/proc/edit_notes)() user << browse("[notedat]", "window=notes") return if(usr.get_active_hand() != src) @@ -493,8 +495,8 @@ var/engwords = list("travel", "blood", "join", "hell", "destroy", "technology", user << "The book seems full of illegible scribbles. Is this a joke?" return - attackby(obj/item/weapon/tome/T as obj, mob/living/user as mob) - if(istype(T, /obj/item/weapon/tome)) // sanity check to prevent a runtime error + attackby(obj/item/weapon/book/tome/T as obj, mob/living/user as mob) + if(istype(T, /obj/item/weapon/book/tome)) // sanity check to prevent a runtime error switch(alert("Copy the runes from your tome?",,"Copy", "Cancel")) if("cancel") return @@ -515,7 +517,7 @@ var/engwords = list("travel", "blood", "join", "hell", "destroy", "technology", else usr << "The scriptures of Nar-Sie, The One Who Sees, The Geometer of Blood. Contains the details of every ritual his followers could think of. Most of these are useless, though." -/obj/item/weapon/tome/imbued //admin tome, spawns working runes without waiting +/obj/item/weapon/book/tome/imbued //admin tome, spawns working runes without waiting w_class = 2.0 var/cultistsonly = 1 attack_self(mob/user as mob) diff --git a/code/game/gamemodes/cult/runes.dm b/code/game/gamemodes/cult/runes.dm index 3da1dd8d25..1fbc0d6f98 100644 --- a/code/game/gamemodes/cult/runes.dm +++ b/code/game/gamemodes/cult/runes.dm @@ -87,9 +87,9 @@ var/list/sacrificed = list() "\red You are blinded by the flash of red light! After you're able to see again, you see that now instead of the rune there's a book.", \ "\red You hear a pop and smell ozone.") if(istype(src,/obj/effect/rune)) - new /obj/item/weapon/tome(src.loc) + new /obj/item/weapon/book/tome(src.loc) else - new /obj/item/weapon/tome(usr.loc) + new /obj/item/weapon/book/tome(usr.loc) del(src) return diff --git a/code/modules/admin/verbs/debug.dm b/code/modules/admin/verbs/debug.dm index d2a53f0aff..b1aaf5567b 100644 --- a/code/modules/admin/verbs/debug.dm +++ b/code/modules/admin/verbs/debug.dm @@ -310,7 +310,7 @@ But you can call procs that are of type /mob/living/carbon/human/proc/ for that else if(alert("Spawn that person a tome?",,"Yes","No")=="Yes") M << "\red You catch a glimpse of the Realm of Nar-Sie, The Geometer of Blood. You now see how flimsy the world is, you see that it should be open to the knowledge of Nar-Sie. A tome, a message from your new master, appears on the ground." - new /obj/item/weapon/tome(M.loc) + new /obj/item/weapon/book/tome(M.loc) else M << "\red You catch a glimpse of the Realm of Nar-Sie, The Geometer of Blood. You now see how flimsy the world is, you see that it should be open to the knowledge of Nar-Sie." var/glimpse=pick("1","2","3","4","5","6","7","8") diff --git a/code/modules/library/lib_machines.dm b/code/modules/library/lib_machines.dm index d93348d6bd..d1561da59d 100644 --- a/code/modules/library/lib_machines.dm +++ b/code/modules/library/lib_machines.dm @@ -147,7 +147,7 @@ datum/borrowbook // Datum used to keep track of who has borrowed what when and f if(src.emagged) dat += "7. Access the Forbidden Lore Vault
" if(src.arcanecheckout) - new /obj/item/weapon/tome(src.loc) + new /obj/item/weapon/book/tome(src.loc) user << "Your sanity barely endures the seconds spent in the vault's browsing window. The only thing to remind you of this when you stop browsing is a dusty old tome sitting on the desk. You don't really remember printing it." user.visible_message("[user] stares at the blank screen for a few moments, his expression frozen in fear. When he finally awakens from it, he looks a lot older.", 2) src.arcanecheckout = 0 @@ -329,26 +329,29 @@ datum/borrowbook // Datum used to keep track of who has borrowed what when and f if(scanner.cache) var/choice = input("Are you certain you wish to upload this title to the Archive?") in list("Confirm", "Abort") if(choice == "Confirm") - establish_old_db_connection() - if(!dbcon_old.IsConnected()) - alert("Connection to Archive has been severed. Aborting.") + if(scanner.cache.unique) + alert("This book has been rejected from the database. Aborting!") else - /* - var/sqltitle = dbcon.Quote(scanner.cache.name) - var/sqlauthor = dbcon.Quote(scanner.cache.author) - var/sqlcontent = dbcon.Quote(scanner.cache.dat) - var/sqlcategory = dbcon.Quote(upload_category) - */ - var/sqltitle = sanitizeSQL(scanner.cache.name) - var/sqlauthor = sanitizeSQL(scanner.cache.author) - var/sqlcontent = sanitizeSQL(scanner.cache.dat) - var/sqlcategory = sanitizeSQL(upload_category) - var/DBQuery/query = dbcon_old.NewQuery("INSERT INTO library (author, title, content, category) VALUES ('[sqlauthor]', '[sqltitle]', '[sqlcontent]', '[sqlcategory]')") - if(!query.Execute()) - usr << query.ErrorMsg() + establish_old_db_connection() + if(!dbcon_old.IsConnected()) + alert("Connection to Archive has been severed. Aborting.") else - log_game("[usr.name]/[usr.key] has uploaded the book titled [scanner.cache.name], [length(scanner.cache.dat)] signs") - alert("Upload Complete.") + /* + var/sqltitle = dbcon.Quote(scanner.cache.name) + var/sqlauthor = dbcon.Quote(scanner.cache.author) + var/sqlcontent = dbcon.Quote(scanner.cache.dat) + var/sqlcategory = dbcon.Quote(upload_category) + */ + var/sqltitle = sanitizeSQL(scanner.cache.name) + var/sqlauthor = sanitizeSQL(scanner.cache.author) + var/sqlcontent = sanitizeSQL(scanner.cache.dat) + var/sqlcategory = sanitizeSQL(upload_category) + var/DBQuery/query = dbcon_old.NewQuery("INSERT INTO library (author, title, content, category) VALUES ('[sqlauthor]', '[sqltitle]', '[sqlcontent]', '[sqlcategory]')") + if(!query.Execute()) + usr << query.ErrorMsg() + else + log_game("[usr.name]/[usr.key] has uploaded the book titled [scanner.cache.name], [length(scanner.cache.dat)] signs") + alert("Upload Complete.") if(href_list["targetid"]) var/sqlid = sanitizeSQL(href_list["targetid"]) diff --git a/code/modules/mob/dead/observer/observer.dm b/code/modules/mob/dead/observer/observer.dm index 13cc1933e2..12fea0ca24 100644 --- a/code/modules/mob/dead/observer/observer.dm +++ b/code/modules/mob/dead/observer/observer.dm @@ -69,17 +69,17 @@ ..() - -/mob/dead/observer/Topic(href, href_list) - if (href_list["track"]) - var/mob/target = locate(href_list["track"]) in mob_list - if(target) - ManualFollow(target) - - - + +/mob/dead/observer/Topic(href, href_list) + if (href_list["track"]) + var/mob/target = locate(href_list["track"]) in mob_list + if(target) + ManualFollow(target) + + + /mob/dead/attackby(obj/item/W, mob/user) - if(istype(W,/obj/item/weapon/tome)) + if(istype(W,/obj/item/weapon/book/tome)) var/mob/dead/M = src if(src.invisibility != 0) M.invisibility = 0 @@ -111,7 +111,7 @@ Works together with spawning an observer, noted above. for(var/image/hud in client.images) if(copytext(hud.icon_state,1,4) == "hud") client.images.Remove(hud) - + if(antagHUD) var/list/target_list = list() for(var/mob/living/target in oview(src, 14)) @@ -123,19 +123,19 @@ Works together with spawning an observer, noted above. process_medHUD(src) -/mob/dead/proc/process_medHUD(var/mob/M) - var/client/C = M.client - for(var/mob/living/carbon/human/patient in oview(M, 14)) - C.images += patient.hud_list[HEALTH_HUD] - C.images += patient.hud_list[STATUS_HUD_OOC] - -/mob/dead/proc/assess_targets(list/target_list, mob/dead/observer/U) - var/client/C = U.client - for(var/mob/living/carbon/human/target in target_list) - C.images += target.hud_list[SPECIALROLE_HUD] - - -/* +/mob/dead/proc/process_medHUD(var/mob/M) + var/client/C = M.client + for(var/mob/living/carbon/human/patient in oview(M, 14)) + C.images += patient.hud_list[HEALTH_HUD] + C.images += patient.hud_list[STATUS_HUD_OOC] + +/mob/dead/proc/assess_targets(list/target_list, mob/dead/observer/U) + var/client/C = U.client + for(var/mob/living/carbon/human/target in target_list) + C.images += target.hud_list[SPECIALROLE_HUD] + + +/* else//If the silicon mob has no law datum, no inherent laws, or a law zero, add them to the hud. var/mob/living/silicon/silicon_target = target if(!silicon_target.laws||(silicon_target.laws&&(silicon_target.laws.zeroth||!silicon_target.laws.inherent.len))||silicon_target.mind.special_role=="traitor") @@ -143,9 +143,9 @@ Works together with spawning an observer, noted above. U.client.images += image(tempHud,silicon_target,"hudmalborg") else U.client.images += image(tempHud,silicon_target,"hudmalai") -*/ - return 1 - +*/ + return 1 + /mob/proc/ghostize(var/can_reenter_corpse = 1) if(key) var/mob/dead/observer/ghost = new(src) //Transfer safety to observer spawning proc. @@ -256,10 +256,10 @@ This is the proc mobs get to turn into a ghost. Forked from ghostize due to comp set category = "Ghost" set name = "Toggle AntagHUD" set desc = "Toggles AntagHUD allowing you to see who is the antagonist" - - if(!client) - return - var/mentor = is_mentor(usr.client) + + if(!client) + return + var/mentor = is_mentor(usr.client) if(!config.antag_hud_allowed && (!client.holder || mentor)) src << "\red Admins have disabled this for this round." return @@ -387,9 +387,9 @@ This is the proc mobs get to turn into a ghost. Forked from ghostize due to comp /mob/dead/observer/verb/analyze_air() set name = "Analyze Air" set category = "Ghost" - + if(!istype(usr, /mob/dead/observer)) return - + // Shamelessly copied from the Gas Analyzers if (!( istype(usr.loc, /turf) )) return @@ -572,4 +572,4 @@ This is the proc mobs get to turn into a ghost. Forked from ghostize due to comp W.update_icon() W.message = message W.add_hiddenprint(src) - W.visible_message("\red Invisible fingers crudely paint something in blood on [T]...") + W.visible_message("\red Invisible fingers crudely paint something in blood on [T]...")