Slight rework of how tajaran watches work and new papercode for taj time (#21582)

This does a few times, after the scope got bigger than I originally
planned:
- Watches now have an action button top left to check time.
- Taj time checking code was moved over to the time helper file to not
be watch exclusive.
- The taj wrist watches now shows the time on adhomai.
- Papercode now has the ability to show taj time and date, and to insert
the credit symbol.
This commit is contained in:
Casper3667
2025-11-30 11:17:14 +00:00
committed by GitHub
parent 2b40f5f8d8
commit 3541ce57fd
11 changed files with 116 additions and 30 deletions
+3
View File
@@ -667,6 +667,9 @@
t = replacetext(t, "\[barcode\]", "<img src = barcode[rand(0, 3)].png>")
t = replacetext(t, "\[time\]", "[worldtime2text()]")
t = replacetext(t, "\[date\]", "[worlddate2text()]")
t = replacetext(t, "\[tajtime\]", "[tajaran_time()]")
t = replacetext(t, "\[tajdate\]", "[tajaran_full_date()]")
t = replacetext(t, "\[cr\]", "电")
t = replacetext(t, "\[editorbr\]", "<BR>")
t = replacetext(t, @"[image id=([\w]*?\.[\w]*?)]", "<img style=\"display:block;width:90%;\" src = [GLOB.config.docs_image_host]$1></img>")
return t
+66 -2
View File
@@ -5,13 +5,19 @@ var/round_start_time
//Returns the world time in english
/proc/worldtime2text(time = world.time, timeshift = 1)
if(!roundstart_hour) roundstart_hour = REALTIMEOFDAY - (TIME_OFFSET HOURS)
if(!roundstart_hour)
roundstart_hour = REALTIMEOFDAY - (TIME_OFFSET HOURS)
return timeshift ? time2text(time+roundstart_hour, "hh:mm") : time2text(time, "hh:mm")
/proc/worldtime2hours()
if (!roundstart_hour)
worldtime2text()
. = text2num(time2text(world.time + (roundstart_hour HOURS), "hh"))
. = text2num(time2text(world.time+roundstart_hour, "hh"))
/proc/worldtime2minutes()
if (!roundstart_hour)
worldtime2text()
. = text2num(time2text(world.time+roundstart_hour, "mm"))
/proc/worlddate2text()
return num2text(GLOB.game_year) + "-" + time2text(world.timeofday, "MM-DD")
@@ -19,6 +25,7 @@ var/round_start_time
/proc/time_stamp()
return time2text(world.timeofday, "hh:mm:ss")
/**
* Check if specific day of the year
*
@@ -121,3 +128,60 @@ var/real_round_start_time
if(hour)
hourT = " and [hour] hour[(hour != 1)? "s":""]"
return "[day] day[(day != 1)? "s":""][hourT][minuteT][secondT]"
/**
* The current time on Adhomai
*/
/proc/tajaran_time()
var/adhomian_time = worldtime2hours()
var/adhomian_minute = worldtime2minutes()
var/adhomian_day = tajaran_date()
if(ISEVEN(adhomian_day))
adhomian_time += 24
if(adhomian_minute < 10) // make it display 5:08 instead of 5:8 when the time is in single digits
adhomian_minute = "0[adhomian_minute]"
return "[adhomian_time]:[adhomian_minute]"
/**
* The current month/season on Adhomai
*/
/proc/tajaran_month()
var/static/months = list("Menshe-aysaif", "Sil'nryy-aysaif", "Menshe-rhazzimy", "Sil'nryy-rhazzimy")
var/adhomian_month = text2num(time2text(world.time, "MM"))
adhomian_month = months[Ceiling(adhomian_month/3)]
return adhomian_month
/**
* The current date on Adhomai
*/
/proc/tajaran_date()
var/adhomian_day = text2num(time2text(world.time, "DD"))
var/current_month = text2num(time2text(world.time, "MM"))
switch(current_month)
if(2, 5, 8, 11)
adhomian_day += 31
if(6, 9, 12)
adhomian_day += 61
if(3)
adhomian_day += 59 + isLeap(text2num(time2text(world.realtime, "YYYY"))) // we can conveniently use the result of `isLeap` to add 1 when we are in a leap year
adhomian_day = FLOOR(adhomian_day / 2, 1)
return adhomian_day
/**
* The current year on Adhomai
*/
/proc/tajaran_year()
return GLOB.game_year + 1158
/**
* The full year, month and date on Adhomai
*/
/proc/tajaran_full_date()
var/adhomian_month = text2num(time2text(world.time, "MM"))
adhomian_month = Ceiling(adhomian_month/3)
return "[tajaran_year()]-[adhomian_month]-[tajaran_date()]"
+9
View File
@@ -294,6 +294,15 @@
to_chat(usr, SPAN_NOTICE("You press the button on the exterior of \the [target_clothing]."))
target_clothing.action_circuit.activate_pin(1)
/datum/action/item_action/watch
check_flags = AB_CHECK_RESTRAINED|AB_CHECK_STUNNED|AB_CHECK_ALIVE|AB_CHECK_INSIDE
/datum/action/item_action/watch/Trigger()
if(!Checks())
return
var/obj/item/clothing/wrists/watch/target_clothing = target
target_clothing.checktime(usr)
/datum/action/eye
action_type = AB_GENERIC
check_flags = AB_CHECK_LYING|AB_CHECK_STUNNED
+2 -22
View File
@@ -137,8 +137,7 @@
icon_state = "adhomai_clock"
item_state = "adhomai_clock"
contained_sprite = TRUE
slot_flags = SLOT_MASK
var/static/months = list("Menshe-aysaif", "Sil'nryy-aysaif", "Menshe-rhazzimy", "Sil'nryy-rhazzimy")
slot_flags = SLOT_MASK | SLOT_WRISTS | SLOT_BELT | SLOT_S_STORE
/obj/item/clothing/wrists/watch/pocketwatch/adhomai/get_mask_examine_text(mob/user)
return "around [user.get_pronoun("his")] neck"
@@ -151,26 +150,7 @@
if(closed)
to_chat(usr, SPAN_WARNING("You check your watch, realising it's closed."))
else
var/adhomian_year = GLOB.game_year + 1158
var/current_month = text2num(time2text(world.realtime, "MM"))
var/current_day = text2num(time2text(world.realtime, "DD"))
var/adhomian_day
var/adhomian_month = src.months[Ceiling(current_month/3)]
switch(current_month)
if(2, 5, 8, 11)
current_day += 31
if(6, 9, 12)
current_day += 61
if(3)
current_day += 59 + isLeap(text2num(time2text(world.realtime, "YYYY"))) // we can conveniently use the result of `isLeap` to add 1 when we are in a leap year
var/real_time = text2num(time2text(world.time + (REALTIMEOFDAY - (TIME_OFFSET HOURS)), "hh"))
var/adhomian_time = real_time
if(ISEVEN(current_day))
adhomian_time = real_time + 24
adhomian_day = FLOOR(current_day / 2, 1)
to_chat(usr, "You check your [src.name], glancing over at the watch face, reading the time to be '[adhomian_time]'. Today's date is the '[adhomian_day]th day of [adhomian_month], [adhomian_year]'.")
to_chat(usr, SPAN_NOTICE("You check your [name], glancing over at the watch face, reading the time to be '[tajaran_time()]'. Today's date is the '[tajaran_date()]th day of [tajaran_month()], [tajaran_year()]'."))
/obj/item/flame/lighter/adhomai
name = "adhomian lighter"
@@ -43,3 +43,5 @@
old_origin.on_remove(src)
OI.on_apply(src)
/singleton/origin_item/culture/proc/get_custom_time()
return FALSE
@@ -48,6 +48,9 @@
/singleton/origin_item/origin/crevus
)
/singleton/origin_item/culture/adhomian/get_custom_time()
return "Adhomian Time: [tajaran_time()], [tajaran_full_date()]"
/singleton/origin_item/origin/hadiist_heartlands
name = "Hadiist Heartlands"
desc = "The Hadiist Heartlands include Nraz'i Basin, Ras'nrr Heartlands, East Ras'nrr, and Rhazar Mountains. In this region, the People's Republic's culture project was most successful. Its inhabitants are known for their political loyalty and adherence to the Party's teachings. In typical Republican fashion, the local culture places a large emphasis on the importance of the collective over the individual interest, with each Tajara being considered as a piece in the machinery of society."
+8 -6
View File
@@ -6,6 +6,8 @@
item_state = "watch"
var/wired = TRUE
var/screwed = TRUE
action_button_name = "Check time"
default_action_type = /datum/action/item_action/watch
/obj/item/clothing/wrists/watch/silver
desc = "It's a GaussIo ZeitMeister, a finely tuned wristwatch encased in silver."
@@ -38,7 +40,7 @@
item_state = "watch_silver"
/obj/item/clothing/wrists/watch/spy/checktime()
to_chat(usr, "You check your watch. Unfortunately for you, it's not a real watch, dork.")
to_chat(usr, SPAN_NOTICE("You check your watch. Unfortunately for you, it's not a real watch, dork."))
/obj/item/clothing/wrists/watch/pocketwatch
name = "pocketwatch"
@@ -77,9 +79,9 @@
/obj/item/clothing/wrists/watch/pocketwatch/checktime(mob/user)
if(closed)
to_chat(usr, "You check your watch, realising it's closed.")
to_chat(usr, SPAN_NOTICE("You check your watch, realising it's closed."))
else
to_chat(usr, "You check your watch, glancing over at the watch face, reading the time to be '[worldtime2text()]'. Today's date is '[time2text(world.time, "Month DD")]. [GLOB.game_year]'.")
to_chat(usr, SPAN_NOTICE("You check your watch, glancing over at the watch face, reading the time to be '[worldtime2text()]'. Today's date is '[time2text(world.time, "Month DD")]. [GLOB.game_year]'."))
/obj/item/clothing/wrists/watch/pocketwatch/pointatwatch()
if(closed)
@@ -93,13 +95,13 @@
set src in usr
if(wired && screwed)
to_chat(usr, "You check your watch, spotting a digital collection of numbers reading '[worldtime2text()]'. Today's date is '[time2text(world.time, "Month DD")]. [GLOB.game_year]'.")
to_chat(usr, SPAN_NOTICE("You check your watch, spotting a digital collection of numbers reading '[worldtime2text()]'. Today's date is '[time2text(world.time, "Month DD")]. [GLOB.game_year]'."))
if (GLOB.evacuation_controller.get_status_panel_eta())
to_chat(usr, SPAN_WARNING("Time until Bluespace Jump: [GLOB.evacuation_controller.get_status_panel_eta()]."))
else if(wired && !screwed)
to_chat(usr, "You check your watch, realising it's still open.")
to_chat(usr, SPAN_NOTICE("You check your watch, realising it's still open."))
else
to_chat(usr, "You check your watch as it dawns on you that it's broken.")
to_chat(usr, SPAN_NOTICE("You check your watch as it dawns on you that it's broken."))
/obj/item/clothing/wrists/watch/verb/pointatwatch()
set category = "Object.Equipped"
@@ -6,6 +6,13 @@
item_state = "watch_taj-male"
contained_sprite = TRUE
/obj/item/clothing/wrists/watch/tajara/checktime(mob/user)
set category = "Object.Equipped"
set name = "Check Time"
set src in usr
to_chat(usr, SPAN_NOTICE("You check your [name], glancing over at the watch face, reading the time to be '[tajaran_time()]'. Today's date is the '[tajaran_date()]th day of [tajaran_month()], [tajaran_year()]'."))
/obj/item/clothing/wrists/watch/tajara/female
name = "adhomian watch"
desc = "An adhomian wrist watch made for female Tajara. Due to its use in the past wars, wrist watches are becoming more popular in Adhomai."
@@ -228,6 +228,9 @@
. += "Energy: [round(DS.stored_energy)] / [round(DS.max_energy)]"
if(DS.regen_limb)
. += "Regeneration Progress: [round(DS.regen_limb_progress)] / [LIMB_REGROW_REQUIREMENT]"
var/custom_time = culture.get_custom_time()
if(custom_time)
. += custom_time
if(internal)
if(!internal.air_contents)
qdel(internal)
+3
View File
@@ -32,6 +32,9 @@
\[field\] : Inserts an invisible field which lets you start type from there. Useful for forms.
\[date\] : Inserts today's date.
\[time\] : Inserts the current station time.
\[cr\] : Inserts the credit symbol.
\[tajdate\] : Inserts the current date on Adhomai.
\[tajtime\] : Inserts the current time on Adhomai.
<br>
Pen Exclusive Commands
\[small\] - \[/small\] : Decreases the size of the text.
+10
View File
@@ -0,0 +1,10 @@
author: TheGreyWolf
delete-after: True
changes:
- rscadd: "Watches now have an icon top left to check time, similarly to an integrated time piece."
- rscadd: "The tajaran wrist watches now shows the time on adhomai, similar to the tajaran pocketwatch."
- rscadd: "There are three new papercode commands: tajtime, tajdate and cr. The last of which creates the credit symbol."
- rscadd: "The time and date on adhomai is now visible on the stat panel for tajara originating from Adhomai."
- code_imp: "The tajaran time and date calculations have been moved to procs in _HELPERS/time.dm to be used more universally."