Refactors Spell and Martial Art Books to use Action Granters!

This commit is contained in:
Armhulen
2018-03-27 10:51:14 -07:00
committed by CitadelStationBot
parent 77f40b6be9
commit 2d8b007086
25 changed files with 1177 additions and 167 deletions
-57
View File
@@ -957,60 +957,3 @@
author = "Engineering Encyclopedia"
title = "Hacking"
page_link = "Hacking"
///Reusable books that grant actions (knowledge is power)
/obj/item/book/action_granting
due_date = 0 // Game time in 1/10th seconds
unique = 1 // 0 - Normal book, 1 - Should not be treated as normal book, unable to be copied, unable to be modified
var/datum/action/granted_action = null
var/list/remarks = list() //things to read about while learning.
var/pages_to_mastery = 3 //Essentially controls how long a mob must keep the book in his hand to actually successfully learn
/obj/item/book/action_granting/attack_self(mob/user)
if(!granted_action)
return
var/datum/action/G = new granted_action
for(var/datum/action/A in user.actions)
if(A.type == G.type)
to_chat(user, "<span class='notice'>You already know all about [G.name].</span>")
qdel(G)
return
to_chat(user, "<span class='notice'>You start reading about [G.name]...</span>")
for(var/i=1, i<=pages_to_mastery, i++)
if(!turn_page(user))
to_chat(user, "<span class='notice'>You stop reading...</span>")
qdel(G)
return
if(do_after(user,50, user))
to_chat(user, "<span class='notice'>You feel like you've got a good handle on [G.name]!</span>")
G.Grant(user)
/obj/item/book/action_granting/proc/turn_page(mob/user)
playsound(user, pick('sound/effects/pageturn1.ogg','sound/effects/pageturn2.ogg','sound/effects/pageturn3.ogg'), 30, 1)
if(do_after(user,50, user))
to_chat(user, "<span class='notice'>[pick(remarks)]</span>")
return 1
return 0
/obj/item/book/action_granting/drink_fling
name = "Tapper: This One's For You"
desc = "A seminal work on the dying art of booze sliding."
icon_state = "barbook"
granted_action = /datum/action/innate/drink_fling
remarks = list("The trick is keeping a low center of gravity it seems...", "The viscosity of the liquid is important...", "Accounting for crosswinds... really?", "Drag coefficients of various popular drinking glasses...", "What the heck is laminar flow and why does it matter here?", "Greasing the bar seems like it'd be cheating...", "I don't think I'll be working with superfluids...")
/datum/action/innate/drink_fling
name = "Drink Flinging"
desc = "Toggles your ability to satifyingly throw glasses without spilling them."
button_icon_state = "drinkfling_off"
check_flags = 0
/datum/action/innate/drink_fling/Activate()
button_icon_state = "drinkfling_on"
active = TRUE
UpdateButtonIcon()
/datum/action/innate/drink_fling/Deactivate()
button_icon_state = "drinkfling_off"
active = FALSE
UpdateButtonIcon()