mirror of
https://github.com/Aurorastation/Aurora.3.git
synced 2026-08-25 05:51:56 +01:00
Splits telecrystals into bluecrystals and telecrystals. (#16380)
* bluecrystals 1 * Splits telecrystals into bluecrystals and telecrystals. * fixes * dans ma tete ce n'est pas evident * c'est toujours trop beau pour etre vrai * on ne peut toucher le ciel des doigts * thanks lily --------- Co-authored-by: Matt Atlas <liermattia@gmail.com>
This commit is contained in:
@@ -7,27 +7,41 @@ A list of items and costs is stored under the datum of every game mode, alongsid
|
||||
*/
|
||||
|
||||
/obj/item/device/uplink
|
||||
var/welcome = "Welcome, Operative" // Welcoming menu message
|
||||
var/uses // Numbers of crystals
|
||||
var/list/ItemsCategory // List of categories with lists of items
|
||||
var/list/ItemsReference // List of references with an associated item
|
||||
var/list/nanoui_items // List of items for NanoUI use
|
||||
var/nanoui_menu = 0 // The current menu we are in
|
||||
var/list/nanoui_data = new // Additional data for NanoUI use
|
||||
|
||||
var/list/purchase_log = new // Assoc list of item to times bought; shared/referenced by child uplinks
|
||||
/// Welcoming menu message.
|
||||
var/welcome = "Welcome, Operative"
|
||||
/// Number of telecrystals.
|
||||
var/telecrystals
|
||||
/// Number of bluecrystals.
|
||||
var/bluecrystals
|
||||
/// Counter of used telecrystals.
|
||||
var/used_telecrystals = 0
|
||||
/// Counter of used bluecrystals.
|
||||
var/used_bluecrystals = 0
|
||||
/// List of categories with lists of items.
|
||||
var/list/ItemsCategory
|
||||
/// List of references with an associated item.
|
||||
var/list/ItemsReference
|
||||
/// List of items for NanoUI use.
|
||||
var/list/nanoui_items
|
||||
/// The current menu we are in.
|
||||
var/nanoui_menu = 0
|
||||
/// Additional data for NanoUI use.
|
||||
var/list/nanoui_data = list()
|
||||
// Assoc list of item to times bought; shared/referenced by child uplinks
|
||||
var/list/purchase_log = list()
|
||||
/// Mind of the uplink's owner.
|
||||
var/datum/mind/uplink_owner = null
|
||||
var/used_TC = 0
|
||||
|
||||
/obj/item/device/uplink/ui_host()
|
||||
return loc
|
||||
|
||||
/obj/item/device/uplink/New(var/location, var/datum/mind/owner, var/telecrystals = DEFAULT_TELECRYSTAL_AMOUNT)
|
||||
..()
|
||||
/obj/item/device/uplink/Initialize(var/mapload, var/datum/mind/owner, var/new_telecrystals = DEFAULT_TELECRYSTAL_AMOUNT, var/new_bluecrystals = DEFAULT_BLUECRYSTAL_AMOUNT)
|
||||
. = ..()
|
||||
src.uplink_owner = owner
|
||||
purchase_log = list()
|
||||
world_uplinks += src
|
||||
uses = telecrystals
|
||||
telecrystals = new_telecrystals
|
||||
bluecrystals = new_bluecrystals
|
||||
|
||||
/obj/item/device/uplink/Destroy()
|
||||
world_uplinks -= src
|
||||
@@ -57,7 +71,7 @@ A list of items and costs is stored under the datum of every game mode, alongsid
|
||||
// The hidden uplink MUST be inside an obj/item's contents.
|
||||
/obj/item/device/uplink/hidden/New()
|
||||
spawn(2)
|
||||
if(!istype(src.loc, /obj/item))
|
||||
if(!istype(loc, /obj/item))
|
||||
qdel(src)
|
||||
..()
|
||||
nanoui_data = list()
|
||||
@@ -90,7 +104,8 @@ A list of items and costs is stored under the datum of every game mode, alongsid
|
||||
var/data[0]
|
||||
|
||||
data["welcome"] = welcome
|
||||
data["crystals"] = uses
|
||||
data["telecrystals"] = telecrystals
|
||||
data["bluecrystals"] = bluecrystals
|
||||
data["menu"] = nanoui_menu
|
||||
data += nanoui_data
|
||||
|
||||
@@ -158,12 +173,15 @@ A list of items and costs is stored under the datum of every game mode, alongsid
|
||||
var/items[0]
|
||||
for(var/datum/uplink_item/item in category.items)
|
||||
if(item.can_view(src))
|
||||
var/cost = item.cost(uses)
|
||||
var/tc_cost = item.telecrystal_cost(telecrystals)
|
||||
var/bc_cost = item.bluecrystal_cost(bluecrystals)
|
||||
var/can_buy = item.can_buy_telecrystals(src) || item.can_buy_bluecrystals(src)
|
||||
items[++items.len] = list(
|
||||
"name" = item.name,
|
||||
"description" = replacetext(item.description(), "\n", "<br>"),
|
||||
"can_buy" = item.can_buy(src),
|
||||
"cost" = cost,
|
||||
"can_buy" = can_buy,
|
||||
"tc_cost" = tc_cost,
|
||||
"bc_cost" = bc_cost,
|
||||
"left" = item.items_left(src),
|
||||
"ref" = "\ref[item]"
|
||||
)
|
||||
@@ -341,7 +359,8 @@ A list of items and costs is stored under the datum of every game mode, alongsid
|
||||
/obj/item/device/radio/headset/uplink/New(var/loc, var/mind)
|
||||
..()
|
||||
hidden_uplink = new(src, mind)
|
||||
hidden_uplink.uses = DEFAULT_TELECRYSTAL_AMOUNT
|
||||
hidden_uplink.telecrystals = DEFAULT_TELECRYSTAL_AMOUNT
|
||||
hidden_uplink.bluecrystals = DEFAULT_BLUECRYSTAL_AMOUNT
|
||||
|
||||
/*
|
||||
* A simple device for accessing the SQL based contract database
|
||||
@@ -355,10 +374,11 @@ A list of items and costs is stored under the datum of every game mode, alongsid
|
||||
flags = CONDUCT
|
||||
w_class = ITEMSIZE_SMALL
|
||||
|
||||
/obj/item/device/contract_uplink/New(var/loc, var/mind)
|
||||
..()
|
||||
/obj/item/device/contract_uplink/Initialize(var/mapload, var/mind)
|
||||
. = ..()
|
||||
hidden_uplink = new(src, mind)
|
||||
hidden_uplink.uses = 0
|
||||
hidden_uplink.telecrystals = 0
|
||||
hidden_uplink.bluecrystals = 0
|
||||
hidden_uplink.nanoui_menu = 3
|
||||
|
||||
/obj/item/device/contract_uplink/attack_self(mob/user as mob)
|
||||
@@ -398,15 +418,22 @@ A list of items and costs is stored under the datum of every game mode, alongsid
|
||||
icon_state = "radio"
|
||||
flags = CONDUCT
|
||||
w_class = ITEMSIZE_SMALL
|
||||
var/starting_telecrystals // how much telecrystals the uplink should spawn with, defaults to default amount if not set
|
||||
// Amount of starting telecrystals. Defaults to default amount if not set.
|
||||
var/starting_telecrystals
|
||||
/// Amount of starting bluecrystals, used to buy support/medical/gimmick items. Defaults to default amount if not set.
|
||||
var/starting_bluecrystals
|
||||
|
||||
/obj/item/device/special_uplink/New(var/loc, var/mind)
|
||||
..()
|
||||
hidden_uplink = new(src, mind)
|
||||
if(!starting_telecrystals)
|
||||
hidden_uplink.uses = DEFAULT_TELECRYSTAL_AMOUNT
|
||||
hidden_uplink.telecrystals = DEFAULT_TELECRYSTAL_AMOUNT
|
||||
else
|
||||
hidden_uplink.uses = starting_telecrystals
|
||||
hidden_uplink.telecrystals = starting_telecrystals
|
||||
if(!starting_bluecrystals)
|
||||
hidden_uplink.bluecrystals = DEFAULT_BLUECRYSTAL_AMOUNT
|
||||
else
|
||||
hidden_uplink.bluecrystals = DEFAULT_BLUECRYSTAL_AMOUNT
|
||||
hidden_uplink.nanoui_menu = 1
|
||||
|
||||
/obj/item/device/special_uplink/attack_self(mob/user as mob)
|
||||
|
||||
@@ -27,11 +27,11 @@ var/datum/uplink_random_selection/default_uplink_selection = new/datum/uplink_ra
|
||||
if(!prob(RI.keep_probability))
|
||||
continue
|
||||
var/datum/uplink_item/I = uplink.items_assoc[RI.uplink_item]
|
||||
if(I.cost(telecrystals) > telecrystals)
|
||||
if(I.telecrystal_cost(telecrystals) > telecrystals)
|
||||
continue
|
||||
if(bought_items && (I in bought_items) && !prob(RI.reselect_probability))
|
||||
continue
|
||||
if(U && !I.can_buy(U))
|
||||
if(U && !I.can_buy_telecrystals(U))
|
||||
continue
|
||||
return I
|
||||
|
||||
|
||||
@@ -1,13 +1,18 @@
|
||||
#define CRYSTAL_TYPE_TELECRYSTAL "telecrystal"
|
||||
#define CRYSTAL_TYPE_BLUECRYSTAL "bluecrystal"
|
||||
|
||||
/obj/item/stack/telecrystal
|
||||
name = "telecrystal"
|
||||
desc = "It seems to be pulsing with suspiciously enticing energies."
|
||||
desc_antag = "Telecrystals can be activated by utilizing them on devices with an actively running uplink. They will not activate on unactivated uplinks."
|
||||
desc_antag = "Crystals can be activated by utilizing them on devices with an actively running uplink. They will not activate on unactivated uplinks."
|
||||
singular_name = "telecrystal"
|
||||
icon_state = "telecrystal"
|
||||
w_class = ITEMSIZE_TINY
|
||||
max_amount = 50
|
||||
flags = NOBLUDGEON
|
||||
origin_tech = list(TECH_MATERIAL = 6, TECH_BLUESPACE = 4)
|
||||
icon_has_variants = TRUE
|
||||
var/crystal_type = CRYSTAL_TYPE_TELECRYSTAL
|
||||
|
||||
/obj/item/stack/telecrystal/five/Initialize()
|
||||
. = ..()
|
||||
@@ -24,13 +29,40 @@
|
||||
amount = 50
|
||||
update_icon()
|
||||
|
||||
/obj/item/stack/telecrystal/afterattack(var/obj/item/I as obj, mob/user as mob, proximity)
|
||||
/obj/item/stack/telecrystal/afterattack(var/obj/item/I, mob/user, proximity)
|
||||
if(!proximity)
|
||||
return
|
||||
if(istype(I, /obj/item))
|
||||
if(I.hidden_uplink && I.hidden_uplink.active) //No metagaming by using this on every PDA around just to see if it gets used up.
|
||||
I.hidden_uplink.uses += amount
|
||||
if(crystal_type == CRYSTAL_TYPE_TELECRYSTAL)
|
||||
I.hidden_uplink.telecrystals += amount
|
||||
else if(crystal_type == CRYSTAL_TYPE_BLUECRYSTAL)
|
||||
I.hidden_uplink.bluecrystals += amount
|
||||
I.hidden_uplink.update_nano_data()
|
||||
SSnanoui.update_uis(I.hidden_uplink)
|
||||
use(amount)
|
||||
to_chat(user, SPAN_NOTICE("You slot \the [src] into \the [I] and charge its internal uplink."))
|
||||
|
||||
/obj/item/stack/telecrystal/blue
|
||||
name = "bluecrystal"
|
||||
singular_name = "bluecrystal"
|
||||
icon_state = "bluecrystal"
|
||||
crystal_type = CRYSTAL_TYPE_BLUECRYSTAL
|
||||
|
||||
/obj/item/stack/telecrystal/blue/five/Initialize()
|
||||
. = ..()
|
||||
amount = 5
|
||||
update_icon()
|
||||
|
||||
/obj/item/stack/telecrystal/blue/twentyfive/Initialize()
|
||||
. = ..()
|
||||
amount = 25
|
||||
update_icon()
|
||||
|
||||
/obj/item/stack/telecrystal/blue/fifty/Initialize()
|
||||
. = ..()
|
||||
amount = 50
|
||||
update_icon()
|
||||
|
||||
#undef CRYSTAL_TYPE_TELECRYSTAL
|
||||
#undef CRYSTAL_TYPE_BLUECRYSTAL
|
||||
|
||||
@@ -6,7 +6,8 @@
|
||||
/obj/item/implant/uplink/New()
|
||||
activation_emote = pick("blink", "blink_r", "eyebrow", "chuckle", "twitch", "frown", "nod", "blush", "giggle", "grin", "groan", "shrug", "smile", "pale", "sniff", "whimper", "wink")
|
||||
hidden_uplink = new(src)
|
||||
hidden_uplink.uses = round((DEFAULT_TELECRYSTAL_AMOUNT / 2) * 0.8)
|
||||
hidden_uplink.telecrystals = round((DEFAULT_TELECRYSTAL_AMOUNT / 2) * 0.8)
|
||||
hidden_uplink.bluecrystals = round((DEFAULT_BLUECRYSTAL_AMOUNT / 2) * 0.8)
|
||||
..()
|
||||
return
|
||||
|
||||
|
||||
@@ -54,7 +54,8 @@
|
||||
new /obj/item/pinpointer/nukeop(src)
|
||||
new /obj/item/modular_computer/handheld/pda/syndicate(src)
|
||||
var/obj/item/device/radio/uplink/U = new(src)
|
||||
U.hidden_uplink.uses = 40
|
||||
U.hidden_uplink.telecrystals = 40
|
||||
U.hidden_uplink.bluecrystals = 20
|
||||
return
|
||||
|
||||
/obj/structure/closet/syndicate/resources
|
||||
|
||||
Reference in New Issue
Block a user