Merge pull request #1666 from Citadel-Station-13/upstream-merge-28407
[MIRROR] [READY]Adds examine tooltips
This commit is contained in:
Executable
+1
@@ -0,0 +1 @@
|
||||
GLOBAL_VAR_INIT(enable_examine_tips, TRUE)
|
||||
@@ -105,6 +105,14 @@ GLOBAL_VAR_INIT(rpg_loot_items, FALSE)
|
||||
|
||||
var/datum/rpg_loot/rpg_loot = null
|
||||
|
||||
|
||||
//Tooltip vars
|
||||
var/in_inventory = FALSE//is this item equipped into an inventory slot or hand of a mob?
|
||||
var/force_string //string form of an item's force. Edit this var only to set a custom force string
|
||||
var/last_force_string_check = 0
|
||||
var/tip_timer
|
||||
var/force_string_override
|
||||
|
||||
/obj/item/Initialize()
|
||||
if (!materials)
|
||||
materials = list()
|
||||
@@ -116,6 +124,9 @@ GLOBAL_VAR_INIT(rpg_loot_items, FALSE)
|
||||
if(GLOB.rpg_loot_items)
|
||||
rpg_loot = new(src)
|
||||
|
||||
if(force_string)
|
||||
force_string_override = TRUE
|
||||
|
||||
/obj/item/Destroy()
|
||||
flags &= ~DROPDEL //prevent reqdels
|
||||
if(ismob(loc))
|
||||
@@ -368,9 +379,11 @@ GLOBAL_VAR_INIT(rpg_loot_items, FALSE)
|
||||
A.Remove(user)
|
||||
if(DROPDEL & flags)
|
||||
qdel(src)
|
||||
in_inventory = FALSE
|
||||
|
||||
// called just as an item is picked up (loc is not yet changed)
|
||||
/obj/item/proc/pickup(mob/user)
|
||||
in_inventory = TRUE
|
||||
return
|
||||
|
||||
|
||||
@@ -396,6 +409,7 @@ GLOBAL_VAR_INIT(rpg_loot_items, FALSE)
|
||||
var/datum/action/A = X
|
||||
if(item_action_slot_check(slot, user)) //some items only give their actions buttons when in a specific slot.
|
||||
A.Grant(user)
|
||||
in_inventory = TRUE
|
||||
|
||||
//sometimes we only want to grant the item's action if it's equipped in a specific slot.
|
||||
/obj/item/proc/item_action_slot_check(slot, mob/user)
|
||||
@@ -546,6 +560,7 @@ GLOBAL_VAR_INIT(rpg_loot_items, FALSE)
|
||||
if (callback) //call the original callback
|
||||
. = callback.Invoke()
|
||||
throw_speed = initial(throw_speed) //explosions change this.
|
||||
in_inventory = FALSE
|
||||
|
||||
/obj/item/proc/remove_item_from_storage(atom/newLoc) //please use this if you're going to snowflake an item out of a obj/item/weapon/storage
|
||||
if(!newLoc)
|
||||
@@ -632,3 +647,37 @@ GLOBAL_VAR_INIT(rpg_loot_items, FALSE)
|
||||
M.dirty++
|
||||
|
||||
/obj/item/proc/on_mob_death(mob/living/L, gibbed)
|
||||
|
||||
/obj/item/proc/set_force_string()
|
||||
switch(force)
|
||||
if(0 to 4)
|
||||
force_string = "very low"
|
||||
if(4 to 7)
|
||||
force_string = "low"
|
||||
if(7 to 10)
|
||||
force_string = "medium"
|
||||
if(10 to 11)
|
||||
force_string = "high"
|
||||
if(11 to 20) //12 is the force of a toolbox
|
||||
force_string = "robust"
|
||||
if(20 to 25)
|
||||
force_string = "very robust"
|
||||
else
|
||||
force_string = "exceptionally robust"
|
||||
last_force_string_check = force
|
||||
|
||||
/obj/item/proc/openTip(location, control, params, user)
|
||||
if(last_force_string_check != force && !force_string_override)
|
||||
set_force_string()
|
||||
openToolTip(user,src,params,title = name,content = "[desc]<br>[force ? "<b>Force:</b> [force_string]" : ""]",theme = "")
|
||||
|
||||
/obj/item/MouseEntered(location, control, params)
|
||||
if(in_inventory && usr.client.prefs.enable_tips)
|
||||
var/timedelay = usr.client.prefs.tip_delay/100
|
||||
var/user = usr
|
||||
tip_timer = addtimer(CALLBACK(src, .proc/openTip, location, control, params, user), timedelay, TIMER_STOPPABLE)//timer takes delay in deciseconds, but the pref is in milliseconds. dividing by 100 converts it.
|
||||
|
||||
/obj/item/MouseExited()
|
||||
deltimer(tip_timer)//delete any in-progress timer if the mouse is moved off the item before it finishes
|
||||
closeToolTip(usr)
|
||||
|
||||
|
||||
@@ -19,6 +19,8 @@ GLOBAL_LIST_EMPTY(preferences_datums)
|
||||
//game-preferences
|
||||
var/lastchangelog = "" //Saved changlog filesize to detect if there was a change
|
||||
var/ooccolor = null
|
||||
var/enable_tips = TRUE
|
||||
var/tip_delay = 500 //tip delay in milliseconds
|
||||
|
||||
//Antag preferences
|
||||
var/list/be_special = list() //Special role selection
|
||||
|
||||
@@ -183,6 +183,9 @@ SAVEFILE UPDATING/VERSIONING - 'Simplified', or rather, more coder-friendly ~Car
|
||||
S["inquisitive_ghost"] >> inquisitive_ghost
|
||||
S["uses_glasses_colour"]>> uses_glasses_colour
|
||||
S["clientfps"] >> clientfps
|
||||
S["menuoptions"] >> menuoptions
|
||||
S["enable_tips"] >> enable_tips
|
||||
S["tip_delay"] >> tip_delay
|
||||
S["parallax"] >> parallax
|
||||
S["menuoptions"] >> menuoptions
|
||||
//citadel code
|
||||
@@ -249,6 +252,8 @@ SAVEFILE UPDATING/VERSIONING - 'Simplified', or rather, more coder-friendly ~Car
|
||||
S["clientfps"] << clientfps
|
||||
S["parallax"] << parallax
|
||||
S["menuoptions"] << menuoptions
|
||||
S["enable_tips"] << enable_tips
|
||||
S["tip_delay"] << tip_delay
|
||||
//citadel code
|
||||
S["arousable"] << arousable
|
||||
|
||||
@@ -561,4 +566,4 @@ SAVEFILE UPDATING/VERSIONING - 'Simplified', or rather, more coder-friendly ~Car
|
||||
var/savefile/S = new /savefile(path)
|
||||
S.ImportText("/",file("[path].txt"))
|
||||
|
||||
#endif
|
||||
#endif
|
||||
|
||||
@@ -0,0 +1,20 @@
|
||||
/client/verb/toggle_tips()
|
||||
set name = "Toggle examine tooltips"
|
||||
set desc = "Toggles examine hover-over tooltips"
|
||||
set category = "OOC"
|
||||
|
||||
prefs.enable_tips = !prefs.enable_tips
|
||||
prefs.save_preferences()
|
||||
to_chat(usr, "<span class='danger'>Examine tooltips [prefs.enable_tips ? "en" : "dis"]abled.</span>")
|
||||
|
||||
/client/verb/change_tip_delay()
|
||||
set name = "Set examine tooltip delay"
|
||||
set desc = "Sets the delay in milliseconds before examine tooltips appear"
|
||||
set category = "OOC"
|
||||
|
||||
var/indelay = stripped_input(usr, "Enter the tooltip delay in milliseconds (default: 500)", "Enter tooltip delay", "", 10)
|
||||
indelay = text2num(indelay)
|
||||
if(usr)//is this what you mean?
|
||||
prefs.tip_delay = indelay
|
||||
prefs.save_preferences()
|
||||
to_chat(usr, "<span class='danger'>Tooltip delay set to [indelay] milliseconds.</span>")
|
||||
Reference in New Issue
Block a user