mirror of
https://github.com/yogstation13/Yogstation.git
synced 2025-02-26 09:04:50 +00:00
* Steals tg's span macros * Fix alphabet * Updated some more spans * Misses a conflict * Fix compile errors * Converts more spans * oops
482 lines
15 KiB
Plaintext
482 lines
15 KiB
Plaintext
|
|
#define GIBTONITE_QUALITY_HIGH 3
|
|
#define GIBTONITE_QUALITY_MEDIUM 2
|
|
#define GIBTONITE_QUALITY_LOW 1
|
|
|
|
#define ORESTACK_OVERLAYS_MAX 10
|
|
|
|
/**********************Mineral ores**************************/
|
|
|
|
/obj/item/stack/ore
|
|
name = "rock"
|
|
icon = 'icons/obj/mining.dmi'
|
|
icon_state = "ore"
|
|
item_state = "ore"
|
|
full_w_class = WEIGHT_CLASS_BULKY
|
|
singular_name = "ore chunk"
|
|
var/points = 0 //How many points this ore gets you from the ore redemption machine
|
|
var/refined_type = null //What this ore defaults to being refined into
|
|
novariants = TRUE // Ore stacks handle their icon updates themselves to keep the illusion that there's more going
|
|
var/list/stack_overlays
|
|
|
|
/obj/item/stack/ore/update_icon()
|
|
var/difference = min(ORESTACK_OVERLAYS_MAX, amount) - (LAZYLEN(stack_overlays)+1)
|
|
if(difference == 0)
|
|
return
|
|
else if(difference < 0 && LAZYLEN(stack_overlays)) //amount < stack_overlays, remove excess.
|
|
cut_overlays()
|
|
if (LAZYLEN(stack_overlays)-difference <= 0)
|
|
stack_overlays = null;
|
|
else
|
|
stack_overlays.len += difference
|
|
else if(difference > 0) //amount > stack_overlays, add some.
|
|
cut_overlays()
|
|
for(var/i in 1 to difference)
|
|
var/mutable_appearance/newore = mutable_appearance(icon, icon_state)
|
|
newore.pixel_x = rand(-8,8)
|
|
newore.pixel_y = rand(-8,8)
|
|
LAZYADD(stack_overlays, newore)
|
|
if (stack_overlays)
|
|
add_overlay(stack_overlays)
|
|
|
|
/obj/item/stack/ore/welder_act(mob/living/user, obj/item/I)
|
|
if(!refined_type)
|
|
return TRUE
|
|
|
|
if(I.use_tool(src, user, 0, volume=50, amount=15))
|
|
new refined_type(drop_location())
|
|
use(1)
|
|
|
|
return TRUE
|
|
|
|
/obj/item/stack/ore/fire_act(exposed_temperature, exposed_volume)
|
|
. = ..()
|
|
if(isnull(refined_type))
|
|
return
|
|
else
|
|
var/probability = (rand(0,100))/100
|
|
var/burn_value = probability*amount
|
|
var/amountrefined = round(burn_value, 1)
|
|
if(amountrefined < 1)
|
|
qdel(src)
|
|
else
|
|
new refined_type(drop_location(),amountrefined)
|
|
qdel(src)
|
|
|
|
/obj/item/stack/ore/uranium
|
|
name = "uranium ore"
|
|
icon_state = "Uranium ore"
|
|
item_state = "Uranium ore"
|
|
singular_name = "uranium ore chunk"
|
|
points = 30
|
|
materials = list(/datum/material/uranium=MINERAL_MATERIAL_AMOUNT)
|
|
refined_type = /obj/item/stack/sheet/mineral/uranium
|
|
|
|
/obj/item/stack/ore/iron
|
|
name = "iron ore"
|
|
icon_state = "Iron ore"
|
|
item_state = "Iron ore"
|
|
singular_name = "iron ore chunk"
|
|
points = 1
|
|
materials = list(/datum/material/iron=MINERAL_MATERIAL_AMOUNT)
|
|
refined_type = /obj/item/stack/sheet/metal
|
|
|
|
/obj/item/stack/ore/glass
|
|
name = "sand pile"
|
|
icon_state = "Glass ore"
|
|
item_state = "Glass ore"
|
|
singular_name = "sand pile"
|
|
points = 1
|
|
materials = list(/datum/material/glass=MINERAL_MATERIAL_AMOUNT)
|
|
refined_type = /obj/item/stack/sheet/glass
|
|
w_class = WEIGHT_CLASS_TINY
|
|
|
|
GLOBAL_LIST_INIT(sand_recipes, list(\
|
|
new /datum/stack_recipe("sandstone", /obj/item/stack/sheet/mineral/sandstone, 1, 1, 50)\
|
|
))
|
|
|
|
/obj/item/stack/ore/glass/Initialize(mapload, new_amount, merge = TRUE)
|
|
recipes = GLOB.sand_recipes
|
|
. = ..()
|
|
|
|
/obj/item/stack/ore/glass/throw_impact(atom/hit_atom, datum/thrownthing/throwingdatum)
|
|
if(..() || !ishuman(hit_atom))
|
|
return
|
|
var/mob/living/carbon/human/C = hit_atom
|
|
if(C.is_eyes_covered())
|
|
C.visible_message(span_danger("[C]'s eye protection blocks the sand!"), span_warning("Your eye protection blocks the sand!"))
|
|
return
|
|
C.adjust_blurriness(6)
|
|
C.adjustStaminaLoss(15)//the pain from your eyes burning does stamina damage
|
|
C.confused += 5
|
|
to_chat(C, span_userdanger("\The [src] gets into your eyes! The pain, it burns!"))
|
|
qdel(src)
|
|
|
|
/obj/item/stack/ore/glass/ex_act(severity, target)
|
|
if (severity == EXPLODE_NONE)
|
|
return
|
|
qdel(src)
|
|
|
|
/obj/item/stack/ore/glass/basalt
|
|
name = "volcanic ash"
|
|
icon_state = "volcanic_sand"
|
|
icon_state = "volcanic_sand"
|
|
singular_name = "volcanic ash pile"
|
|
|
|
/obj/item/stack/ore/plasma
|
|
name = "plasma ore"
|
|
icon_state = "Plasma ore"
|
|
item_state = "Plasma ore"
|
|
singular_name = "plasma ore chunk"
|
|
points = 15
|
|
materials = list(/datum/material/plasma=MINERAL_MATERIAL_AMOUNT)
|
|
refined_type = /obj/item/stack/sheet/mineral/plasma
|
|
|
|
/obj/item/stack/ore/plasma/welder_act(mob/living/user, obj/item/I)
|
|
to_chat(user, span_warning("You can't hit a high enough temperature to smelt [src] properly!"))
|
|
return TRUE
|
|
|
|
|
|
/obj/item/stack/ore/silver
|
|
name = "silver ore"
|
|
icon_state = "Silver ore"
|
|
item_state = "Silver ore"
|
|
singular_name = "silver ore chunk"
|
|
points = 16
|
|
materials = list(/datum/material/silver=MINERAL_MATERIAL_AMOUNT)
|
|
refined_type = /obj/item/stack/sheet/mineral/silver
|
|
|
|
/obj/item/stack/ore/gold
|
|
name = "gold ore"
|
|
icon_state = "Gold ore"
|
|
icon_state = "Gold ore"
|
|
singular_name = "gold ore chunk"
|
|
points = 18
|
|
materials = list(/datum/material/gold=MINERAL_MATERIAL_AMOUNT)
|
|
refined_type = /obj/item/stack/sheet/mineral/gold
|
|
|
|
/obj/item/stack/ore/diamond
|
|
name = "diamond ore"
|
|
icon_state = "Diamond ore"
|
|
item_state = "Diamond ore"
|
|
singular_name = "diamond ore chunk"
|
|
points = 50
|
|
materials = list(/datum/material/diamond=MINERAL_MATERIAL_AMOUNT)
|
|
refined_type = /obj/item/stack/sheet/mineral/diamond
|
|
|
|
/obj/item/stack/ore/bananium
|
|
name = "bananium ore"
|
|
icon_state = "Bananium ore"
|
|
item_state = "Bananium ore"
|
|
singular_name = "bananium ore chunk"
|
|
points = 60
|
|
materials = list(/datum/material/bananium=MINERAL_MATERIAL_AMOUNT)
|
|
refined_type = /obj/item/stack/sheet/mineral/bananium
|
|
|
|
/obj/item/stack/ore/titanium
|
|
name = "titanium ore"
|
|
icon_state = "Titanium ore"
|
|
item_state = "Titanium ore"
|
|
singular_name = "titanium ore chunk"
|
|
points = 50
|
|
materials = list(/datum/material/titanium=MINERAL_MATERIAL_AMOUNT)
|
|
refined_type = /obj/item/stack/sheet/mineral/titanium
|
|
|
|
/obj/item/stack/ore/slag
|
|
name = "slag"
|
|
desc = "Completely useless."
|
|
icon_state = "slag"
|
|
item_state = "slag"
|
|
singular_name = "slag chunk"
|
|
|
|
/obj/item/twohanded/required/gibtonite
|
|
name = "gibtonite ore"
|
|
desc = "Extremely explosive if struck with mining equipment, Gibtonite is often used by miners to speed up their work by using it as a mining charge. This material is illegal to possess by unauthorized personnel under space law."
|
|
icon = 'icons/obj/mining.dmi'
|
|
icon_state = "Gibtonite ore"
|
|
item_state = "Gibtonite ore"
|
|
w_class = WEIGHT_CLASS_BULKY
|
|
throw_range = 0
|
|
var/primed = FALSE
|
|
var/det_time = 100
|
|
var/quality = GIBTONITE_QUALITY_LOW //How pure this gibtonite is, determines the explosion produced by it and is derived from the det_time of the rock wall it was taken from, higher value = better
|
|
var/attacher = "UNKNOWN"
|
|
var/det_timer
|
|
|
|
/obj/item/twohanded/required/gibtonite/Destroy()
|
|
qdel(wires)
|
|
wires = null
|
|
return ..()
|
|
|
|
/obj/item/twohanded/required/gibtonite/attackby(obj/item/I, mob/user, params)
|
|
if(!wires && istype(I, /obj/item/assembly/igniter))
|
|
user.visible_message("[user] attaches [I] to [src].", span_notice("You attach [I] to [src]."))
|
|
wires = new /datum/wires/explosive/gibtonite(src)
|
|
attacher = key_name(user)
|
|
qdel(I)
|
|
add_overlay("Gibtonite_igniter")
|
|
return
|
|
|
|
if(wires && !primed)
|
|
if(is_wire_tool(I))
|
|
wires.interact(user)
|
|
return
|
|
|
|
if(I.tool_behaviour == TOOL_MINING || istype(I, /obj/item/resonator) || I.force >= 10)
|
|
GibtoniteReaction(user)
|
|
return
|
|
if(primed)
|
|
if(istype(I, /obj/item/mining_scanner) || istype(I, /obj/item/t_scanner/adv_mining_scanner) || I.tool_behaviour == TOOL_MULTITOOL)
|
|
primed = FALSE
|
|
if(det_timer)
|
|
deltimer(det_timer)
|
|
user.visible_message("The chain reaction was stopped! ...The ore's quality looks diminished.", span_notice("You stopped the chain reaction. ...The ore's quality looks diminished."))
|
|
icon_state = "Gibtonite ore"
|
|
quality = GIBTONITE_QUALITY_LOW
|
|
return
|
|
..()
|
|
|
|
/obj/item/twohanded/required/gibtonite/attack_self(user)
|
|
if(wires)
|
|
wires.interact(user)
|
|
else
|
|
..()
|
|
|
|
/obj/item/twohanded/required/gibtonite/bullet_act(obj/item/projectile/P)
|
|
GibtoniteReaction(P.firer)
|
|
. = ..()
|
|
|
|
/obj/item/twohanded/required/gibtonite/ex_act()
|
|
GibtoniteReaction(null, 1)
|
|
|
|
/obj/item/twohanded/required/gibtonite/proc/GibtoniteReaction(mob/user, triggered_by = 0)
|
|
if(!primed)
|
|
primed = TRUE
|
|
playsound(src,'sound/effects/hit_on_shattered_glass.ogg',50,1)
|
|
icon_state = "Gibtonite active"
|
|
var/notify_admins = FALSE
|
|
if(z != 5)//Only annoy the admins ingame if we're triggered off the mining zlevel
|
|
notify_admins = TRUE
|
|
|
|
if(triggered_by == 1)
|
|
log_bomber(null, "An explosion has primed a", src, "for detonation", notify_admins)
|
|
else if(triggered_by == 2)
|
|
var/turf/bombturf = get_turf(src)
|
|
if(notify_admins)
|
|
message_admins("A signal has triggered a [name] to detonate at [ADMIN_VERBOSEJMP(bombturf)]. Igniter attacher: [ADMIN_LOOKUPFLW(attacher)]")
|
|
var/bomb_message = "A signal has primed a [name] for detonation at [AREACOORD(bombturf)]. Igniter attacher: [key_name(attacher)]."
|
|
log_game(bomb_message)
|
|
GLOB.bombers += bomb_message
|
|
else
|
|
user.visible_message(span_warning("[user] strikes \the [src], causing a chain reaction!"), span_danger("You strike \the [src], causing a chain reaction."))
|
|
log_bomber(user, "has primed a", src, "for detonation", notify_admins)
|
|
det_timer = addtimer(CALLBACK(src, .proc/detonate, notify_admins), det_time, TIMER_STOPPABLE)
|
|
|
|
/obj/item/twohanded/required/gibtonite/proc/detonate(notify_admins)
|
|
if(primed)
|
|
switch(quality)
|
|
if(GIBTONITE_QUALITY_HIGH)
|
|
explosion(src,2,4,9,adminlog = notify_admins)
|
|
if(GIBTONITE_QUALITY_MEDIUM)
|
|
explosion(src,1,2,5,adminlog = notify_admins)
|
|
if(GIBTONITE_QUALITY_LOW)
|
|
explosion(src,0,1,3,adminlog = notify_admins)
|
|
qdel(src)
|
|
|
|
/obj/item/stack/ore/Initialize()
|
|
. = ..()
|
|
pixel_x = rand(0,16)-8
|
|
pixel_y = rand(0,8)-8
|
|
|
|
/obj/item/stack/ore/ex_act(severity, target)
|
|
if (!severity || severity >= 2)
|
|
return
|
|
qdel(src)
|
|
|
|
|
|
/*****************************Coin********************************/
|
|
|
|
// The coin's value is a value of it's materials.
|
|
// Yes, the gold standard makes a come-back!
|
|
// This is the only way to make coins that are possible to produce on station actually worth anything.
|
|
/obj/item/coin
|
|
icon = 'icons/obj/economy.dmi'
|
|
name = "coin"
|
|
icon_state = "coin__heads"
|
|
flags_1 = CONDUCT_1
|
|
force = 1
|
|
throwforce = 2
|
|
w_class = WEIGHT_CLASS_TINY
|
|
var/string_attached
|
|
var/list/sideslist = list("heads","tails")
|
|
var/cmineral = null
|
|
var/cooldown = 0
|
|
var/value = 1
|
|
var/coinflip
|
|
|
|
/obj/item/coin/get_item_credit_value()
|
|
return value
|
|
|
|
/obj/item/coin/suicide_act(mob/living/user)
|
|
user.visible_message(span_suicide("[user] contemplates suicide with \the [src]!"))
|
|
if (!attack_self(user))
|
|
user.visible_message(span_suicide("[user] couldn't flip \the [src]!"))
|
|
return SHAME
|
|
addtimer(CALLBACK(src, .proc/manual_suicide, user), 10)//10 = time takes for flip animation
|
|
return MANUAL_SUICIDE_NONLETHAL
|
|
|
|
/obj/item/coin/proc/manual_suicide(mob/living/user)
|
|
var/index = sideslist.Find(coinflip)
|
|
if (index==2)//tails
|
|
user.visible_message(span_suicide("\the [src] lands on [coinflip]! [user] promptly falls over, dead!"))
|
|
user.adjustOxyLoss(200)
|
|
user.death(0)
|
|
user.set_suicide(TRUE)
|
|
user.suicide_log()
|
|
else
|
|
user.visible_message(span_suicide("\the [src] lands on [coinflip]! [user] keeps on living!"))
|
|
|
|
/obj/item/coin/Initialize()
|
|
. = ..()
|
|
pixel_x = rand(0,16)-8
|
|
pixel_y = rand(0,8)-8
|
|
|
|
/obj/item/coin/examine(mob/user)
|
|
. = ..()
|
|
if(value)
|
|
. += span_info("It's worth [value] credit\s.")
|
|
|
|
/obj/item/coin/gold
|
|
name = "gold coin"
|
|
cmineral = "gold"
|
|
icon_state = "coin_gold_heads"
|
|
value = 25
|
|
materials = list(/datum/material/gold = MINERAL_MATERIAL_AMOUNT*0.2)
|
|
grind_results = list(/datum/reagent/gold = 4)
|
|
|
|
/obj/item/coin/silver
|
|
name = "silver coin"
|
|
cmineral = "silver"
|
|
icon_state = "coin_silver_heads"
|
|
value = 10
|
|
materials = list(/datum/material/silver = MINERAL_MATERIAL_AMOUNT*0.2)
|
|
grind_results = list(/datum/reagent/silver = 4)
|
|
|
|
/obj/item/coin/diamond
|
|
name = "diamond coin"
|
|
cmineral = "diamond"
|
|
icon_state = "coin_diamond_heads"
|
|
value = 100
|
|
materials = list(/datum/material/diamond = MINERAL_MATERIAL_AMOUNT*0.2)
|
|
grind_results = list(/datum/reagent/carbon = 4)
|
|
|
|
/obj/item/coin/iron
|
|
name = "iron coin"
|
|
cmineral = "iron"
|
|
icon_state = "coin_iron_heads"
|
|
value = 1
|
|
materials = list(/datum/material/iron = MINERAL_MATERIAL_AMOUNT*0.2)
|
|
grind_results = list(/datum/reagent/iron = 4)
|
|
|
|
/obj/item/coin/plasma
|
|
name = "plasma coin"
|
|
cmineral = "plasma"
|
|
icon_state = "coin_plasma_heads"
|
|
value = 40
|
|
materials = list(/datum/material/plasma = MINERAL_MATERIAL_AMOUNT*0.2)
|
|
grind_results = list(/datum/reagent/toxin/plasma = 4)
|
|
|
|
/obj/item/coin/uranium
|
|
name = "uranium coin"
|
|
cmineral = "uranium"
|
|
icon_state = "coin_uranium_heads"
|
|
value = 25
|
|
materials = list(/datum/material/uranium = MINERAL_MATERIAL_AMOUNT*0.2)
|
|
grind_results = list(/datum/reagent/uranium = 4)
|
|
|
|
/obj/item/coin/bananium
|
|
name = "bananium coin"
|
|
cmineral = "bananium"
|
|
icon_state = "coin_bananium_heads"
|
|
value = 200 //makes the clown cry
|
|
materials = list(/datum/material/bananium = MINERAL_MATERIAL_AMOUNT*0.2)
|
|
grind_results = list(/datum/reagent/consumable/banana = 4)
|
|
|
|
/obj/item/coin/adamantine
|
|
name = "adamantine coin"
|
|
cmineral = "adamantine"
|
|
icon_state = "coin_adamantine_heads"
|
|
value = 100
|
|
|
|
/obj/item/coin/mythril
|
|
name = "mythril coin"
|
|
cmineral = "mythril"
|
|
icon_state = "coin_mythril_heads"
|
|
value = 300
|
|
|
|
/obj/item/coin/twoheaded
|
|
cmineral = "iron"
|
|
icon_state = "coin_iron_heads"
|
|
desc = "Hey, this coin's the same on both sides!"
|
|
sideslist = list("heads")
|
|
materials = list(/datum/material/iron = MINERAL_MATERIAL_AMOUNT*0.2)
|
|
value = 1
|
|
grind_results = list(/datum/reagent/iron = 4)
|
|
|
|
/obj/item/coin/antagtoken
|
|
name = "antag token"
|
|
icon_state = "coin_valid_valid"
|
|
cmineral = "valid"
|
|
desc = "A novelty coin that helps the heart know what hard evidence cannot prove."
|
|
sideslist = list("valid", "salad")
|
|
value = 0
|
|
grind_results = list(/datum/reagent/consumable/sodiumchloride = 4)
|
|
|
|
/obj/item/coin/attackby(obj/item/W, mob/user, params)
|
|
if(istype(W, /obj/item/stack/cable_coil))
|
|
var/obj/item/stack/cable_coil/CC = W
|
|
if(string_attached)
|
|
to_chat(user, span_warning("There already is a string attached to this coin!"))
|
|
return
|
|
|
|
if (CC.use(1))
|
|
add_overlay("coin_string_overlay")
|
|
string_attached = 1
|
|
to_chat(user, span_notice("You attach a string to the coin."))
|
|
else
|
|
to_chat(user, span_warning("You need one length of cable to attach a string to the coin!"))
|
|
return
|
|
else
|
|
..()
|
|
|
|
/obj/item/coin/wirecutter_act(mob/living/user, obj/item/I)
|
|
if(!string_attached)
|
|
return TRUE
|
|
|
|
new /obj/item/stack/cable_coil(drop_location(), 1)
|
|
overlays = list()
|
|
string_attached = null
|
|
to_chat(user, span_notice("You detach the string from the coin."))
|
|
return TRUE
|
|
|
|
/obj/item/coin/attack_self(mob/user)
|
|
if(cooldown < world.time)
|
|
if(string_attached) //does the coin have a wire attached
|
|
to_chat(user, span_warning("The coin won't flip very well with something attached!") )
|
|
return FALSE//do not flip the coin
|
|
coinflip = pick(sideslist)
|
|
cooldown = world.time + 15
|
|
flick("coin_[cmineral]_flip", src)
|
|
icon_state = "coin_[cmineral]_[coinflip]"
|
|
playsound(user.loc, 'sound/items/coinflip.ogg', 50, 1)
|
|
var/oldloc = loc
|
|
sleep(15)
|
|
if(loc == oldloc && user && !user.incapacitated())
|
|
user.visible_message("[user] has flipped [src]. It lands on [coinflip].", \
|
|
span_notice("You flip [src]. It lands on [coinflip]."), \
|
|
span_italics("You hear the clattering of loose change."))
|
|
return TRUE//did the coin flip? useful for suicide_act
|
|
|
|
|
|
#undef ORESTACK_OVERLAYS_MAX
|