New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Devil fixes #18520
Devil fixes #18520
Changes from all commits
03d2e68
7170418
39fe34c
cc0c9e6
c339507
77f3a22
88e5d43
1abd8ce
90194ee
beaae15
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -4,6 +4,17 @@ | |
new newtype(loc) | ||
qdel(src) | ||
|
||
/obj/item/weapon/book/random | ||
var/amount = 1 | ||
var/category = null | ||
|
||
/obj/item/weapon/book/random/New() | ||
create_random_books(amount, src.loc, TRUE, category) | ||
qdel(src) | ||
|
||
/obj/item/weapon/book/random/triple | ||
amount = 3 | ||
|
||
/obj/structure/bookcase/random | ||
var/category = null | ||
var/book_count = 2 | ||
|
@@ -18,31 +29,36 @@ | |
if(!book_count || !isnum(book_count)) | ||
update_icon() | ||
return | ||
book_count += pick(-1,-1,0,1,1) | ||
create_random_books(book_count, src, FALSE, category) | ||
update_icon() | ||
|
||
/proc/create_random_books(amount = 2, location, fail_loud = FALSE, category = null) | ||
. = list() | ||
if(!isnum(amount) || amount<1) | ||
return | ||
if(!establish_db_connection()) | ||
if(prob(5)) | ||
var/obj/item/weapon/paper/P = new(get_turf(loc)) | ||
if(fail_loud || prob(5)) | ||
var/obj/item/weapon/paper/P = new(location) | ||
P.info = "There once was a book from Nantucket<br>But the database failed us, so f*$! it.<br>I tried to be good to you<br>Now this is an I.O.U<br>If you're feeling entitled, well, stuff it!<br><br><font color='gray'>~</font>" | ||
update_icon() | ||
return | ||
if(category && prob(25)) category = null | ||
book_count += pick(-1,-1,0,1,1) | ||
if(book_count <= 0) | ||
update_icon() | ||
P.update_icon() | ||
return | ||
|
||
if(prob(25)) | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Why? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. It was there before. I assume it's so that occasionally bookshelves aren't stocked with the right books, to further enhance the "Nanotrasen doesn't care" look. Take a look at removed line 27. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. ah I missed the previous in the diff |
||
category = null | ||
var/c = category? " AND category='[sanitizeSQL(category)]'" :"" | ||
var/DBQuery/query = dbcon.NewQuery("SELECT * FROM [format_table_name("library")] WHERE isnull(deleted)[c] GROUP BY title ORDER BY rand() LIMIT [book_count];") // isdeleted copyright (c) not me | ||
var/DBQuery/query = dbcon.NewQuery("SELECT * FROM [format_table_name("library")] WHERE isnull(deleted)[c] GROUP BY title ORDER BY rand() LIMIT [amount];") // isdeleted copyright (c) not me | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Why are you touching the library sql? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I renamed a variable. This code was originally in /obj/structure/bookcase/random/initialize(), but is now in a completely separate proc. |
||
if(query.Execute()) | ||
while(query.NextRow()) | ||
var/obj/item/weapon/book/B = new(src) | ||
var/obj/item/weapon/book/B = new(location) | ||
. += B | ||
B.author = query.item[2] | ||
B.title = query.item[3] | ||
B.dat = query.item[4] | ||
B.name = "Book: [B.title]" | ||
B.icon_state= "book[rand(1,8)]" | ||
else | ||
log_game("SQL ERROR populating library bookshelf. Category: \[[category]\], Count: [book_count], Error: \[[query.ErrorMsg()]\]\n") | ||
update_icon() | ||
log_game("SQL ERROR populating library bookshelf. Category: \[[category]\], Count: [amount], Error: \[[query.ErrorMsg()]\]\n") | ||
|
||
|
||
/obj/structure/bookcase/random/fiction | ||
name = "bookcase (Fiction)" | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Did you mean !U.mind.soulowner?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
No, by default, you own your own soul.