mirror of
https://github.com/Bubberstation/Bubberstation.git
synced 2026-07-19 12:05:59 +01:00
Force LF line endings with gitattributes and convert repo (#52266)
Co-authored-by: Aleksej Komarov <stylemistake@gmail.com>
This commit is contained in:
@@ -1,172 +1,172 @@
|
||||
/*****************Pickaxes & Drills & Shovels****************/
|
||||
/obj/item/pickaxe
|
||||
name = "pickaxe"
|
||||
icon = 'icons/obj/mining.dmi'
|
||||
icon_state = "pickaxe"
|
||||
flags_1 = CONDUCT_1
|
||||
slot_flags = ITEM_SLOT_BELT | ITEM_SLOT_BACK
|
||||
force = 15
|
||||
throwforce = 10
|
||||
inhand_icon_state = "pickaxe"
|
||||
worn_icon_state = "pickaxe"
|
||||
lefthand_file = 'icons/mob/inhands/equipment/mining_lefthand.dmi'
|
||||
righthand_file = 'icons/mob/inhands/equipment/mining_righthand.dmi'
|
||||
w_class = WEIGHT_CLASS_BULKY
|
||||
custom_materials = list(/datum/material/iron=2000) //one sheet, but where can you make them?
|
||||
tool_behaviour = TOOL_MINING
|
||||
toolspeed = 1
|
||||
usesound = list('sound/effects/picaxe1.ogg', 'sound/effects/picaxe2.ogg', 'sound/effects/picaxe3.ogg')
|
||||
attack_verb = list("hit", "pierced", "sliced", "attacked")
|
||||
|
||||
/obj/item/pickaxe/suicide_act(mob/living/user)
|
||||
user.visible_message("<span class='suicide'>[user] begins digging into [user.p_their()] chest! It looks like [user.p_theyre()] trying to commit suicide!</span>")
|
||||
if(use_tool(user, user, 30, volume=50))
|
||||
return BRUTELOSS
|
||||
user.visible_message("<span class='suicide'>[user] couldn't do it!</span>")
|
||||
return SHAME
|
||||
|
||||
/obj/item/pickaxe/rusted
|
||||
name = "rusty pickaxe"
|
||||
desc = "A pickaxe that's been left to rust."
|
||||
attack_verb = list("ineffectively hit")
|
||||
force = 1
|
||||
throwforce = 1
|
||||
|
||||
/obj/item/pickaxe/mini
|
||||
name = "compact pickaxe"
|
||||
desc = "A smaller, compact version of the standard pickaxe."
|
||||
icon_state = "minipick"
|
||||
worn_icon_state = "pickaxe"
|
||||
force = 10
|
||||
throwforce = 7
|
||||
slot_flags = ITEM_SLOT_BELT
|
||||
w_class = WEIGHT_CLASS_NORMAL
|
||||
custom_materials = list(/datum/material/iron=1000)
|
||||
|
||||
/obj/item/pickaxe/silver
|
||||
name = "silver-plated pickaxe"
|
||||
icon_state = "spickaxe"
|
||||
inhand_icon_state = "spickaxe"
|
||||
worn_icon_state = "spickaxe"
|
||||
toolspeed = 0.5 //mines faster than a normal pickaxe, bought from mining vendor
|
||||
desc = "A silver-plated pickaxe that mines slightly faster than standard-issue."
|
||||
force = 17
|
||||
|
||||
/obj/item/pickaxe/diamond
|
||||
name = "diamond-tipped pickaxe"
|
||||
icon_state = "dpickaxe"
|
||||
inhand_icon_state = "dpickaxe"
|
||||
worn_icon_state = "dpickaxe"
|
||||
toolspeed = 0.3
|
||||
desc = "A pickaxe with a diamond pick head. Extremely robust at cracking rock walls and digging up dirt."
|
||||
force = 19
|
||||
|
||||
/obj/item/pickaxe/drill
|
||||
name = "mining drill"
|
||||
icon_state = "handdrill"
|
||||
inhand_icon_state = "jackhammer"
|
||||
worn_icon_state = "jackhammer"
|
||||
slot_flags = ITEM_SLOT_BELT
|
||||
toolspeed = 0.6 //available from roundstart, faster than a pickaxe.
|
||||
usesound = 'sound/weapons/drill.ogg'
|
||||
hitsound = 'sound/weapons/drill.ogg'
|
||||
desc = "An electric mining drill for the especially scrawny."
|
||||
|
||||
/obj/item/pickaxe/drill/cyborg
|
||||
name = "cyborg mining drill"
|
||||
desc = "An integrated electric mining drill."
|
||||
flags_1 = NONE
|
||||
|
||||
/obj/item/pickaxe/drill/cyborg/Initialize()
|
||||
. = ..()
|
||||
ADD_TRAIT(src, TRAIT_NODROP, CYBORG_ITEM_TRAIT)
|
||||
|
||||
/obj/item/pickaxe/drill/diamonddrill
|
||||
name = "diamond-tipped mining drill"
|
||||
icon_state = "diamonddrill"
|
||||
toolspeed = 0.2
|
||||
desc = "Yours is the drill that will pierce the heavens!"
|
||||
|
||||
/obj/item/pickaxe/drill/cyborg/diamond //This is the BORG version!
|
||||
name = "diamond-tipped cyborg mining drill" //To inherit the NODROP_1 flag, and easier to change borg specific drill mechanics.
|
||||
icon_state = "diamonddrill"
|
||||
toolspeed = 0.2
|
||||
|
||||
/obj/item/pickaxe/drill/jackhammer
|
||||
name = "sonic jackhammer"
|
||||
icon_state = "jackhammer"
|
||||
inhand_icon_state = "jackhammer"
|
||||
worn_icon_state = "jackhammer"
|
||||
toolspeed = 0.1 //the epitome of powertools. extremely fast mining
|
||||
usesound = 'sound/weapons/sonic_jackhammer.ogg'
|
||||
hitsound = 'sound/weapons/sonic_jackhammer.ogg'
|
||||
desc = "Cracks rocks with sonic blasts."
|
||||
|
||||
/obj/item/pickaxe/improvised
|
||||
name = "improvised pickaxe"
|
||||
desc = "A pickaxe made with a knife and crowbar taped together, how does it not break?"
|
||||
icon_state = "ipickaxe"
|
||||
inhand_icon_state = "ipickaxe"
|
||||
worn_icon_state = "pickaxe"
|
||||
force = 10
|
||||
throwforce = 7
|
||||
toolspeed = 3 //3 times slower than a normal pickaxe
|
||||
slot_flags = ITEM_SLOT_BELT
|
||||
w_class = WEIGHT_CLASS_NORMAL
|
||||
custom_materials = list(/datum/material/iron=12050) //metal needed for a crowbar and for a knife, why the FUCK does a knife cost 6 metal sheets while a crowbar costs 0.025 sheets? shit makes no sense fuck this
|
||||
|
||||
/obj/item/shovel
|
||||
name = "shovel"
|
||||
desc = "A large tool for digging and moving dirt."
|
||||
icon = 'icons/obj/mining.dmi'
|
||||
icon_state = "shovel"
|
||||
lefthand_file = 'icons/mob/inhands/equipment/mining_lefthand.dmi'
|
||||
righthand_file = 'icons/mob/inhands/equipment/mining_righthand.dmi'
|
||||
flags_1 = CONDUCT_1
|
||||
slot_flags = ITEM_SLOT_BELT
|
||||
force = 8
|
||||
tool_behaviour = TOOL_SHOVEL
|
||||
toolspeed = 1
|
||||
usesound = 'sound/effects/shovel_dig.ogg'
|
||||
throwforce = 4
|
||||
inhand_icon_state = "shovel"
|
||||
w_class = WEIGHT_CLASS_NORMAL
|
||||
custom_materials = list(/datum/material/iron=50)
|
||||
attack_verb = list("bashed", "bludgeoned", "thrashed", "whacked")
|
||||
sharpness = IS_SHARP
|
||||
|
||||
/obj/item/shovel/Initialize()
|
||||
. = ..()
|
||||
AddComponent(/datum/component/butchering, 150, 40) //it's sharp, so it works, but barely.
|
||||
|
||||
/obj/item/shovel/suicide_act(mob/living/user)
|
||||
user.visible_message("<span class='suicide'>[user] begins digging their own grave! It looks like [user.p_theyre()] trying to commit suicide!</span>")
|
||||
if(use_tool(user, user, 30, volume=50))
|
||||
return BRUTELOSS
|
||||
user.visible_message("<span class='suicide'>[user] couldn't do it!</span>")
|
||||
return SHAME
|
||||
|
||||
/obj/item/shovel/spade
|
||||
name = "spade"
|
||||
desc = "A small tool for digging and moving dirt."
|
||||
icon_state = "spade"
|
||||
inhand_icon_state = "spade"
|
||||
lefthand_file = 'icons/mob/inhands/equipment/hydroponics_lefthand.dmi'
|
||||
righthand_file = 'icons/mob/inhands/equipment/hydroponics_righthand.dmi'
|
||||
force = 5
|
||||
throwforce = 7
|
||||
w_class = WEIGHT_CLASS_SMALL
|
||||
|
||||
/obj/item/shovel/serrated
|
||||
name = "serrated bone shovel"
|
||||
desc = "A wicked tool that cleaves through dirt just as easily as it does flesh. The design was styled after ancient lavaland tribal designs."
|
||||
icon_state = "shovel_bone"
|
||||
inhand_icon_state = "shovel_bone"
|
||||
lefthand_file = 'icons/mob/inhands/equipment/mining_lefthand.dmi'
|
||||
righthand_file = 'icons/mob/inhands/equipment/mining_righthand.dmi'
|
||||
force = 15
|
||||
throwforce = 12
|
||||
w_class = WEIGHT_CLASS_NORMAL
|
||||
toolspeed = 0.7
|
||||
attack_verb = list("slashed", "impaled", "stabbed", "sliced")
|
||||
sharpness = IS_SHARP
|
||||
/*****************Pickaxes & Drills & Shovels****************/
|
||||
/obj/item/pickaxe
|
||||
name = "pickaxe"
|
||||
icon = 'icons/obj/mining.dmi'
|
||||
icon_state = "pickaxe"
|
||||
flags_1 = CONDUCT_1
|
||||
slot_flags = ITEM_SLOT_BELT | ITEM_SLOT_BACK
|
||||
force = 15
|
||||
throwforce = 10
|
||||
inhand_icon_state = "pickaxe"
|
||||
worn_icon_state = "pickaxe"
|
||||
lefthand_file = 'icons/mob/inhands/equipment/mining_lefthand.dmi'
|
||||
righthand_file = 'icons/mob/inhands/equipment/mining_righthand.dmi'
|
||||
w_class = WEIGHT_CLASS_BULKY
|
||||
custom_materials = list(/datum/material/iron=2000) //one sheet, but where can you make them?
|
||||
tool_behaviour = TOOL_MINING
|
||||
toolspeed = 1
|
||||
usesound = list('sound/effects/picaxe1.ogg', 'sound/effects/picaxe2.ogg', 'sound/effects/picaxe3.ogg')
|
||||
attack_verb = list("hit", "pierced", "sliced", "attacked")
|
||||
|
||||
/obj/item/pickaxe/suicide_act(mob/living/user)
|
||||
user.visible_message("<span class='suicide'>[user] begins digging into [user.p_their()] chest! It looks like [user.p_theyre()] trying to commit suicide!</span>")
|
||||
if(use_tool(user, user, 30, volume=50))
|
||||
return BRUTELOSS
|
||||
user.visible_message("<span class='suicide'>[user] couldn't do it!</span>")
|
||||
return SHAME
|
||||
|
||||
/obj/item/pickaxe/rusted
|
||||
name = "rusty pickaxe"
|
||||
desc = "A pickaxe that's been left to rust."
|
||||
attack_verb = list("ineffectively hit")
|
||||
force = 1
|
||||
throwforce = 1
|
||||
|
||||
/obj/item/pickaxe/mini
|
||||
name = "compact pickaxe"
|
||||
desc = "A smaller, compact version of the standard pickaxe."
|
||||
icon_state = "minipick"
|
||||
worn_icon_state = "pickaxe"
|
||||
force = 10
|
||||
throwforce = 7
|
||||
slot_flags = ITEM_SLOT_BELT
|
||||
w_class = WEIGHT_CLASS_NORMAL
|
||||
custom_materials = list(/datum/material/iron=1000)
|
||||
|
||||
/obj/item/pickaxe/silver
|
||||
name = "silver-plated pickaxe"
|
||||
icon_state = "spickaxe"
|
||||
inhand_icon_state = "spickaxe"
|
||||
worn_icon_state = "spickaxe"
|
||||
toolspeed = 0.5 //mines faster than a normal pickaxe, bought from mining vendor
|
||||
desc = "A silver-plated pickaxe that mines slightly faster than standard-issue."
|
||||
force = 17
|
||||
|
||||
/obj/item/pickaxe/diamond
|
||||
name = "diamond-tipped pickaxe"
|
||||
icon_state = "dpickaxe"
|
||||
inhand_icon_state = "dpickaxe"
|
||||
worn_icon_state = "dpickaxe"
|
||||
toolspeed = 0.3
|
||||
desc = "A pickaxe with a diamond pick head. Extremely robust at cracking rock walls and digging up dirt."
|
||||
force = 19
|
||||
|
||||
/obj/item/pickaxe/drill
|
||||
name = "mining drill"
|
||||
icon_state = "handdrill"
|
||||
inhand_icon_state = "jackhammer"
|
||||
worn_icon_state = "jackhammer"
|
||||
slot_flags = ITEM_SLOT_BELT
|
||||
toolspeed = 0.6 //available from roundstart, faster than a pickaxe.
|
||||
usesound = 'sound/weapons/drill.ogg'
|
||||
hitsound = 'sound/weapons/drill.ogg'
|
||||
desc = "An electric mining drill for the especially scrawny."
|
||||
|
||||
/obj/item/pickaxe/drill/cyborg
|
||||
name = "cyborg mining drill"
|
||||
desc = "An integrated electric mining drill."
|
||||
flags_1 = NONE
|
||||
|
||||
/obj/item/pickaxe/drill/cyborg/Initialize()
|
||||
. = ..()
|
||||
ADD_TRAIT(src, TRAIT_NODROP, CYBORG_ITEM_TRAIT)
|
||||
|
||||
/obj/item/pickaxe/drill/diamonddrill
|
||||
name = "diamond-tipped mining drill"
|
||||
icon_state = "diamonddrill"
|
||||
toolspeed = 0.2
|
||||
desc = "Yours is the drill that will pierce the heavens!"
|
||||
|
||||
/obj/item/pickaxe/drill/cyborg/diamond //This is the BORG version!
|
||||
name = "diamond-tipped cyborg mining drill" //To inherit the NODROP_1 flag, and easier to change borg specific drill mechanics.
|
||||
icon_state = "diamonddrill"
|
||||
toolspeed = 0.2
|
||||
|
||||
/obj/item/pickaxe/drill/jackhammer
|
||||
name = "sonic jackhammer"
|
||||
icon_state = "jackhammer"
|
||||
inhand_icon_state = "jackhammer"
|
||||
worn_icon_state = "jackhammer"
|
||||
toolspeed = 0.1 //the epitome of powertools. extremely fast mining
|
||||
usesound = 'sound/weapons/sonic_jackhammer.ogg'
|
||||
hitsound = 'sound/weapons/sonic_jackhammer.ogg'
|
||||
desc = "Cracks rocks with sonic blasts."
|
||||
|
||||
/obj/item/pickaxe/improvised
|
||||
name = "improvised pickaxe"
|
||||
desc = "A pickaxe made with a knife and crowbar taped together, how does it not break?"
|
||||
icon_state = "ipickaxe"
|
||||
inhand_icon_state = "ipickaxe"
|
||||
worn_icon_state = "pickaxe"
|
||||
force = 10
|
||||
throwforce = 7
|
||||
toolspeed = 3 //3 times slower than a normal pickaxe
|
||||
slot_flags = ITEM_SLOT_BELT
|
||||
w_class = WEIGHT_CLASS_NORMAL
|
||||
custom_materials = list(/datum/material/iron=12050) //metal needed for a crowbar and for a knife, why the FUCK does a knife cost 6 metal sheets while a crowbar costs 0.025 sheets? shit makes no sense fuck this
|
||||
|
||||
/obj/item/shovel
|
||||
name = "shovel"
|
||||
desc = "A large tool for digging and moving dirt."
|
||||
icon = 'icons/obj/mining.dmi'
|
||||
icon_state = "shovel"
|
||||
lefthand_file = 'icons/mob/inhands/equipment/mining_lefthand.dmi'
|
||||
righthand_file = 'icons/mob/inhands/equipment/mining_righthand.dmi'
|
||||
flags_1 = CONDUCT_1
|
||||
slot_flags = ITEM_SLOT_BELT
|
||||
force = 8
|
||||
tool_behaviour = TOOL_SHOVEL
|
||||
toolspeed = 1
|
||||
usesound = 'sound/effects/shovel_dig.ogg'
|
||||
throwforce = 4
|
||||
inhand_icon_state = "shovel"
|
||||
w_class = WEIGHT_CLASS_NORMAL
|
||||
custom_materials = list(/datum/material/iron=50)
|
||||
attack_verb = list("bashed", "bludgeoned", "thrashed", "whacked")
|
||||
sharpness = IS_SHARP
|
||||
|
||||
/obj/item/shovel/Initialize()
|
||||
. = ..()
|
||||
AddComponent(/datum/component/butchering, 150, 40) //it's sharp, so it works, but barely.
|
||||
|
||||
/obj/item/shovel/suicide_act(mob/living/user)
|
||||
user.visible_message("<span class='suicide'>[user] begins digging their own grave! It looks like [user.p_theyre()] trying to commit suicide!</span>")
|
||||
if(use_tool(user, user, 30, volume=50))
|
||||
return BRUTELOSS
|
||||
user.visible_message("<span class='suicide'>[user] couldn't do it!</span>")
|
||||
return SHAME
|
||||
|
||||
/obj/item/shovel/spade
|
||||
name = "spade"
|
||||
desc = "A small tool for digging and moving dirt."
|
||||
icon_state = "spade"
|
||||
inhand_icon_state = "spade"
|
||||
lefthand_file = 'icons/mob/inhands/equipment/hydroponics_lefthand.dmi'
|
||||
righthand_file = 'icons/mob/inhands/equipment/hydroponics_righthand.dmi'
|
||||
force = 5
|
||||
throwforce = 7
|
||||
w_class = WEIGHT_CLASS_SMALL
|
||||
|
||||
/obj/item/shovel/serrated
|
||||
name = "serrated bone shovel"
|
||||
desc = "A wicked tool that cleaves through dirt just as easily as it does flesh. The design was styled after ancient lavaland tribal designs."
|
||||
icon_state = "shovel_bone"
|
||||
inhand_icon_state = "shovel_bone"
|
||||
lefthand_file = 'icons/mob/inhands/equipment/mining_lefthand.dmi'
|
||||
righthand_file = 'icons/mob/inhands/equipment/mining_righthand.dmi'
|
||||
force = 15
|
||||
throwforce = 12
|
||||
w_class = WEIGHT_CLASS_NORMAL
|
||||
toolspeed = 0.7
|
||||
attack_verb = list("slashed", "impaled", "stabbed", "sliced")
|
||||
sharpness = IS_SHARP
|
||||
|
||||
@@ -1,27 +1,27 @@
|
||||
/obj/machinery/computer/shuttle/labor
|
||||
name = "labor shuttle console"
|
||||
desc = "Used to call and send the labor camp shuttle."
|
||||
circuit = /obj/item/circuitboard/computer/labor_shuttle
|
||||
shuttleId = "laborcamp"
|
||||
possible_destinations = "laborcamp_home;laborcamp_away"
|
||||
req_access = list(ACCESS_BRIG)
|
||||
|
||||
|
||||
/obj/machinery/computer/shuttle/labor/one_way
|
||||
name = "prisoner shuttle console"
|
||||
desc = "A one-way shuttle console, used to summon the shuttle to the labor camp."
|
||||
possible_destinations = "laborcamp_away"
|
||||
circuit = /obj/item/circuitboard/computer/labor_shuttle/one_way
|
||||
req_access = list( )
|
||||
|
||||
/obj/machinery/computer/shuttle/labor/one_way/Topic(href, href_list)
|
||||
if(href_list["move"])
|
||||
var/obj/docking_port/mobile/M = SSshuttle.getShuttle("laborcamp")
|
||||
if(!M)
|
||||
to_chat(usr, "<span class='warning'>Cannot locate shuttle!</span>")
|
||||
return 0
|
||||
var/obj/docking_port/stationary/S = M.get_docked()
|
||||
if(S && S.name == "laborcamp_away")
|
||||
to_chat(usr, "<span class='warning'>Shuttle is already at the outpost!</span>")
|
||||
return 0
|
||||
..()
|
||||
/obj/machinery/computer/shuttle/labor
|
||||
name = "labor shuttle console"
|
||||
desc = "Used to call and send the labor camp shuttle."
|
||||
circuit = /obj/item/circuitboard/computer/labor_shuttle
|
||||
shuttleId = "laborcamp"
|
||||
possible_destinations = "laborcamp_home;laborcamp_away"
|
||||
req_access = list(ACCESS_BRIG)
|
||||
|
||||
|
||||
/obj/machinery/computer/shuttle/labor/one_way
|
||||
name = "prisoner shuttle console"
|
||||
desc = "A one-way shuttle console, used to summon the shuttle to the labor camp."
|
||||
possible_destinations = "laborcamp_away"
|
||||
circuit = /obj/item/circuitboard/computer/labor_shuttle/one_way
|
||||
req_access = list( )
|
||||
|
||||
/obj/machinery/computer/shuttle/labor/one_way/Topic(href, href_list)
|
||||
if(href_list["move"])
|
||||
var/obj/docking_port/mobile/M = SSshuttle.getShuttle("laborcamp")
|
||||
if(!M)
|
||||
to_chat(usr, "<span class='warning'>Cannot locate shuttle!</span>")
|
||||
return 0
|
||||
var/obj/docking_port/stationary/S = M.get_docked()
|
||||
if(S && S.name == "laborcamp_away")
|
||||
to_chat(usr, "<span class='warning'>Shuttle is already at the outpost!</span>")
|
||||
return 0
|
||||
..()
|
||||
|
||||
@@ -1,161 +1,161 @@
|
||||
GLOBAL_LIST(labor_sheet_values)
|
||||
|
||||
/**********************Prisoners' Console**************************/
|
||||
|
||||
/obj/machinery/mineral/labor_claim_console
|
||||
name = "point claim console"
|
||||
desc = "A stacking console with an electromagnetic writer, used to track ore mined by prisoners."
|
||||
icon = 'icons/obj/machines/mining_machines.dmi'
|
||||
icon_state = "console"
|
||||
density = FALSE
|
||||
ui_x = 315
|
||||
ui_y = 430
|
||||
|
||||
var/obj/machinery/mineral/stacking_machine/laborstacker/stacking_machine = null
|
||||
var/machinedir = SOUTH
|
||||
var/obj/machinery/door/airlock/release_door
|
||||
var/door_tag = "prisonshuttle"
|
||||
var/obj/item/radio/Radio //needed to send messages to sec radio
|
||||
|
||||
/obj/machinery/mineral/labor_claim_console/Initialize()
|
||||
. = ..()
|
||||
Radio = new/obj/item/radio(src)
|
||||
Radio.listening = FALSE
|
||||
locate_stacking_machine()
|
||||
|
||||
if(!GLOB.labor_sheet_values)
|
||||
var/sheet_list = list()
|
||||
for(var/sheet_type in subtypesof(/obj/item/stack/sheet))
|
||||
var/obj/item/stack/sheet/sheet = sheet_type
|
||||
if(!initial(sheet.point_value) || (initial(sheet.merge_type) && initial(sheet.merge_type) != sheet_type)) //ignore no-value sheets and x/fifty subtypes
|
||||
continue
|
||||
sheet_list += list(list("ore" = initial(sheet.name), "value" = initial(sheet.point_value)))
|
||||
GLOB.labor_sheet_values = sortList(sheet_list, /proc/cmp_sheet_list)
|
||||
|
||||
/proc/cmp_sheet_list(list/a, list/b)
|
||||
return a["value"] - b["value"]
|
||||
|
||||
/obj/machinery/mineral/labor_claim_console/ui_interact(mob/user, ui_key = "main", datum/tgui/ui = null, force_open = FALSE, \
|
||||
datum/tgui/master_ui = null, datum/ui_state/state = GLOB.default_state)
|
||||
ui = SStgui.try_update_ui(user, src, ui_key, ui, force_open)
|
||||
if(!ui)
|
||||
ui = new(user, src, ui_key, "LaborClaimConsole", name, ui_x, ui_y, master_ui, state)
|
||||
ui.open()
|
||||
|
||||
/obj/machinery/mineral/labor_claim_console/ui_data(mob/user)
|
||||
var/list/data = list()
|
||||
var/can_go_home = FALSE
|
||||
|
||||
data["emagged"] = (obj_flags & EMAGGED) ? 1 : 0
|
||||
if(obj_flags & EMAGGED)
|
||||
can_go_home = TRUE
|
||||
|
||||
var/obj/item/card/id/I = user.get_idcard(TRUE)
|
||||
if(istype(I, /obj/item/card/id/prisoner))
|
||||
var/obj/item/card/id/prisoner/P = I
|
||||
data["id_points"] = P.points
|
||||
if(P.points >= P.goal)
|
||||
can_go_home = TRUE
|
||||
data["status_info"] = "Goal met!"
|
||||
else
|
||||
data["status_info"] = "You are [(P.goal - P.points)] points away."
|
||||
else
|
||||
data["status_info"] = "No Prisoner ID detected."
|
||||
data["id_points"] = 0
|
||||
|
||||
if(stacking_machine)
|
||||
data["unclaimed_points"] = stacking_machine.points
|
||||
|
||||
data["ores"] = GLOB.labor_sheet_values
|
||||
data["can_go_home"] = can_go_home
|
||||
|
||||
return data
|
||||
|
||||
/obj/machinery/mineral/labor_claim_console/ui_act(action, params)
|
||||
if(..())
|
||||
return
|
||||
switch(action)
|
||||
if("claim_points")
|
||||
var/mob/M = usr
|
||||
var/obj/item/card/id/I = M.get_idcard(TRUE)
|
||||
if(istype(I, /obj/item/card/id/prisoner))
|
||||
var/obj/item/card/id/prisoner/P = I
|
||||
P.points += stacking_machine.points
|
||||
stacking_machine.points = 0
|
||||
to_chat(usr, "<span class='notice'>Points transferred.</span>")
|
||||
. = TRUE
|
||||
else
|
||||
to_chat(usr, "<span class='alert'>No valid id for point transfer detected.</span>")
|
||||
if("move_shuttle")
|
||||
if(!alone_in_area(get_area(src), usr))
|
||||
to_chat(usr, "<span class='alert'>Prisoners are only allowed to be released while alone.</span>")
|
||||
else
|
||||
switch(SSshuttle.moveShuttle("laborcamp", "laborcamp_home", TRUE))
|
||||
if(1)
|
||||
to_chat(usr, "<span class='alert'>Shuttle not found.</span>")
|
||||
if(2)
|
||||
to_chat(usr, "<span class='alert'>Shuttle already at station.</span>")
|
||||
if(3)
|
||||
to_chat(usr, "<span class='alert'>No permission to dock could be granted.</span>")
|
||||
else
|
||||
if(!(obj_flags & EMAGGED))
|
||||
Radio.set_frequency(FREQ_SECURITY)
|
||||
Radio.talk_into(src, "A prisoner has returned to the station. Minerals and Prisoner ID card ready for retrieval.", FREQ_SECURITY)
|
||||
to_chat(usr, "<span class='notice'>Shuttle received message and will be sent shortly.</span>")
|
||||
. = TRUE
|
||||
|
||||
/obj/machinery/mineral/labor_claim_console/proc/locate_stacking_machine()
|
||||
stacking_machine = locate(/obj/machinery/mineral/stacking_machine, get_step(src, machinedir))
|
||||
if(stacking_machine)
|
||||
stacking_machine.CONSOLE = src
|
||||
else
|
||||
qdel(src)
|
||||
|
||||
/obj/machinery/mineral/labor_claim_console/emag_act(mob/user)
|
||||
if(!(obj_flags & EMAGGED))
|
||||
obj_flags |= EMAGGED
|
||||
to_chat(user, "<span class='warning'>PZZTTPFFFT</span>")
|
||||
|
||||
/**********************Prisoner Collection Unit**************************/
|
||||
|
||||
/obj/machinery/mineral/stacking_machine/laborstacker
|
||||
force_connect = TRUE
|
||||
var/points = 0 //The unclaimed value of ore stacked.
|
||||
damage_deflection = 21
|
||||
/obj/machinery/mineral/stacking_machine/laborstacker/process_sheet(obj/item/stack/sheet/inp)
|
||||
points += inp.point_value * inp.amount
|
||||
..()
|
||||
|
||||
/obj/machinery/mineral/stacking_machine/laborstacker/attackby(obj/item/I, mob/living/user)
|
||||
if(istype(I, /obj/item/stack/sheet) && user.canUnEquip(I))
|
||||
var/obj/item/stack/sheet/inp = I
|
||||
points += inp.point_value * inp.amount
|
||||
return ..()
|
||||
|
||||
/**********************Point Lookup Console**************************/
|
||||
|
||||
/obj/machinery/mineral/labor_points_checker
|
||||
name = "points checking console"
|
||||
desc = "A console used by prisoners to check the progress on their quotas. Simply swipe a prisoner ID."
|
||||
icon = 'icons/obj/machines/mining_machines.dmi'
|
||||
icon_state = "console"
|
||||
density = FALSE
|
||||
|
||||
/obj/machinery/mineral/labor_points_checker/attack_hand(mob/user)
|
||||
. = ..()
|
||||
if(.)
|
||||
return
|
||||
user.examinate(src)
|
||||
|
||||
/obj/machinery/mineral/labor_points_checker/attackby(obj/item/I, mob/user, params)
|
||||
if(istype(I, /obj/item/card/id))
|
||||
if(istype(I, /obj/item/card/id/prisoner))
|
||||
var/obj/item/card/id/prisoner/prisoner_id = I
|
||||
to_chat(user, "<span class='notice'><B>ID: [prisoner_id.registered_name]</B></span>")
|
||||
to_chat(user, "<span class='notice'>Points Collected:[prisoner_id.points]</span>")
|
||||
to_chat(user, "<span class='notice'>Point Quota: [prisoner_id.goal]</span>")
|
||||
to_chat(user, "<span class='notice'>Collect points by bringing smelted minerals to the Labor Shuttle stacking machine. Reach your quota to earn your release.</span>")
|
||||
else
|
||||
to_chat(user, "<span class='warning'>Error: Invalid ID</span>")
|
||||
else
|
||||
return ..()
|
||||
GLOBAL_LIST(labor_sheet_values)
|
||||
|
||||
/**********************Prisoners' Console**************************/
|
||||
|
||||
/obj/machinery/mineral/labor_claim_console
|
||||
name = "point claim console"
|
||||
desc = "A stacking console with an electromagnetic writer, used to track ore mined by prisoners."
|
||||
icon = 'icons/obj/machines/mining_machines.dmi'
|
||||
icon_state = "console"
|
||||
density = FALSE
|
||||
ui_x = 315
|
||||
ui_y = 430
|
||||
|
||||
var/obj/machinery/mineral/stacking_machine/laborstacker/stacking_machine = null
|
||||
var/machinedir = SOUTH
|
||||
var/obj/machinery/door/airlock/release_door
|
||||
var/door_tag = "prisonshuttle"
|
||||
var/obj/item/radio/Radio //needed to send messages to sec radio
|
||||
|
||||
/obj/machinery/mineral/labor_claim_console/Initialize()
|
||||
. = ..()
|
||||
Radio = new/obj/item/radio(src)
|
||||
Radio.listening = FALSE
|
||||
locate_stacking_machine()
|
||||
|
||||
if(!GLOB.labor_sheet_values)
|
||||
var/sheet_list = list()
|
||||
for(var/sheet_type in subtypesof(/obj/item/stack/sheet))
|
||||
var/obj/item/stack/sheet/sheet = sheet_type
|
||||
if(!initial(sheet.point_value) || (initial(sheet.merge_type) && initial(sheet.merge_type) != sheet_type)) //ignore no-value sheets and x/fifty subtypes
|
||||
continue
|
||||
sheet_list += list(list("ore" = initial(sheet.name), "value" = initial(sheet.point_value)))
|
||||
GLOB.labor_sheet_values = sortList(sheet_list, /proc/cmp_sheet_list)
|
||||
|
||||
/proc/cmp_sheet_list(list/a, list/b)
|
||||
return a["value"] - b["value"]
|
||||
|
||||
/obj/machinery/mineral/labor_claim_console/ui_interact(mob/user, ui_key = "main", datum/tgui/ui = null, force_open = FALSE, \
|
||||
datum/tgui/master_ui = null, datum/ui_state/state = GLOB.default_state)
|
||||
ui = SStgui.try_update_ui(user, src, ui_key, ui, force_open)
|
||||
if(!ui)
|
||||
ui = new(user, src, ui_key, "LaborClaimConsole", name, ui_x, ui_y, master_ui, state)
|
||||
ui.open()
|
||||
|
||||
/obj/machinery/mineral/labor_claim_console/ui_data(mob/user)
|
||||
var/list/data = list()
|
||||
var/can_go_home = FALSE
|
||||
|
||||
data["emagged"] = (obj_flags & EMAGGED) ? 1 : 0
|
||||
if(obj_flags & EMAGGED)
|
||||
can_go_home = TRUE
|
||||
|
||||
var/obj/item/card/id/I = user.get_idcard(TRUE)
|
||||
if(istype(I, /obj/item/card/id/prisoner))
|
||||
var/obj/item/card/id/prisoner/P = I
|
||||
data["id_points"] = P.points
|
||||
if(P.points >= P.goal)
|
||||
can_go_home = TRUE
|
||||
data["status_info"] = "Goal met!"
|
||||
else
|
||||
data["status_info"] = "You are [(P.goal - P.points)] points away."
|
||||
else
|
||||
data["status_info"] = "No Prisoner ID detected."
|
||||
data["id_points"] = 0
|
||||
|
||||
if(stacking_machine)
|
||||
data["unclaimed_points"] = stacking_machine.points
|
||||
|
||||
data["ores"] = GLOB.labor_sheet_values
|
||||
data["can_go_home"] = can_go_home
|
||||
|
||||
return data
|
||||
|
||||
/obj/machinery/mineral/labor_claim_console/ui_act(action, params)
|
||||
if(..())
|
||||
return
|
||||
switch(action)
|
||||
if("claim_points")
|
||||
var/mob/M = usr
|
||||
var/obj/item/card/id/I = M.get_idcard(TRUE)
|
||||
if(istype(I, /obj/item/card/id/prisoner))
|
||||
var/obj/item/card/id/prisoner/P = I
|
||||
P.points += stacking_machine.points
|
||||
stacking_machine.points = 0
|
||||
to_chat(usr, "<span class='notice'>Points transferred.</span>")
|
||||
. = TRUE
|
||||
else
|
||||
to_chat(usr, "<span class='alert'>No valid id for point transfer detected.</span>")
|
||||
if("move_shuttle")
|
||||
if(!alone_in_area(get_area(src), usr))
|
||||
to_chat(usr, "<span class='alert'>Prisoners are only allowed to be released while alone.</span>")
|
||||
else
|
||||
switch(SSshuttle.moveShuttle("laborcamp", "laborcamp_home", TRUE))
|
||||
if(1)
|
||||
to_chat(usr, "<span class='alert'>Shuttle not found.</span>")
|
||||
if(2)
|
||||
to_chat(usr, "<span class='alert'>Shuttle already at station.</span>")
|
||||
if(3)
|
||||
to_chat(usr, "<span class='alert'>No permission to dock could be granted.</span>")
|
||||
else
|
||||
if(!(obj_flags & EMAGGED))
|
||||
Radio.set_frequency(FREQ_SECURITY)
|
||||
Radio.talk_into(src, "A prisoner has returned to the station. Minerals and Prisoner ID card ready for retrieval.", FREQ_SECURITY)
|
||||
to_chat(usr, "<span class='notice'>Shuttle received message and will be sent shortly.</span>")
|
||||
. = TRUE
|
||||
|
||||
/obj/machinery/mineral/labor_claim_console/proc/locate_stacking_machine()
|
||||
stacking_machine = locate(/obj/machinery/mineral/stacking_machine, get_step(src, machinedir))
|
||||
if(stacking_machine)
|
||||
stacking_machine.CONSOLE = src
|
||||
else
|
||||
qdel(src)
|
||||
|
||||
/obj/machinery/mineral/labor_claim_console/emag_act(mob/user)
|
||||
if(!(obj_flags & EMAGGED))
|
||||
obj_flags |= EMAGGED
|
||||
to_chat(user, "<span class='warning'>PZZTTPFFFT</span>")
|
||||
|
||||
/**********************Prisoner Collection Unit**************************/
|
||||
|
||||
/obj/machinery/mineral/stacking_machine/laborstacker
|
||||
force_connect = TRUE
|
||||
var/points = 0 //The unclaimed value of ore stacked.
|
||||
damage_deflection = 21
|
||||
/obj/machinery/mineral/stacking_machine/laborstacker/process_sheet(obj/item/stack/sheet/inp)
|
||||
points += inp.point_value * inp.amount
|
||||
..()
|
||||
|
||||
/obj/machinery/mineral/stacking_machine/laborstacker/attackby(obj/item/I, mob/living/user)
|
||||
if(istype(I, /obj/item/stack/sheet) && user.canUnEquip(I))
|
||||
var/obj/item/stack/sheet/inp = I
|
||||
points += inp.point_value * inp.amount
|
||||
return ..()
|
||||
|
||||
/**********************Point Lookup Console**************************/
|
||||
|
||||
/obj/machinery/mineral/labor_points_checker
|
||||
name = "points checking console"
|
||||
desc = "A console used by prisoners to check the progress on their quotas. Simply swipe a prisoner ID."
|
||||
icon = 'icons/obj/machines/mining_machines.dmi'
|
||||
icon_state = "console"
|
||||
density = FALSE
|
||||
|
||||
/obj/machinery/mineral/labor_points_checker/attack_hand(mob/user)
|
||||
. = ..()
|
||||
if(.)
|
||||
return
|
||||
user.examinate(src)
|
||||
|
||||
/obj/machinery/mineral/labor_points_checker/attackby(obj/item/I, mob/user, params)
|
||||
if(istype(I, /obj/item/card/id))
|
||||
if(istype(I, /obj/item/card/id/prisoner))
|
||||
var/obj/item/card/id/prisoner/prisoner_id = I
|
||||
to_chat(user, "<span class='notice'><B>ID: [prisoner_id.registered_name]</B></span>")
|
||||
to_chat(user, "<span class='notice'>Points Collected:[prisoner_id.points]</span>")
|
||||
to_chat(user, "<span class='notice'>Point Quota: [prisoner_id.goal]</span>")
|
||||
to_chat(user, "<span class='notice'>Collect points by bringing smelted minerals to the Labor Shuttle stacking machine. Reach your quota to earn your release.</span>")
|
||||
else
|
||||
to_chat(user, "<span class='warning'>Error: Invalid ID</span>")
|
||||
else
|
||||
return ..()
|
||||
|
||||
@@ -1,263 +1,263 @@
|
||||
#define SMELT_AMOUNT 10
|
||||
|
||||
/**********************Mineral processing unit console**************************/
|
||||
|
||||
/obj/machinery/mineral
|
||||
processing_flags = START_PROCESSING_MANUALLY
|
||||
subsystem_type = /datum/controller/subsystem/processing/fastprocess
|
||||
/// The current direction of `input_turf`, in relation to the machine.
|
||||
var/input_dir = NORTH
|
||||
/// The current direction, in relation to the machine, that items will be output to.
|
||||
var/output_dir = SOUTH
|
||||
/// The turf the machines listens to for items to pick up. Calls the `pickup_item()` proc.
|
||||
var/turf/input_turf = null
|
||||
/// Determines if this machine needs to pick up items. Used to avoid registering signals to `/mineral` machines that don't pickup items.
|
||||
var/needs_item_input = FALSE
|
||||
|
||||
/obj/machinery/mineral/Initialize(mapload)
|
||||
. = ..()
|
||||
if(needs_item_input && anchored)
|
||||
register_input_turf()
|
||||
|
||||
/// Gets the turf in the `input_dir` direction adjacent to the machine, and registers signals for ATOM_ENTERED and ATOM_CREATED. Calls the `pickup_item()` proc when it receives these signals.
|
||||
/obj/machinery/mineral/proc/register_input_turf()
|
||||
input_turf = get_step(src, input_dir)
|
||||
if(input_turf) // make sure there is actually a turf
|
||||
RegisterSignal(input_turf, list(COMSIG_ATOM_CREATED, COMSIG_ATOM_ENTERED), .proc/pickup_item)
|
||||
|
||||
/// Unregisters signals that are registered the machine's input turf, if it has one.
|
||||
/obj/machinery/mineral/proc/unregister_input_turf()
|
||||
if(input_turf)
|
||||
UnregisterSignal(input_turf, list(COMSIG_ATOM_ENTERED, COMSIG_ATOM_CREATED))
|
||||
|
||||
/obj/machinery/mineral/Moved()
|
||||
. = ..()
|
||||
if(!needs_item_input || !anchored)
|
||||
return
|
||||
unregister_input_turf()
|
||||
register_input_turf()
|
||||
|
||||
/**
|
||||
Base proc for all `/mineral` subtype machines to use. Place your item pickup behavior in this proc when you override it for your specific machine.
|
||||
|
||||
Called when the COMSIG_ATOM_ENTERED and COMSIG_ATOM_CREATED signals are sent.
|
||||
|
||||
Arguments:
|
||||
* source - the turf that is listening for the signals.
|
||||
* target - the atom that just moved onto the `source` turf.
|
||||
* oldLoc - the old location that `target` was at before moving onto `source`.
|
||||
*/
|
||||
/obj/machinery/mineral/proc/pickup_item(datum/source, atom/movable/target, atom/oldLoc)
|
||||
return
|
||||
|
||||
/// Generic unloading proc. Takes an atom as an argument and forceMove's it to the turf adjacent to this machine in the `output_dir` direction.
|
||||
/obj/machinery/mineral/proc/unload_mineral(atom/movable/S)
|
||||
S.forceMove(drop_location())
|
||||
var/turf/T = get_step(src,output_dir)
|
||||
if(T)
|
||||
S.forceMove(T)
|
||||
|
||||
/obj/machinery/mineral/processing_unit_console
|
||||
name = "production machine console"
|
||||
icon = 'icons/obj/machines/mining_machines.dmi'
|
||||
icon_state = "console"
|
||||
density = TRUE
|
||||
var/obj/machinery/mineral/processing_unit/machine = null
|
||||
var/machinedir = EAST
|
||||
|
||||
/obj/machinery/mineral/processing_unit_console/Initialize()
|
||||
. = ..()
|
||||
machine = locate(/obj/machinery/mineral/processing_unit, get_step(src, machinedir))
|
||||
if (machine)
|
||||
machine.CONSOLE = src
|
||||
else
|
||||
return INITIALIZE_HINT_QDEL
|
||||
|
||||
/obj/machinery/mineral/processing_unit_console/ui_interact(mob/user)
|
||||
. = ..()
|
||||
if(!machine)
|
||||
return
|
||||
|
||||
var/dat = machine.get_machine_data()
|
||||
|
||||
var/datum/browser/popup = new(user, "processing", "Smelting Console", 300, 500)
|
||||
popup.set_content(dat)
|
||||
popup.open()
|
||||
|
||||
/obj/machinery/mineral/processing_unit_console/Topic(href, href_list)
|
||||
if(..())
|
||||
return
|
||||
usr.set_machine(src)
|
||||
add_fingerprint(usr)
|
||||
|
||||
if(href_list["material"])
|
||||
var/datum/material/new_material = locate(href_list["material"])
|
||||
if(istype(new_material))
|
||||
machine.selected_material = new_material
|
||||
machine.selected_alloy = null
|
||||
|
||||
if(href_list["alloy"])
|
||||
machine.selected_material = null
|
||||
machine.selected_alloy = href_list["alloy"]
|
||||
|
||||
if(href_list["set_on"])
|
||||
machine.on = (href_list["set_on"] == "on")
|
||||
machine.begin_processing()
|
||||
|
||||
updateUsrDialog()
|
||||
return
|
||||
|
||||
/obj/machinery/mineral/processing_unit_console/Destroy()
|
||||
machine = null
|
||||
return ..()
|
||||
|
||||
|
||||
/**********************Mineral processing unit**************************/
|
||||
|
||||
|
||||
/obj/machinery/mineral/processing_unit
|
||||
name = "furnace"
|
||||
icon = 'icons/obj/machines/mining_machines.dmi'
|
||||
icon_state = "furnace"
|
||||
density = TRUE
|
||||
needs_item_input = TRUE
|
||||
var/obj/machinery/mineral/CONSOLE = null
|
||||
var/on = FALSE
|
||||
var/datum/material/selected_material = null
|
||||
var/selected_alloy = null
|
||||
var/datum/techweb/stored_research
|
||||
|
||||
/obj/machinery/mineral/processing_unit/Initialize()
|
||||
. = ..()
|
||||
proximity_monitor = new(src, 1)
|
||||
AddComponent(/datum/component/material_container, list(/datum/material/iron, /datum/material/glass, /datum/material/silver, /datum/material/gold, /datum/material/diamond, /datum/material/plasma, /datum/material/uranium, /datum/material/bananium, /datum/material/titanium, /datum/material/bluespace), INFINITY, TRUE, /obj/item/stack)
|
||||
stored_research = new /datum/techweb/specialized/autounlocking/smelter
|
||||
selected_material = SSmaterials.GetMaterialRef(/datum/material/iron)
|
||||
|
||||
/obj/machinery/mineral/processing_unit/Destroy()
|
||||
CONSOLE = null
|
||||
QDEL_NULL(stored_research)
|
||||
return ..()
|
||||
|
||||
/obj/machinery/mineral/processing_unit/proc/process_ore(obj/item/stack/ore/O)
|
||||
if(QDELETED(O))
|
||||
return
|
||||
var/datum/component/material_container/materials = GetComponent(/datum/component/material_container)
|
||||
var/material_amount = materials.get_item_material_amount(O)
|
||||
if(!materials.has_space(material_amount))
|
||||
unload_mineral(O)
|
||||
else
|
||||
materials.insert_item(O)
|
||||
qdel(O)
|
||||
if(CONSOLE)
|
||||
CONSOLE.updateUsrDialog()
|
||||
|
||||
/obj/machinery/mineral/processing_unit/proc/get_machine_data()
|
||||
var/dat = "<b>Smelter control console</b><br><br>"
|
||||
var/datum/component/material_container/materials = GetComponent(/datum/component/material_container)
|
||||
for(var/datum/material/M in materials.materials)
|
||||
var/amount = materials.materials[M]
|
||||
dat += "<span class=\"res_name\">[M.name]: </span>[amount] cm³"
|
||||
if (selected_material == M)
|
||||
dat += " <i>Smelting</i>"
|
||||
else
|
||||
dat += " <A href='?src=[REF(CONSOLE)];material=[REF(M)]'><b>Not Smelting</b></A> "
|
||||
dat += "<br>"
|
||||
|
||||
dat += "<br><br>"
|
||||
dat += "<b>Smelt Alloys</b><br>"
|
||||
|
||||
for(var/v in stored_research.researched_designs)
|
||||
var/datum/design/D = SSresearch.techweb_design_by_id(v)
|
||||
dat += "<span class=\"res_name\">[D.name] "
|
||||
if (selected_alloy == D.id)
|
||||
dat += " <i>Smelting</i>"
|
||||
else
|
||||
dat += " <A href='?src=[REF(CONSOLE)];alloy=[D.id]'><b>Not Smelting</b></A> "
|
||||
dat += "<br>"
|
||||
|
||||
dat += "<br><br>"
|
||||
//On or off
|
||||
dat += "Machine is currently "
|
||||
if (on)
|
||||
dat += "<A href='?src=[REF(CONSOLE)];set_on=off'>On</A> "
|
||||
else
|
||||
dat += "<A href='?src=[REF(CONSOLE)];set_on=on'>Off</A> "
|
||||
|
||||
return dat
|
||||
|
||||
/obj/machinery/mineral/processing_unit/pickup_item(datum/source, atom/movable/target, atom/oldLoc)
|
||||
if(QDELETED(target))
|
||||
return
|
||||
if(istype(target, /obj/item/stack/ore))
|
||||
process_ore(target)
|
||||
|
||||
/obj/machinery/mineral/processing_unit/process()
|
||||
if(on)
|
||||
if(selected_material)
|
||||
smelt_ore()
|
||||
|
||||
else if(selected_alloy)
|
||||
smelt_alloy()
|
||||
|
||||
|
||||
if(CONSOLE)
|
||||
CONSOLE.updateUsrDialog()
|
||||
else
|
||||
end_processing()
|
||||
|
||||
/obj/machinery/mineral/processing_unit/proc/smelt_ore()
|
||||
var/datum/component/material_container/materials = GetComponent(/datum/component/material_container)
|
||||
var/datum/material/mat = selected_material
|
||||
if(mat)
|
||||
var/sheets_to_remove = (materials.materials[mat] >= (MINERAL_MATERIAL_AMOUNT * SMELT_AMOUNT) ) ? SMELT_AMOUNT : round(materials.materials[mat] / MINERAL_MATERIAL_AMOUNT)
|
||||
if(!sheets_to_remove)
|
||||
on = FALSE
|
||||
else
|
||||
var/out = get_step(src, output_dir)
|
||||
materials.retrieve_sheets(sheets_to_remove, mat, out)
|
||||
|
||||
|
||||
/obj/machinery/mineral/processing_unit/proc/smelt_alloy()
|
||||
var/datum/design/alloy = stored_research.isDesignResearchedID(selected_alloy) //check if it's a valid design
|
||||
if(!alloy)
|
||||
on = FALSE
|
||||
return
|
||||
|
||||
var/amount = can_smelt(alloy)
|
||||
|
||||
if(!amount)
|
||||
on = FALSE
|
||||
return
|
||||
|
||||
var/datum/component/material_container/materials = GetComponent(/datum/component/material_container)
|
||||
materials.use_materials(alloy.materials, amount)
|
||||
|
||||
generate_mineral(alloy.build_path)
|
||||
|
||||
/obj/machinery/mineral/processing_unit/proc/can_smelt(datum/design/D)
|
||||
if(D.make_reagents.len)
|
||||
return FALSE
|
||||
|
||||
var/build_amount = SMELT_AMOUNT
|
||||
|
||||
var/datum/component/material_container/materials = GetComponent(/datum/component/material_container)
|
||||
|
||||
for(var/mat_cat in D.materials)
|
||||
var/required_amount = D.materials[mat_cat]
|
||||
var/amount = materials.materials[mat_cat]
|
||||
|
||||
build_amount = min(build_amount, round(amount / required_amount))
|
||||
|
||||
return build_amount
|
||||
|
||||
/obj/machinery/mineral/processing_unit/proc/generate_mineral(P)
|
||||
var/O = new P(src)
|
||||
unload_mineral(O)
|
||||
|
||||
/obj/machinery/mineral/processing_unit/on_deconstruction()
|
||||
var/datum/component/material_container/materials = GetComponent(/datum/component/material_container)
|
||||
materials.retrieve_all()
|
||||
..()
|
||||
|
||||
#undef SMELT_AMOUNT
|
||||
#define SMELT_AMOUNT 10
|
||||
|
||||
/**********************Mineral processing unit console**************************/
|
||||
|
||||
/obj/machinery/mineral
|
||||
processing_flags = START_PROCESSING_MANUALLY
|
||||
subsystem_type = /datum/controller/subsystem/processing/fastprocess
|
||||
/// The current direction of `input_turf`, in relation to the machine.
|
||||
var/input_dir = NORTH
|
||||
/// The current direction, in relation to the machine, that items will be output to.
|
||||
var/output_dir = SOUTH
|
||||
/// The turf the machines listens to for items to pick up. Calls the `pickup_item()` proc.
|
||||
var/turf/input_turf = null
|
||||
/// Determines if this machine needs to pick up items. Used to avoid registering signals to `/mineral` machines that don't pickup items.
|
||||
var/needs_item_input = FALSE
|
||||
|
||||
/obj/machinery/mineral/Initialize(mapload)
|
||||
. = ..()
|
||||
if(needs_item_input && anchored)
|
||||
register_input_turf()
|
||||
|
||||
/// Gets the turf in the `input_dir` direction adjacent to the machine, and registers signals for ATOM_ENTERED and ATOM_CREATED. Calls the `pickup_item()` proc when it receives these signals.
|
||||
/obj/machinery/mineral/proc/register_input_turf()
|
||||
input_turf = get_step(src, input_dir)
|
||||
if(input_turf) // make sure there is actually a turf
|
||||
RegisterSignal(input_turf, list(COMSIG_ATOM_CREATED, COMSIG_ATOM_ENTERED), .proc/pickup_item)
|
||||
|
||||
/// Unregisters signals that are registered the machine's input turf, if it has one.
|
||||
/obj/machinery/mineral/proc/unregister_input_turf()
|
||||
if(input_turf)
|
||||
UnregisterSignal(input_turf, list(COMSIG_ATOM_ENTERED, COMSIG_ATOM_CREATED))
|
||||
|
||||
/obj/machinery/mineral/Moved()
|
||||
. = ..()
|
||||
if(!needs_item_input || !anchored)
|
||||
return
|
||||
unregister_input_turf()
|
||||
register_input_turf()
|
||||
|
||||
/**
|
||||
Base proc for all `/mineral` subtype machines to use. Place your item pickup behavior in this proc when you override it for your specific machine.
|
||||
|
||||
Called when the COMSIG_ATOM_ENTERED and COMSIG_ATOM_CREATED signals are sent.
|
||||
|
||||
Arguments:
|
||||
* source - the turf that is listening for the signals.
|
||||
* target - the atom that just moved onto the `source` turf.
|
||||
* oldLoc - the old location that `target` was at before moving onto `source`.
|
||||
*/
|
||||
/obj/machinery/mineral/proc/pickup_item(datum/source, atom/movable/target, atom/oldLoc)
|
||||
return
|
||||
|
||||
/// Generic unloading proc. Takes an atom as an argument and forceMove's it to the turf adjacent to this machine in the `output_dir` direction.
|
||||
/obj/machinery/mineral/proc/unload_mineral(atom/movable/S)
|
||||
S.forceMove(drop_location())
|
||||
var/turf/T = get_step(src,output_dir)
|
||||
if(T)
|
||||
S.forceMove(T)
|
||||
|
||||
/obj/machinery/mineral/processing_unit_console
|
||||
name = "production machine console"
|
||||
icon = 'icons/obj/machines/mining_machines.dmi'
|
||||
icon_state = "console"
|
||||
density = TRUE
|
||||
var/obj/machinery/mineral/processing_unit/machine = null
|
||||
var/machinedir = EAST
|
||||
|
||||
/obj/machinery/mineral/processing_unit_console/Initialize()
|
||||
. = ..()
|
||||
machine = locate(/obj/machinery/mineral/processing_unit, get_step(src, machinedir))
|
||||
if (machine)
|
||||
machine.CONSOLE = src
|
||||
else
|
||||
return INITIALIZE_HINT_QDEL
|
||||
|
||||
/obj/machinery/mineral/processing_unit_console/ui_interact(mob/user)
|
||||
. = ..()
|
||||
if(!machine)
|
||||
return
|
||||
|
||||
var/dat = machine.get_machine_data()
|
||||
|
||||
var/datum/browser/popup = new(user, "processing", "Smelting Console", 300, 500)
|
||||
popup.set_content(dat)
|
||||
popup.open()
|
||||
|
||||
/obj/machinery/mineral/processing_unit_console/Topic(href, href_list)
|
||||
if(..())
|
||||
return
|
||||
usr.set_machine(src)
|
||||
add_fingerprint(usr)
|
||||
|
||||
if(href_list["material"])
|
||||
var/datum/material/new_material = locate(href_list["material"])
|
||||
if(istype(new_material))
|
||||
machine.selected_material = new_material
|
||||
machine.selected_alloy = null
|
||||
|
||||
if(href_list["alloy"])
|
||||
machine.selected_material = null
|
||||
machine.selected_alloy = href_list["alloy"]
|
||||
|
||||
if(href_list["set_on"])
|
||||
machine.on = (href_list["set_on"] == "on")
|
||||
machine.begin_processing()
|
||||
|
||||
updateUsrDialog()
|
||||
return
|
||||
|
||||
/obj/machinery/mineral/processing_unit_console/Destroy()
|
||||
machine = null
|
||||
return ..()
|
||||
|
||||
|
||||
/**********************Mineral processing unit**************************/
|
||||
|
||||
|
||||
/obj/machinery/mineral/processing_unit
|
||||
name = "furnace"
|
||||
icon = 'icons/obj/machines/mining_machines.dmi'
|
||||
icon_state = "furnace"
|
||||
density = TRUE
|
||||
needs_item_input = TRUE
|
||||
var/obj/machinery/mineral/CONSOLE = null
|
||||
var/on = FALSE
|
||||
var/datum/material/selected_material = null
|
||||
var/selected_alloy = null
|
||||
var/datum/techweb/stored_research
|
||||
|
||||
/obj/machinery/mineral/processing_unit/Initialize()
|
||||
. = ..()
|
||||
proximity_monitor = new(src, 1)
|
||||
AddComponent(/datum/component/material_container, list(/datum/material/iron, /datum/material/glass, /datum/material/silver, /datum/material/gold, /datum/material/diamond, /datum/material/plasma, /datum/material/uranium, /datum/material/bananium, /datum/material/titanium, /datum/material/bluespace), INFINITY, TRUE, /obj/item/stack)
|
||||
stored_research = new /datum/techweb/specialized/autounlocking/smelter
|
||||
selected_material = SSmaterials.GetMaterialRef(/datum/material/iron)
|
||||
|
||||
/obj/machinery/mineral/processing_unit/Destroy()
|
||||
CONSOLE = null
|
||||
QDEL_NULL(stored_research)
|
||||
return ..()
|
||||
|
||||
/obj/machinery/mineral/processing_unit/proc/process_ore(obj/item/stack/ore/O)
|
||||
if(QDELETED(O))
|
||||
return
|
||||
var/datum/component/material_container/materials = GetComponent(/datum/component/material_container)
|
||||
var/material_amount = materials.get_item_material_amount(O)
|
||||
if(!materials.has_space(material_amount))
|
||||
unload_mineral(O)
|
||||
else
|
||||
materials.insert_item(O)
|
||||
qdel(O)
|
||||
if(CONSOLE)
|
||||
CONSOLE.updateUsrDialog()
|
||||
|
||||
/obj/machinery/mineral/processing_unit/proc/get_machine_data()
|
||||
var/dat = "<b>Smelter control console</b><br><br>"
|
||||
var/datum/component/material_container/materials = GetComponent(/datum/component/material_container)
|
||||
for(var/datum/material/M in materials.materials)
|
||||
var/amount = materials.materials[M]
|
||||
dat += "<span class=\"res_name\">[M.name]: </span>[amount] cm³"
|
||||
if (selected_material == M)
|
||||
dat += " <i>Smelting</i>"
|
||||
else
|
||||
dat += " <A href='?src=[REF(CONSOLE)];material=[REF(M)]'><b>Not Smelting</b></A> "
|
||||
dat += "<br>"
|
||||
|
||||
dat += "<br><br>"
|
||||
dat += "<b>Smelt Alloys</b><br>"
|
||||
|
||||
for(var/v in stored_research.researched_designs)
|
||||
var/datum/design/D = SSresearch.techweb_design_by_id(v)
|
||||
dat += "<span class=\"res_name\">[D.name] "
|
||||
if (selected_alloy == D.id)
|
||||
dat += " <i>Smelting</i>"
|
||||
else
|
||||
dat += " <A href='?src=[REF(CONSOLE)];alloy=[D.id]'><b>Not Smelting</b></A> "
|
||||
dat += "<br>"
|
||||
|
||||
dat += "<br><br>"
|
||||
//On or off
|
||||
dat += "Machine is currently "
|
||||
if (on)
|
||||
dat += "<A href='?src=[REF(CONSOLE)];set_on=off'>On</A> "
|
||||
else
|
||||
dat += "<A href='?src=[REF(CONSOLE)];set_on=on'>Off</A> "
|
||||
|
||||
return dat
|
||||
|
||||
/obj/machinery/mineral/processing_unit/pickup_item(datum/source, atom/movable/target, atom/oldLoc)
|
||||
if(QDELETED(target))
|
||||
return
|
||||
if(istype(target, /obj/item/stack/ore))
|
||||
process_ore(target)
|
||||
|
||||
/obj/machinery/mineral/processing_unit/process()
|
||||
if(on)
|
||||
if(selected_material)
|
||||
smelt_ore()
|
||||
|
||||
else if(selected_alloy)
|
||||
smelt_alloy()
|
||||
|
||||
|
||||
if(CONSOLE)
|
||||
CONSOLE.updateUsrDialog()
|
||||
else
|
||||
end_processing()
|
||||
|
||||
/obj/machinery/mineral/processing_unit/proc/smelt_ore()
|
||||
var/datum/component/material_container/materials = GetComponent(/datum/component/material_container)
|
||||
var/datum/material/mat = selected_material
|
||||
if(mat)
|
||||
var/sheets_to_remove = (materials.materials[mat] >= (MINERAL_MATERIAL_AMOUNT * SMELT_AMOUNT) ) ? SMELT_AMOUNT : round(materials.materials[mat] / MINERAL_MATERIAL_AMOUNT)
|
||||
if(!sheets_to_remove)
|
||||
on = FALSE
|
||||
else
|
||||
var/out = get_step(src, output_dir)
|
||||
materials.retrieve_sheets(sheets_to_remove, mat, out)
|
||||
|
||||
|
||||
/obj/machinery/mineral/processing_unit/proc/smelt_alloy()
|
||||
var/datum/design/alloy = stored_research.isDesignResearchedID(selected_alloy) //check if it's a valid design
|
||||
if(!alloy)
|
||||
on = FALSE
|
||||
return
|
||||
|
||||
var/amount = can_smelt(alloy)
|
||||
|
||||
if(!amount)
|
||||
on = FALSE
|
||||
return
|
||||
|
||||
var/datum/component/material_container/materials = GetComponent(/datum/component/material_container)
|
||||
materials.use_materials(alloy.materials, amount)
|
||||
|
||||
generate_mineral(alloy.build_path)
|
||||
|
||||
/obj/machinery/mineral/processing_unit/proc/can_smelt(datum/design/D)
|
||||
if(D.make_reagents.len)
|
||||
return FALSE
|
||||
|
||||
var/build_amount = SMELT_AMOUNT
|
||||
|
||||
var/datum/component/material_container/materials = GetComponent(/datum/component/material_container)
|
||||
|
||||
for(var/mat_cat in D.materials)
|
||||
var/required_amount = D.materials[mat_cat]
|
||||
var/amount = materials.materials[mat_cat]
|
||||
|
||||
build_amount = min(build_amount, round(amount / required_amount))
|
||||
|
||||
return build_amount
|
||||
|
||||
/obj/machinery/mineral/processing_unit/proc/generate_mineral(P)
|
||||
var/O = new P(src)
|
||||
unload_mineral(O)
|
||||
|
||||
/obj/machinery/mineral/processing_unit/on_deconstruction()
|
||||
var/datum/component/material_container/materials = GetComponent(/datum/component/material_container)
|
||||
materials.retrieve_all()
|
||||
..()
|
||||
|
||||
#undef SMELT_AMOUNT
|
||||
|
||||
@@ -1,133 +1,133 @@
|
||||
/**********************Mineral stacking unit console**************************/
|
||||
|
||||
/obj/machinery/mineral/stacking_unit_console
|
||||
name = "stacking machine console"
|
||||
icon = 'icons/obj/machines/mining_machines.dmi'
|
||||
icon_state = "console"
|
||||
desc = "Controls a stacking machine... in theory."
|
||||
density = FALSE
|
||||
circuit = /obj/item/circuitboard/machine/stacking_unit_console
|
||||
var/obj/machinery/mineral/stacking_machine/machine
|
||||
var/machinedir = SOUTHEAST
|
||||
|
||||
/obj/machinery/mineral/stacking_unit_console/Initialize()
|
||||
. = ..()
|
||||
machine = locate(/obj/machinery/mineral/stacking_machine, get_step(src, machinedir))
|
||||
if (machine)
|
||||
machine.CONSOLE = src
|
||||
|
||||
/obj/machinery/mineral/stacking_unit_console/ui_interact(mob/user)
|
||||
. = ..()
|
||||
|
||||
if(!machine)
|
||||
to_chat(user, "<span class='notice'>[src] is not linked to a machine!</span>")
|
||||
return
|
||||
|
||||
var/obj/item/stack/sheet/s
|
||||
var/dat
|
||||
|
||||
dat += text("<b>Stacking unit console</b><br><br>")
|
||||
|
||||
for(var/O in machine.stack_list)
|
||||
s = machine.stack_list[O]
|
||||
if(s.amount > 0)
|
||||
dat += text("[capitalize(s.name)]: [s.amount] <A href='?src=[REF(src)];release=[s.type]'>Release</A><br>")
|
||||
|
||||
dat += text("<br>Stacking: [machine.stack_amt]<br><br>")
|
||||
|
||||
user << browse(dat, "window=console_stacking_machine")
|
||||
|
||||
/obj/machinery/mineral/stacking_unit_console/multitool_act(mob/living/user, obj/item/I)
|
||||
if(!multitool_check_buffer(user, I))
|
||||
return
|
||||
var/obj/item/multitool/M = I
|
||||
M.buffer = src
|
||||
to_chat(user, "<span class='notice'>You store linkage information in [I]'s buffer.</span>")
|
||||
return TRUE
|
||||
|
||||
/obj/machinery/mineral/stacking_unit_console/Topic(href, href_list)
|
||||
if(..())
|
||||
return
|
||||
usr.set_machine(src)
|
||||
src.add_fingerprint(usr)
|
||||
if(href_list["release"])
|
||||
if(!(text2path(href_list["release"]) in machine.stack_list))
|
||||
return //someone tried to spawn materials by spoofing hrefs
|
||||
var/obj/item/stack/sheet/inp = machine.stack_list[text2path(href_list["release"])]
|
||||
var/obj/item/stack/sheet/out = new inp.type(null, inp.amount)
|
||||
inp.amount = 0
|
||||
machine.unload_mineral(out)
|
||||
|
||||
src.updateUsrDialog()
|
||||
return
|
||||
|
||||
|
||||
/**********************Mineral stacking unit**************************/
|
||||
|
||||
|
||||
/obj/machinery/mineral/stacking_machine
|
||||
name = "stacking machine"
|
||||
icon = 'icons/obj/machines/mining_machines.dmi'
|
||||
icon_state = "stacker"
|
||||
desc = "A machine that automatically stacks acquired materials. Controlled by a nearby console."
|
||||
density = TRUE
|
||||
circuit = /obj/item/circuitboard/machine/stacking_machine
|
||||
input_dir = EAST
|
||||
output_dir = WEST
|
||||
var/obj/machinery/mineral/stacking_unit_console/CONSOLE
|
||||
var/stk_types = list()
|
||||
var/stk_amt = list()
|
||||
var/stack_list[0] //Key: Type. Value: Instance of type.
|
||||
var/stack_amt = 50 //amount to stack before releassing
|
||||
var/datum/component/remote_materials/materials
|
||||
var/force_connect = FALSE
|
||||
|
||||
/obj/machinery/mineral/stacking_machine/Initialize(mapload)
|
||||
. = ..()
|
||||
proximity_monitor = new(src, 1)
|
||||
materials = AddComponent(/datum/component/remote_materials, "stacking", mapload, FALSE, mapload && force_connect)
|
||||
|
||||
/obj/machinery/mineral/stacking_machine/Destroy()
|
||||
CONSOLE = null
|
||||
materials = null
|
||||
return ..()
|
||||
|
||||
/obj/machinery/mineral/stacking_machine/HasProximity(atom/movable/AM)
|
||||
if(QDELETED(AM))
|
||||
return
|
||||
if(istype(AM, /obj/item/stack/sheet) && AM.loc == get_step(src, input_dir))
|
||||
process_sheet(AM)
|
||||
|
||||
/obj/machinery/mineral/stacking_machine/multitool_act(mob/living/user, obj/item/multitool/M)
|
||||
if(istype(M))
|
||||
if(istype(M.buffer, /obj/machinery/mineral/stacking_unit_console))
|
||||
CONSOLE = M.buffer
|
||||
CONSOLE.machine = src
|
||||
to_chat(user, "<span class='notice'>You link [src] to the console in [M]'s buffer.</span>")
|
||||
return TRUE
|
||||
|
||||
/obj/machinery/mineral/stacking_machine/proc/process_sheet(obj/item/stack/sheet/inp)
|
||||
if(QDELETED(inp))
|
||||
return
|
||||
|
||||
// Dump the sheets to the silo if attached
|
||||
if(materials.silo && !materials.on_hold())
|
||||
var/matlist = inp.custom_materials & materials.mat_container.materials
|
||||
if (length(matlist))
|
||||
var/inserted = materials.mat_container.insert_item(inp)
|
||||
materials.silo_log(src, "collected", inserted, "sheets", matlist)
|
||||
qdel(inp)
|
||||
return
|
||||
|
||||
// No silo attached process to internal storage
|
||||
var/key = inp.merge_type
|
||||
var/obj/item/stack/sheet/storage = stack_list[key]
|
||||
if(!storage) //It's the first of this sheet added
|
||||
stack_list[key] = storage = new inp.type(src, 0)
|
||||
storage.amount += inp.amount //Stack the sheets
|
||||
qdel(inp)
|
||||
|
||||
while(storage.amount >= stack_amt) //Get rid of excessive stackage
|
||||
var/obj/item/stack/sheet/out = new inp.type(null, stack_amt)
|
||||
unload_mineral(out)
|
||||
storage.amount -= stack_amt
|
||||
/**********************Mineral stacking unit console**************************/
|
||||
|
||||
/obj/machinery/mineral/stacking_unit_console
|
||||
name = "stacking machine console"
|
||||
icon = 'icons/obj/machines/mining_machines.dmi'
|
||||
icon_state = "console"
|
||||
desc = "Controls a stacking machine... in theory."
|
||||
density = FALSE
|
||||
circuit = /obj/item/circuitboard/machine/stacking_unit_console
|
||||
var/obj/machinery/mineral/stacking_machine/machine
|
||||
var/machinedir = SOUTHEAST
|
||||
|
||||
/obj/machinery/mineral/stacking_unit_console/Initialize()
|
||||
. = ..()
|
||||
machine = locate(/obj/machinery/mineral/stacking_machine, get_step(src, machinedir))
|
||||
if (machine)
|
||||
machine.CONSOLE = src
|
||||
|
||||
/obj/machinery/mineral/stacking_unit_console/ui_interact(mob/user)
|
||||
. = ..()
|
||||
|
||||
if(!machine)
|
||||
to_chat(user, "<span class='notice'>[src] is not linked to a machine!</span>")
|
||||
return
|
||||
|
||||
var/obj/item/stack/sheet/s
|
||||
var/dat
|
||||
|
||||
dat += text("<b>Stacking unit console</b><br><br>")
|
||||
|
||||
for(var/O in machine.stack_list)
|
||||
s = machine.stack_list[O]
|
||||
if(s.amount > 0)
|
||||
dat += text("[capitalize(s.name)]: [s.amount] <A href='?src=[REF(src)];release=[s.type]'>Release</A><br>")
|
||||
|
||||
dat += text("<br>Stacking: [machine.stack_amt]<br><br>")
|
||||
|
||||
user << browse(dat, "window=console_stacking_machine")
|
||||
|
||||
/obj/machinery/mineral/stacking_unit_console/multitool_act(mob/living/user, obj/item/I)
|
||||
if(!multitool_check_buffer(user, I))
|
||||
return
|
||||
var/obj/item/multitool/M = I
|
||||
M.buffer = src
|
||||
to_chat(user, "<span class='notice'>You store linkage information in [I]'s buffer.</span>")
|
||||
return TRUE
|
||||
|
||||
/obj/machinery/mineral/stacking_unit_console/Topic(href, href_list)
|
||||
if(..())
|
||||
return
|
||||
usr.set_machine(src)
|
||||
src.add_fingerprint(usr)
|
||||
if(href_list["release"])
|
||||
if(!(text2path(href_list["release"]) in machine.stack_list))
|
||||
return //someone tried to spawn materials by spoofing hrefs
|
||||
var/obj/item/stack/sheet/inp = machine.stack_list[text2path(href_list["release"])]
|
||||
var/obj/item/stack/sheet/out = new inp.type(null, inp.amount)
|
||||
inp.amount = 0
|
||||
machine.unload_mineral(out)
|
||||
|
||||
src.updateUsrDialog()
|
||||
return
|
||||
|
||||
|
||||
/**********************Mineral stacking unit**************************/
|
||||
|
||||
|
||||
/obj/machinery/mineral/stacking_machine
|
||||
name = "stacking machine"
|
||||
icon = 'icons/obj/machines/mining_machines.dmi'
|
||||
icon_state = "stacker"
|
||||
desc = "A machine that automatically stacks acquired materials. Controlled by a nearby console."
|
||||
density = TRUE
|
||||
circuit = /obj/item/circuitboard/machine/stacking_machine
|
||||
input_dir = EAST
|
||||
output_dir = WEST
|
||||
var/obj/machinery/mineral/stacking_unit_console/CONSOLE
|
||||
var/stk_types = list()
|
||||
var/stk_amt = list()
|
||||
var/stack_list[0] //Key: Type. Value: Instance of type.
|
||||
var/stack_amt = 50 //amount to stack before releassing
|
||||
var/datum/component/remote_materials/materials
|
||||
var/force_connect = FALSE
|
||||
|
||||
/obj/machinery/mineral/stacking_machine/Initialize(mapload)
|
||||
. = ..()
|
||||
proximity_monitor = new(src, 1)
|
||||
materials = AddComponent(/datum/component/remote_materials, "stacking", mapload, FALSE, mapload && force_connect)
|
||||
|
||||
/obj/machinery/mineral/stacking_machine/Destroy()
|
||||
CONSOLE = null
|
||||
materials = null
|
||||
return ..()
|
||||
|
||||
/obj/machinery/mineral/stacking_machine/HasProximity(atom/movable/AM)
|
||||
if(QDELETED(AM))
|
||||
return
|
||||
if(istype(AM, /obj/item/stack/sheet) && AM.loc == get_step(src, input_dir))
|
||||
process_sheet(AM)
|
||||
|
||||
/obj/machinery/mineral/stacking_machine/multitool_act(mob/living/user, obj/item/multitool/M)
|
||||
if(istype(M))
|
||||
if(istype(M.buffer, /obj/machinery/mineral/stacking_unit_console))
|
||||
CONSOLE = M.buffer
|
||||
CONSOLE.machine = src
|
||||
to_chat(user, "<span class='notice'>You link [src] to the console in [M]'s buffer.</span>")
|
||||
return TRUE
|
||||
|
||||
/obj/machinery/mineral/stacking_machine/proc/process_sheet(obj/item/stack/sheet/inp)
|
||||
if(QDELETED(inp))
|
||||
return
|
||||
|
||||
// Dump the sheets to the silo if attached
|
||||
if(materials.silo && !materials.on_hold())
|
||||
var/matlist = inp.custom_materials & materials.mat_container.materials
|
||||
if (length(matlist))
|
||||
var/inserted = materials.mat_container.insert_item(inp)
|
||||
materials.silo_log(src, "collected", inserted, "sheets", matlist)
|
||||
qdel(inp)
|
||||
return
|
||||
|
||||
// No silo attached process to internal storage
|
||||
var/key = inp.merge_type
|
||||
var/obj/item/stack/sheet/storage = stack_list[key]
|
||||
if(!storage) //It's the first of this sheet added
|
||||
stack_list[key] = storage = new inp.type(src, 0)
|
||||
storage.amount += inp.amount //Stack the sheets
|
||||
qdel(inp)
|
||||
|
||||
while(storage.amount >= stack_amt) //Get rid of excessive stackage
|
||||
var/obj/item/stack/sheet/out = new inp.type(null, stack_amt)
|
||||
unload_mineral(out)
|
||||
storage.amount -= stack_amt
|
||||
|
||||
@@ -1,23 +1,23 @@
|
||||
/**********************Unloading unit**************************/
|
||||
|
||||
|
||||
/obj/machinery/mineral/unloading_machine
|
||||
name = "unloading machine"
|
||||
icon = 'icons/obj/machines/mining_machines.dmi'
|
||||
icon_state = "unloader"
|
||||
density = TRUE
|
||||
input_dir = WEST
|
||||
output_dir = EAST
|
||||
needs_item_input = TRUE
|
||||
processing_flags = START_PROCESSING_MANUALLY
|
||||
|
||||
/obj/machinery/mineral/unloading_machine/pickup_item(datum/source, atom/movable/target, atom/oldLoc)
|
||||
if(QDELETED(target))
|
||||
return
|
||||
if(istype(target, /obj/structure/ore_box))
|
||||
var/obj/structure/ore_box/box = target
|
||||
for(var/obj/item/stack/ore/O in box)
|
||||
unload_mineral(O)
|
||||
else if(istype(target, /obj/item/stack/ore))
|
||||
var/obj/item/stack/ore/O = target
|
||||
unload_mineral(O)
|
||||
/**********************Unloading unit**************************/
|
||||
|
||||
|
||||
/obj/machinery/mineral/unloading_machine
|
||||
name = "unloading machine"
|
||||
icon = 'icons/obj/machines/mining_machines.dmi'
|
||||
icon_state = "unloader"
|
||||
density = TRUE
|
||||
input_dir = WEST
|
||||
output_dir = EAST
|
||||
needs_item_input = TRUE
|
||||
processing_flags = START_PROCESSING_MANUALLY
|
||||
|
||||
/obj/machinery/mineral/unloading_machine/pickup_item(datum/source, atom/movable/target, atom/oldLoc)
|
||||
if(QDELETED(target))
|
||||
return
|
||||
if(istype(target, /obj/structure/ore_box))
|
||||
var/obj/structure/ore_box/box = target
|
||||
for(var/obj/item/stack/ore/O in box)
|
||||
unload_mineral(O)
|
||||
else if(istype(target, /obj/item/stack/ore))
|
||||
var/obj/item/stack/ore/O = target
|
||||
unload_mineral(O)
|
||||
|
||||
+148
-148
@@ -1,148 +1,148 @@
|
||||
/**********************Mint**************************/
|
||||
|
||||
|
||||
/obj/machinery/mineral/mint
|
||||
name = "coin press"
|
||||
icon = 'icons/obj/economy.dmi'
|
||||
icon_state = "coinpress0"
|
||||
density = TRUE
|
||||
input_dir = EAST
|
||||
ui_x = 300
|
||||
ui_y = 250
|
||||
needs_item_input = TRUE
|
||||
var/obj/item/storage/bag/money/bag_to_use
|
||||
var/produced_coins = 0 // how many coins the machine has made in it's last cycle
|
||||
var/processing = FALSE
|
||||
var/chosen = /datum/material/iron //which material will be used to make coins
|
||||
|
||||
|
||||
/obj/machinery/mineral/mint/Initialize()
|
||||
. = ..()
|
||||
AddComponent(/datum/component/material_container, list(
|
||||
/datum/material/iron,
|
||||
/datum/material/plasma,
|
||||
/datum/material/silver,
|
||||
/datum/material/gold,
|
||||
/datum/material/uranium,
|
||||
/datum/material/titanium,
|
||||
/datum/material/diamond,
|
||||
/datum/material/bananium,
|
||||
/datum/material/adamantine,
|
||||
/datum/material/mythril,
|
||||
/datum/material/plastic,
|
||||
/datum/material/runite
|
||||
), MINERAL_MATERIAL_AMOUNT * 75, FALSE, /obj/item/stack)
|
||||
chosen = SSmaterials.GetMaterialRef(chosen)
|
||||
|
||||
|
||||
/obj/machinery/mineral/mint/pickup_item(datum/source, atom/movable/target, atom/oldLoc)
|
||||
if(QDELETED(target))
|
||||
return
|
||||
if(!istype(target, /obj/item/stack))
|
||||
return
|
||||
|
||||
var/datum/component/material_container/materials = GetComponent(/datum/component/material_container)
|
||||
var/obj/item/stack/S = target
|
||||
|
||||
if(materials.insert_item(S))
|
||||
qdel(S)
|
||||
|
||||
/obj/machinery/mineral/mint/process()
|
||||
if(processing)
|
||||
var/datum/component/material_container/materials = GetComponent(/datum/component/material_container)
|
||||
var/datum/material/M = chosen
|
||||
|
||||
if(!M)
|
||||
processing = FALSE
|
||||
icon_state = "coinpress0"
|
||||
return
|
||||
|
||||
icon_state = "coinpress1"
|
||||
var/coin_mat = MINERAL_MATERIAL_AMOUNT
|
||||
|
||||
for(var/sheets in 1 to 2)
|
||||
if(materials.use_amount_mat(coin_mat, chosen))
|
||||
for(var/coin_to_make in 1 to 5)
|
||||
create_coins()
|
||||
produced_coins++
|
||||
CHECK_TICK
|
||||
else
|
||||
var/found_new = FALSE
|
||||
for(var/datum/material/inserted_material in materials.materials)
|
||||
var/amount = materials.get_material_amount(inserted_material)
|
||||
|
||||
if(amount)
|
||||
chosen = inserted_material
|
||||
found_new = TRUE
|
||||
|
||||
if(!found_new)
|
||||
processing = FALSE
|
||||
else
|
||||
end_processing()
|
||||
icon_state = "coinpress0"
|
||||
|
||||
/obj/machinery/mineral/mint/ui_interact(mob/user, ui_key = "main", datum/tgui/ui = null, force_open = FALSE, \
|
||||
datum/tgui/master_ui = null, datum/ui_state/state = GLOB.default_state)
|
||||
ui = SStgui.try_update_ui(user, src, ui_key, ui, force_open)
|
||||
if(!ui)
|
||||
ui = new(user, src, ui_key, "Mint", name, ui_x, ui_y, master_ui, state)
|
||||
ui.open()
|
||||
|
||||
/obj/machinery/mineral/mint/ui_data()
|
||||
var/list/data = list()
|
||||
data["inserted_materials"] = list()
|
||||
data["chosen_material"] = null
|
||||
|
||||
var/datum/component/material_container/materials = GetComponent(/datum/component/material_container)
|
||||
for(var/datum/material/inserted_material in materials.materials)
|
||||
var/amount = materials.get_material_amount(inserted_material)
|
||||
if(!amount)
|
||||
continue
|
||||
data["inserted_materials"] += list(list(
|
||||
"material" = inserted_material.name,
|
||||
"amount" = amount,
|
||||
))
|
||||
if(chosen == inserted_material)
|
||||
data["chosen_material"] = inserted_material.name
|
||||
|
||||
data["produced_coins"] = produced_coins
|
||||
data["processing"] = processing
|
||||
|
||||
return data;
|
||||
|
||||
/obj/machinery/mineral/mint/ui_act(action, params, datum/tgui/ui)
|
||||
. = ..()
|
||||
if(.)
|
||||
return
|
||||
if(action == "startpress")
|
||||
if (!processing)
|
||||
if(produced_coins > 0)
|
||||
log_econ("[produced_coins] coins were created by [src] in the last cycle.")
|
||||
produced_coins = 0
|
||||
processing = TRUE
|
||||
begin_processing()
|
||||
return TRUE
|
||||
if (action == "stoppress")
|
||||
processing = FALSE
|
||||
end_processing()
|
||||
return TRUE
|
||||
if (action == "changematerial")
|
||||
var/datum/component/material_container/materials = GetComponent(/datum/component/material_container)
|
||||
for(var/datum/material/mat in materials.materials)
|
||||
if (params["material_name"] == mat.name)
|
||||
chosen = mat
|
||||
return TRUE
|
||||
|
||||
/obj/machinery/mineral/mint/proc/create_coins()
|
||||
var/turf/T = get_step(src,output_dir)
|
||||
var/temp_list = list()
|
||||
temp_list[chosen] = 400
|
||||
if(T)
|
||||
var/obj/item/O = new /obj/item/coin(src)
|
||||
O.set_custom_materials(temp_list)
|
||||
if(QDELETED(bag_to_use) || (bag_to_use.loc != T) || !SEND_SIGNAL(bag_to_use, COMSIG_TRY_STORAGE_INSERT, O, null, TRUE)) //important to send the signal so we don't overfill the bag.
|
||||
bag_to_use = new(src) //make a new bag if we can't find or use the old one.
|
||||
unload_mineral(bag_to_use) //just forcemove memes.
|
||||
O.forceMove(bag_to_use) //don't bother sending the signal, the new bag is empty and all that.
|
||||
|
||||
SSblackbox.record_feedback("amount", "coins_minted", 1)
|
||||
/**********************Mint**************************/
|
||||
|
||||
|
||||
/obj/machinery/mineral/mint
|
||||
name = "coin press"
|
||||
icon = 'icons/obj/economy.dmi'
|
||||
icon_state = "coinpress0"
|
||||
density = TRUE
|
||||
input_dir = EAST
|
||||
ui_x = 300
|
||||
ui_y = 250
|
||||
needs_item_input = TRUE
|
||||
var/obj/item/storage/bag/money/bag_to_use
|
||||
var/produced_coins = 0 // how many coins the machine has made in it's last cycle
|
||||
var/processing = FALSE
|
||||
var/chosen = /datum/material/iron //which material will be used to make coins
|
||||
|
||||
|
||||
/obj/machinery/mineral/mint/Initialize()
|
||||
. = ..()
|
||||
AddComponent(/datum/component/material_container, list(
|
||||
/datum/material/iron,
|
||||
/datum/material/plasma,
|
||||
/datum/material/silver,
|
||||
/datum/material/gold,
|
||||
/datum/material/uranium,
|
||||
/datum/material/titanium,
|
||||
/datum/material/diamond,
|
||||
/datum/material/bananium,
|
||||
/datum/material/adamantine,
|
||||
/datum/material/mythril,
|
||||
/datum/material/plastic,
|
||||
/datum/material/runite
|
||||
), MINERAL_MATERIAL_AMOUNT * 75, FALSE, /obj/item/stack)
|
||||
chosen = SSmaterials.GetMaterialRef(chosen)
|
||||
|
||||
|
||||
/obj/machinery/mineral/mint/pickup_item(datum/source, atom/movable/target, atom/oldLoc)
|
||||
if(QDELETED(target))
|
||||
return
|
||||
if(!istype(target, /obj/item/stack))
|
||||
return
|
||||
|
||||
var/datum/component/material_container/materials = GetComponent(/datum/component/material_container)
|
||||
var/obj/item/stack/S = target
|
||||
|
||||
if(materials.insert_item(S))
|
||||
qdel(S)
|
||||
|
||||
/obj/machinery/mineral/mint/process()
|
||||
if(processing)
|
||||
var/datum/component/material_container/materials = GetComponent(/datum/component/material_container)
|
||||
var/datum/material/M = chosen
|
||||
|
||||
if(!M)
|
||||
processing = FALSE
|
||||
icon_state = "coinpress0"
|
||||
return
|
||||
|
||||
icon_state = "coinpress1"
|
||||
var/coin_mat = MINERAL_MATERIAL_AMOUNT
|
||||
|
||||
for(var/sheets in 1 to 2)
|
||||
if(materials.use_amount_mat(coin_mat, chosen))
|
||||
for(var/coin_to_make in 1 to 5)
|
||||
create_coins()
|
||||
produced_coins++
|
||||
CHECK_TICK
|
||||
else
|
||||
var/found_new = FALSE
|
||||
for(var/datum/material/inserted_material in materials.materials)
|
||||
var/amount = materials.get_material_amount(inserted_material)
|
||||
|
||||
if(amount)
|
||||
chosen = inserted_material
|
||||
found_new = TRUE
|
||||
|
||||
if(!found_new)
|
||||
processing = FALSE
|
||||
else
|
||||
end_processing()
|
||||
icon_state = "coinpress0"
|
||||
|
||||
/obj/machinery/mineral/mint/ui_interact(mob/user, ui_key = "main", datum/tgui/ui = null, force_open = FALSE, \
|
||||
datum/tgui/master_ui = null, datum/ui_state/state = GLOB.default_state)
|
||||
ui = SStgui.try_update_ui(user, src, ui_key, ui, force_open)
|
||||
if(!ui)
|
||||
ui = new(user, src, ui_key, "Mint", name, ui_x, ui_y, master_ui, state)
|
||||
ui.open()
|
||||
|
||||
/obj/machinery/mineral/mint/ui_data()
|
||||
var/list/data = list()
|
||||
data["inserted_materials"] = list()
|
||||
data["chosen_material"] = null
|
||||
|
||||
var/datum/component/material_container/materials = GetComponent(/datum/component/material_container)
|
||||
for(var/datum/material/inserted_material in materials.materials)
|
||||
var/amount = materials.get_material_amount(inserted_material)
|
||||
if(!amount)
|
||||
continue
|
||||
data["inserted_materials"] += list(list(
|
||||
"material" = inserted_material.name,
|
||||
"amount" = amount,
|
||||
))
|
||||
if(chosen == inserted_material)
|
||||
data["chosen_material"] = inserted_material.name
|
||||
|
||||
data["produced_coins"] = produced_coins
|
||||
data["processing"] = processing
|
||||
|
||||
return data;
|
||||
|
||||
/obj/machinery/mineral/mint/ui_act(action, params, datum/tgui/ui)
|
||||
. = ..()
|
||||
if(.)
|
||||
return
|
||||
if(action == "startpress")
|
||||
if (!processing)
|
||||
if(produced_coins > 0)
|
||||
log_econ("[produced_coins] coins were created by [src] in the last cycle.")
|
||||
produced_coins = 0
|
||||
processing = TRUE
|
||||
begin_processing()
|
||||
return TRUE
|
||||
if (action == "stoppress")
|
||||
processing = FALSE
|
||||
end_processing()
|
||||
return TRUE
|
||||
if (action == "changematerial")
|
||||
var/datum/component/material_container/materials = GetComponent(/datum/component/material_container)
|
||||
for(var/datum/material/mat in materials.materials)
|
||||
if (params["material_name"] == mat.name)
|
||||
chosen = mat
|
||||
return TRUE
|
||||
|
||||
/obj/machinery/mineral/mint/proc/create_coins()
|
||||
var/turf/T = get_step(src,output_dir)
|
||||
var/temp_list = list()
|
||||
temp_list[chosen] = 400
|
||||
if(T)
|
||||
var/obj/item/O = new /obj/item/coin(src)
|
||||
O.set_custom_materials(temp_list)
|
||||
if(QDELETED(bag_to_use) || (bag_to_use.loc != T) || !SEND_SIGNAL(bag_to_use, COMSIG_TRY_STORAGE_INSERT, O, null, TRUE)) //important to send the signal so we don't overfill the bag.
|
||||
bag_to_use = new(src) //make a new bag if we can't find or use the old one.
|
||||
unload_mineral(bag_to_use) //just forcemove memes.
|
||||
O.forceMove(bag_to_use) //don't bother sending the signal, the new bag is empty and all that.
|
||||
|
||||
SSblackbox.record_feedback("amount", "coins_minted", 1)
|
||||
|
||||
@@ -1,29 +1,29 @@
|
||||
/*****************************Money bag********************************/
|
||||
|
||||
/obj/item/storage/bag/money
|
||||
name = "money bag"
|
||||
icon_state = "moneybag"
|
||||
force = 10
|
||||
throwforce = 0
|
||||
resistance_flags = FLAMMABLE
|
||||
max_integrity = 100
|
||||
w_class = WEIGHT_CLASS_BULKY
|
||||
|
||||
/obj/item/storage/bag/money/Initialize()
|
||||
. = ..()
|
||||
if(prob(20))
|
||||
icon_state = "moneybagalt"
|
||||
var/datum/component/storage/STR = GetComponent(/datum/component/storage)
|
||||
STR.max_w_class = WEIGHT_CLASS_NORMAL
|
||||
STR.max_items = 40
|
||||
STR.max_combined_w_class = 40
|
||||
STR.set_holdable(list(/obj/item/coin, /obj/item/stack/spacecash, /obj/item/holochip))
|
||||
|
||||
/obj/item/storage/bag/money/vault/PopulateContents()
|
||||
new /obj/item/coin/silver(src)
|
||||
new /obj/item/coin/silver(src)
|
||||
new /obj/item/coin/silver(src)
|
||||
new /obj/item/coin/silver(src)
|
||||
new /obj/item/coin/gold(src)
|
||||
new /obj/item/coin/gold(src)
|
||||
new /obj/item/coin/adamantine(src)
|
||||
/*****************************Money bag********************************/
|
||||
|
||||
/obj/item/storage/bag/money
|
||||
name = "money bag"
|
||||
icon_state = "moneybag"
|
||||
force = 10
|
||||
throwforce = 0
|
||||
resistance_flags = FLAMMABLE
|
||||
max_integrity = 100
|
||||
w_class = WEIGHT_CLASS_BULKY
|
||||
|
||||
/obj/item/storage/bag/money/Initialize()
|
||||
. = ..()
|
||||
if(prob(20))
|
||||
icon_state = "moneybagalt"
|
||||
var/datum/component/storage/STR = GetComponent(/datum/component/storage)
|
||||
STR.max_w_class = WEIGHT_CLASS_NORMAL
|
||||
STR.max_items = 40
|
||||
STR.max_combined_w_class = 40
|
||||
STR.set_holdable(list(/obj/item/coin, /obj/item/stack/spacecash, /obj/item/holochip))
|
||||
|
||||
/obj/item/storage/bag/money/vault/PopulateContents()
|
||||
new /obj/item/coin/silver(src)
|
||||
new /obj/item/coin/silver(src)
|
||||
new /obj/item/coin/silver(src)
|
||||
new /obj/item/coin/silver(src)
|
||||
new /obj/item/coin/gold(src)
|
||||
new /obj/item/coin/gold(src)
|
||||
new /obj/item/coin/adamantine(src)
|
||||
|
||||
+485
-485
@@ -1,485 +1,485 @@
|
||||
|
||||
#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"
|
||||
inhand_icon_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
|
||||
var/mine_experience = 5 //How much experience do you get for mining this ore?
|
||||
novariants = TRUE // Ore stacks handle their icon updates themselves to keep the illusion that there's more going
|
||||
var/list/stack_overlays
|
||||
var/scan_state = "" //Used by mineral turfs for their scan overlay.
|
||||
var/spreadChance = 0 //Also used by mineral turfs for spreading veins
|
||||
|
||||
/obj/item/stack/ore/update_overlays()
|
||||
. = ..()
|
||||
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.
|
||||
if (LAZYLEN(stack_overlays)-difference <= 0)
|
||||
stack_overlays = null
|
||||
else
|
||||
stack_overlays.len += difference
|
||||
else if(difference > 0) //amount > stack_overlays, add some.
|
||||
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)
|
||||
. += 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"
|
||||
inhand_icon_state = "Uranium ore"
|
||||
singular_name = "uranium ore chunk"
|
||||
points = 30
|
||||
material_flags = MATERIAL_NO_EFFECTS
|
||||
custom_materials = list(/datum/material/uranium=MINERAL_MATERIAL_AMOUNT)
|
||||
refined_type = /obj/item/stack/sheet/mineral/uranium
|
||||
mine_experience = 6
|
||||
scan_state = "rock_Uranium"
|
||||
spreadChance = 5
|
||||
|
||||
/obj/item/stack/ore/iron
|
||||
name = "iron ore"
|
||||
icon_state = "Iron ore"
|
||||
inhand_icon_state = "Iron ore"
|
||||
singular_name = "iron ore chunk"
|
||||
points = 1
|
||||
custom_materials = list(/datum/material/iron=MINERAL_MATERIAL_AMOUNT)
|
||||
refined_type = /obj/item/stack/sheet/metal
|
||||
mine_experience = 1
|
||||
scan_state = "rock_Iron"
|
||||
spreadChance = 20
|
||||
|
||||
/obj/item/stack/ore/glass
|
||||
name = "sand pile"
|
||||
icon_state = "Glass ore"
|
||||
inhand_icon_state = "Glass ore"
|
||||
singular_name = "sand pile"
|
||||
points = 1
|
||||
custom_materials = list(/datum/material/glass=MINERAL_MATERIAL_AMOUNT)
|
||||
refined_type = /obj/item/stack/sheet/glass
|
||||
w_class = WEIGHT_CLASS_TINY
|
||||
mine_experience = 0 //its sand
|
||||
|
||||
GLOBAL_LIST_INIT(sand_recipes, list(\
|
||||
new /datum/stack_recipe("sandstone", /obj/item/stack/sheet/mineral/sandstone, 1, 1, 50),\
|
||||
new /datum/stack_recipe("aesthetic volcanic floor tile", /obj/item/stack/tile/basalt, 2, 1, 50)\
|
||||
))
|
||||
|
||||
/obj/item/stack/ore/glass/get_main_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 class='danger'>[C]'s eye protection blocks the sand!</span>", "<span class='warning'>Your eye protection blocks the sand!</span>")
|
||||
return
|
||||
C.adjust_blurriness(6)
|
||||
C.adjustStaminaLoss(15)//the pain from your eyes burning does stamina damage
|
||||
C.confused += 5
|
||||
to_chat(C, "<span class='userdanger'>\The [src] gets into your eyes! The pain, it burns!</span>")
|
||||
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"
|
||||
inhand_icon_state = "volcanic_sand"
|
||||
singular_name = "volcanic ash pile"
|
||||
mine_experience = 0
|
||||
|
||||
/obj/item/stack/ore/plasma
|
||||
name = "plasma ore"
|
||||
icon_state = "Plasma ore"
|
||||
inhand_icon_state = "Plasma ore"
|
||||
singular_name = "plasma ore chunk"
|
||||
points = 15
|
||||
custom_materials = list(/datum/material/plasma=MINERAL_MATERIAL_AMOUNT)
|
||||
refined_type = /obj/item/stack/sheet/mineral/plasma
|
||||
mine_experience = 5
|
||||
scan_state = "rock_Plasma"
|
||||
spreadChance = 8
|
||||
|
||||
/obj/item/stack/ore/plasma/welder_act(mob/living/user, obj/item/I)
|
||||
to_chat(user, "<span class='warning'>You can't hit a high enough temperature to smelt [src] properly!</span>")
|
||||
return TRUE
|
||||
|
||||
|
||||
/obj/item/stack/ore/silver
|
||||
name = "silver ore"
|
||||
icon_state = "Silver ore"
|
||||
inhand_icon_state = "Silver ore"
|
||||
singular_name = "silver ore chunk"
|
||||
points = 16
|
||||
mine_experience = 3
|
||||
custom_materials = list(/datum/material/silver=MINERAL_MATERIAL_AMOUNT)
|
||||
refined_type = /obj/item/stack/sheet/mineral/silver
|
||||
scan_state = "rock_Silver"
|
||||
spreadChance = 5
|
||||
|
||||
/obj/item/stack/ore/gold
|
||||
name = "gold ore"
|
||||
icon_state = "Gold ore"
|
||||
inhand_icon_state = "Gold ore"
|
||||
singular_name = "gold ore chunk"
|
||||
points = 18
|
||||
mine_experience = 5
|
||||
custom_materials = list(/datum/material/gold=MINERAL_MATERIAL_AMOUNT)
|
||||
refined_type = /obj/item/stack/sheet/mineral/gold
|
||||
scan_state = "rock_Gold"
|
||||
spreadChance = 5
|
||||
|
||||
/obj/item/stack/ore/diamond
|
||||
name = "diamond ore"
|
||||
icon_state = "Diamond ore"
|
||||
inhand_icon_state = "Diamond ore"
|
||||
singular_name = "diamond ore chunk"
|
||||
points = 50
|
||||
custom_materials = list(/datum/material/diamond=MINERAL_MATERIAL_AMOUNT)
|
||||
refined_type = /obj/item/stack/sheet/mineral/diamond
|
||||
mine_experience = 10
|
||||
scan_state = "rock_Diamond"
|
||||
|
||||
/obj/item/stack/ore/bananium
|
||||
name = "bananium ore"
|
||||
icon_state = "Bananium ore"
|
||||
inhand_icon_state = "Bananium ore"
|
||||
singular_name = "bananium ore chunk"
|
||||
points = 60
|
||||
custom_materials = list(/datum/material/bananium=MINERAL_MATERIAL_AMOUNT)
|
||||
refined_type = /obj/item/stack/sheet/mineral/bananium
|
||||
mine_experience = 15
|
||||
scan_state = "rock_Bananium"
|
||||
|
||||
/obj/item/stack/ore/titanium
|
||||
name = "titanium ore"
|
||||
icon_state = "Titanium ore"
|
||||
inhand_icon_state = "Titanium ore"
|
||||
singular_name = "titanium ore chunk"
|
||||
points = 50
|
||||
custom_materials = list(/datum/material/titanium=MINERAL_MATERIAL_AMOUNT)
|
||||
refined_type = /obj/item/stack/sheet/mineral/titanium
|
||||
mine_experience = 3
|
||||
scan_state = "rock_Titanium"
|
||||
spreadChance = 5
|
||||
|
||||
/obj/item/stack/ore/slag
|
||||
name = "slag"
|
||||
desc = "Completely useless."
|
||||
icon_state = "slag"
|
||||
inhand_icon_state = "slag"
|
||||
singular_name = "slag chunk"
|
||||
|
||||
/obj/item/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"
|
||||
inhand_icon_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/gibtonite/ComponentInitialize()
|
||||
. = ..()
|
||||
AddComponent(/datum/component/two_handed, require_twohands=TRUE)
|
||||
|
||||
/obj/item/gibtonite/Destroy()
|
||||
qdel(wires)
|
||||
wires = null
|
||||
return ..()
|
||||
|
||||
/obj/item/gibtonite/attackby(obj/item/I, mob/user, params)
|
||||
if(!wires && istype(I, /obj/item/assembly/igniter))
|
||||
user.visible_message("<span class='notice'>[user] attaches [I] to [src].</span>", "<span class='notice'>You attach [I] to [src].</span>")
|
||||
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("<span class='notice'>The chain reaction stopped! ...The ore's quality looks diminished.</span>", "<span class='notice'>You stopped the chain reaction. ...The ore's quality looks diminished.</span>")
|
||||
icon_state = "Gibtonite ore"
|
||||
quality = GIBTONITE_QUALITY_LOW
|
||||
return
|
||||
..()
|
||||
|
||||
/obj/item/gibtonite/attack_self(user)
|
||||
if(wires)
|
||||
wires.interact(user)
|
||||
else
|
||||
..()
|
||||
|
||||
/obj/item/gibtonite/bullet_act(obj/projectile/P)
|
||||
GibtoniteReaction(P.firer)
|
||||
. = ..()
|
||||
|
||||
/obj/item/gibtonite/ex_act()
|
||||
GibtoniteReaction(null, 1)
|
||||
|
||||
/obj/item/gibtonite/proc/GibtoniteReaction(mob/user, triggered_by = 0)
|
||||
if(!primed)
|
||||
primed = TRUE
|
||||
playsound(src,'sound/effects/hit_on_shattered_glass.ogg',50,TRUE)
|
||||
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 class='warning'>[user] strikes \the [src], causing a chain reaction!</span>", "<span class='danger'>You strike \the [src], causing a chain reaction.</span>")
|
||||
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/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"
|
||||
flags_1 = CONDUCT_1
|
||||
force = 1
|
||||
throwforce = 2
|
||||
w_class = WEIGHT_CLASS_TINY
|
||||
custom_materials = list(/datum/material/iron = 400)
|
||||
material_flags = MATERIAL_ADD_PREFIX | MATERIAL_COLOR | MATERIAL_AFFECT_STATISTICS
|
||||
var/string_attached
|
||||
var/list/sideslist = list("heads","tails")
|
||||
var/cooldown = 0
|
||||
var/value
|
||||
var/coinflip
|
||||
item_flags = NO_MAT_REDEMPTION //You know, it's kind of a problem that money is worth more extrinsicly than intrinsically in this universe.
|
||||
|
||||
/obj/item/coin/Initialize()
|
||||
. = ..()
|
||||
coinflip = pick(sideslist)
|
||||
icon_state = "coin_[coinflip]"
|
||||
pixel_x = rand(0,16)-8
|
||||
pixel_y = rand(0,8)-8
|
||||
|
||||
/obj/item/coin/set_custom_materials(var/list/materials, multiplier = 1)
|
||||
. = ..()
|
||||
value = 0
|
||||
for(var/i in custom_materials)
|
||||
var/datum/material/M = i
|
||||
value += M.value_per_unit * custom_materials[M]
|
||||
|
||||
/obj/item/coin/get_item_credit_value()
|
||||
return value
|
||||
|
||||
/obj/item/coin/suicide_act(mob/living/user)
|
||||
user.visible_message("<span class='suicide'>[user] contemplates suicide with \the [src]!</span>")
|
||||
if (!attack_self(user))
|
||||
user.visible_message("<span class='suicide'>[user] couldn't flip \the [src]!</span>")
|
||||
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 class='suicide'>\the [src] lands on [coinflip]! [user] promptly falls over, dead!</span>")
|
||||
user.adjustOxyLoss(200)
|
||||
user.death(0)
|
||||
user.set_suicide(TRUE)
|
||||
user.suicide_log()
|
||||
else
|
||||
user.visible_message("<span class='suicide'>\the [src] lands on [coinflip]! [user] keeps on living!</span>")
|
||||
|
||||
/obj/item/coin/examine(mob/user)
|
||||
. = ..()
|
||||
. += "<span class='info'>It's worth [value] credit\s.</span>"
|
||||
|
||||
/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 class='warning'>There already is a string attached to this coin!</span>")
|
||||
return
|
||||
|
||||
if (CC.use(1))
|
||||
add_overlay("coin_string_overlay")
|
||||
string_attached = 1
|
||||
to_chat(user, "<span class='notice'>You attach a string to the coin.</span>")
|
||||
else
|
||||
to_chat(user, "<span class='warning'>You need one length of cable to attach a string to the coin!</span>")
|
||||
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 class='notice'>You detach the string from the coin.</span>")
|
||||
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 class='warning'>The coin won't flip very well with something attached!</span>" )
|
||||
return FALSE//do not flip the coin
|
||||
cooldown = world.time + 15
|
||||
flick("coin_[coinflip]_flip", src)
|
||||
coinflip = pick(sideslist)
|
||||
icon_state = "coin_[coinflip]"
|
||||
playsound(user.loc, 'sound/items/coinflip.ogg', 50, TRUE)
|
||||
var/oldloc = loc
|
||||
sleep(15)
|
||||
if(loc == oldloc && user && !user.incapacitated())
|
||||
user.visible_message("<span class='notice'>[user] flips [src]. It lands on [coinflip].</span>", \
|
||||
"<span class='notice'>You flip [src]. It lands on [coinflip].</span>", \
|
||||
"<span class='hear'>You hear the clattering of loose change.</span>")
|
||||
return TRUE//did the coin flip? useful for suicide_act
|
||||
|
||||
/obj/item/coin/gold
|
||||
custom_materials = list(/datum/material/gold = 400)
|
||||
|
||||
/obj/item/coin/silver
|
||||
custom_materials = list(/datum/material/silver = 400)
|
||||
|
||||
/obj/item/coin/diamond
|
||||
custom_materials = list(/datum/material/diamond = 400)
|
||||
|
||||
/obj/item/coin/plasma
|
||||
custom_materials = list(/datum/material/plasma = 400)
|
||||
|
||||
/obj/item/coin/uranium
|
||||
custom_materials = list(/datum/material/uranium = 400)
|
||||
|
||||
/obj/item/coin/titanium
|
||||
custom_materials = list(/datum/material/titanium = 400)
|
||||
|
||||
/obj/item/coin/bananium
|
||||
custom_materials = list(/datum/material/bananium = 400)
|
||||
|
||||
/obj/item/coin/adamantine
|
||||
custom_materials = list(/datum/material/adamantine = 400)
|
||||
|
||||
/obj/item/coin/mythril
|
||||
custom_materials = list(/datum/material/mythril = 400)
|
||||
|
||||
/obj/item/coin/plastic
|
||||
custom_materials = list(/datum/material/plastic = 400)
|
||||
|
||||
/obj/item/coin/runite
|
||||
custom_materials = list(/datum/material/runite = 400)
|
||||
|
||||
/obj/item/coin/twoheaded
|
||||
desc = "Hey, this coin's the same on both sides!"
|
||||
sideslist = list("heads")
|
||||
|
||||
/obj/item/coin/antagtoken
|
||||
name = "antag token"
|
||||
desc = "A novelty coin that helps the heart know what hard evidence cannot prove."
|
||||
icon_state = "coin_valid"
|
||||
custom_materials = list(/datum/material/plastic = 400)
|
||||
sideslist = list("valid", "salad")
|
||||
material_flags = NONE
|
||||
|
||||
/obj/item/coin/iron
|
||||
|
||||
#undef ORESTACK_OVERLAYS_MAX
|
||||
|
||||
#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"
|
||||
inhand_icon_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
|
||||
var/mine_experience = 5 //How much experience do you get for mining this ore?
|
||||
novariants = TRUE // Ore stacks handle their icon updates themselves to keep the illusion that there's more going
|
||||
var/list/stack_overlays
|
||||
var/scan_state = "" //Used by mineral turfs for their scan overlay.
|
||||
var/spreadChance = 0 //Also used by mineral turfs for spreading veins
|
||||
|
||||
/obj/item/stack/ore/update_overlays()
|
||||
. = ..()
|
||||
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.
|
||||
if (LAZYLEN(stack_overlays)-difference <= 0)
|
||||
stack_overlays = null
|
||||
else
|
||||
stack_overlays.len += difference
|
||||
else if(difference > 0) //amount > stack_overlays, add some.
|
||||
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)
|
||||
. += 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"
|
||||
inhand_icon_state = "Uranium ore"
|
||||
singular_name = "uranium ore chunk"
|
||||
points = 30
|
||||
material_flags = MATERIAL_NO_EFFECTS
|
||||
custom_materials = list(/datum/material/uranium=MINERAL_MATERIAL_AMOUNT)
|
||||
refined_type = /obj/item/stack/sheet/mineral/uranium
|
||||
mine_experience = 6
|
||||
scan_state = "rock_Uranium"
|
||||
spreadChance = 5
|
||||
|
||||
/obj/item/stack/ore/iron
|
||||
name = "iron ore"
|
||||
icon_state = "Iron ore"
|
||||
inhand_icon_state = "Iron ore"
|
||||
singular_name = "iron ore chunk"
|
||||
points = 1
|
||||
custom_materials = list(/datum/material/iron=MINERAL_MATERIAL_AMOUNT)
|
||||
refined_type = /obj/item/stack/sheet/metal
|
||||
mine_experience = 1
|
||||
scan_state = "rock_Iron"
|
||||
spreadChance = 20
|
||||
|
||||
/obj/item/stack/ore/glass
|
||||
name = "sand pile"
|
||||
icon_state = "Glass ore"
|
||||
inhand_icon_state = "Glass ore"
|
||||
singular_name = "sand pile"
|
||||
points = 1
|
||||
custom_materials = list(/datum/material/glass=MINERAL_MATERIAL_AMOUNT)
|
||||
refined_type = /obj/item/stack/sheet/glass
|
||||
w_class = WEIGHT_CLASS_TINY
|
||||
mine_experience = 0 //its sand
|
||||
|
||||
GLOBAL_LIST_INIT(sand_recipes, list(\
|
||||
new /datum/stack_recipe("sandstone", /obj/item/stack/sheet/mineral/sandstone, 1, 1, 50),\
|
||||
new /datum/stack_recipe("aesthetic volcanic floor tile", /obj/item/stack/tile/basalt, 2, 1, 50)\
|
||||
))
|
||||
|
||||
/obj/item/stack/ore/glass/get_main_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 class='danger'>[C]'s eye protection blocks the sand!</span>", "<span class='warning'>Your eye protection blocks the sand!</span>")
|
||||
return
|
||||
C.adjust_blurriness(6)
|
||||
C.adjustStaminaLoss(15)//the pain from your eyes burning does stamina damage
|
||||
C.confused += 5
|
||||
to_chat(C, "<span class='userdanger'>\The [src] gets into your eyes! The pain, it burns!</span>")
|
||||
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"
|
||||
inhand_icon_state = "volcanic_sand"
|
||||
singular_name = "volcanic ash pile"
|
||||
mine_experience = 0
|
||||
|
||||
/obj/item/stack/ore/plasma
|
||||
name = "plasma ore"
|
||||
icon_state = "Plasma ore"
|
||||
inhand_icon_state = "Plasma ore"
|
||||
singular_name = "plasma ore chunk"
|
||||
points = 15
|
||||
custom_materials = list(/datum/material/plasma=MINERAL_MATERIAL_AMOUNT)
|
||||
refined_type = /obj/item/stack/sheet/mineral/plasma
|
||||
mine_experience = 5
|
||||
scan_state = "rock_Plasma"
|
||||
spreadChance = 8
|
||||
|
||||
/obj/item/stack/ore/plasma/welder_act(mob/living/user, obj/item/I)
|
||||
to_chat(user, "<span class='warning'>You can't hit a high enough temperature to smelt [src] properly!</span>")
|
||||
return TRUE
|
||||
|
||||
|
||||
/obj/item/stack/ore/silver
|
||||
name = "silver ore"
|
||||
icon_state = "Silver ore"
|
||||
inhand_icon_state = "Silver ore"
|
||||
singular_name = "silver ore chunk"
|
||||
points = 16
|
||||
mine_experience = 3
|
||||
custom_materials = list(/datum/material/silver=MINERAL_MATERIAL_AMOUNT)
|
||||
refined_type = /obj/item/stack/sheet/mineral/silver
|
||||
scan_state = "rock_Silver"
|
||||
spreadChance = 5
|
||||
|
||||
/obj/item/stack/ore/gold
|
||||
name = "gold ore"
|
||||
icon_state = "Gold ore"
|
||||
inhand_icon_state = "Gold ore"
|
||||
singular_name = "gold ore chunk"
|
||||
points = 18
|
||||
mine_experience = 5
|
||||
custom_materials = list(/datum/material/gold=MINERAL_MATERIAL_AMOUNT)
|
||||
refined_type = /obj/item/stack/sheet/mineral/gold
|
||||
scan_state = "rock_Gold"
|
||||
spreadChance = 5
|
||||
|
||||
/obj/item/stack/ore/diamond
|
||||
name = "diamond ore"
|
||||
icon_state = "Diamond ore"
|
||||
inhand_icon_state = "Diamond ore"
|
||||
singular_name = "diamond ore chunk"
|
||||
points = 50
|
||||
custom_materials = list(/datum/material/diamond=MINERAL_MATERIAL_AMOUNT)
|
||||
refined_type = /obj/item/stack/sheet/mineral/diamond
|
||||
mine_experience = 10
|
||||
scan_state = "rock_Diamond"
|
||||
|
||||
/obj/item/stack/ore/bananium
|
||||
name = "bananium ore"
|
||||
icon_state = "Bananium ore"
|
||||
inhand_icon_state = "Bananium ore"
|
||||
singular_name = "bananium ore chunk"
|
||||
points = 60
|
||||
custom_materials = list(/datum/material/bananium=MINERAL_MATERIAL_AMOUNT)
|
||||
refined_type = /obj/item/stack/sheet/mineral/bananium
|
||||
mine_experience = 15
|
||||
scan_state = "rock_Bananium"
|
||||
|
||||
/obj/item/stack/ore/titanium
|
||||
name = "titanium ore"
|
||||
icon_state = "Titanium ore"
|
||||
inhand_icon_state = "Titanium ore"
|
||||
singular_name = "titanium ore chunk"
|
||||
points = 50
|
||||
custom_materials = list(/datum/material/titanium=MINERAL_MATERIAL_AMOUNT)
|
||||
refined_type = /obj/item/stack/sheet/mineral/titanium
|
||||
mine_experience = 3
|
||||
scan_state = "rock_Titanium"
|
||||
spreadChance = 5
|
||||
|
||||
/obj/item/stack/ore/slag
|
||||
name = "slag"
|
||||
desc = "Completely useless."
|
||||
icon_state = "slag"
|
||||
inhand_icon_state = "slag"
|
||||
singular_name = "slag chunk"
|
||||
|
||||
/obj/item/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"
|
||||
inhand_icon_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/gibtonite/ComponentInitialize()
|
||||
. = ..()
|
||||
AddComponent(/datum/component/two_handed, require_twohands=TRUE)
|
||||
|
||||
/obj/item/gibtonite/Destroy()
|
||||
qdel(wires)
|
||||
wires = null
|
||||
return ..()
|
||||
|
||||
/obj/item/gibtonite/attackby(obj/item/I, mob/user, params)
|
||||
if(!wires && istype(I, /obj/item/assembly/igniter))
|
||||
user.visible_message("<span class='notice'>[user] attaches [I] to [src].</span>", "<span class='notice'>You attach [I] to [src].</span>")
|
||||
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("<span class='notice'>The chain reaction stopped! ...The ore's quality looks diminished.</span>", "<span class='notice'>You stopped the chain reaction. ...The ore's quality looks diminished.</span>")
|
||||
icon_state = "Gibtonite ore"
|
||||
quality = GIBTONITE_QUALITY_LOW
|
||||
return
|
||||
..()
|
||||
|
||||
/obj/item/gibtonite/attack_self(user)
|
||||
if(wires)
|
||||
wires.interact(user)
|
||||
else
|
||||
..()
|
||||
|
||||
/obj/item/gibtonite/bullet_act(obj/projectile/P)
|
||||
GibtoniteReaction(P.firer)
|
||||
. = ..()
|
||||
|
||||
/obj/item/gibtonite/ex_act()
|
||||
GibtoniteReaction(null, 1)
|
||||
|
||||
/obj/item/gibtonite/proc/GibtoniteReaction(mob/user, triggered_by = 0)
|
||||
if(!primed)
|
||||
primed = TRUE
|
||||
playsound(src,'sound/effects/hit_on_shattered_glass.ogg',50,TRUE)
|
||||
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 class='warning'>[user] strikes \the [src], causing a chain reaction!</span>", "<span class='danger'>You strike \the [src], causing a chain reaction.</span>")
|
||||
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/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"
|
||||
flags_1 = CONDUCT_1
|
||||
force = 1
|
||||
throwforce = 2
|
||||
w_class = WEIGHT_CLASS_TINY
|
||||
custom_materials = list(/datum/material/iron = 400)
|
||||
material_flags = MATERIAL_ADD_PREFIX | MATERIAL_COLOR | MATERIAL_AFFECT_STATISTICS
|
||||
var/string_attached
|
||||
var/list/sideslist = list("heads","tails")
|
||||
var/cooldown = 0
|
||||
var/value
|
||||
var/coinflip
|
||||
item_flags = NO_MAT_REDEMPTION //You know, it's kind of a problem that money is worth more extrinsicly than intrinsically in this universe.
|
||||
|
||||
/obj/item/coin/Initialize()
|
||||
. = ..()
|
||||
coinflip = pick(sideslist)
|
||||
icon_state = "coin_[coinflip]"
|
||||
pixel_x = rand(0,16)-8
|
||||
pixel_y = rand(0,8)-8
|
||||
|
||||
/obj/item/coin/set_custom_materials(var/list/materials, multiplier = 1)
|
||||
. = ..()
|
||||
value = 0
|
||||
for(var/i in custom_materials)
|
||||
var/datum/material/M = i
|
||||
value += M.value_per_unit * custom_materials[M]
|
||||
|
||||
/obj/item/coin/get_item_credit_value()
|
||||
return value
|
||||
|
||||
/obj/item/coin/suicide_act(mob/living/user)
|
||||
user.visible_message("<span class='suicide'>[user] contemplates suicide with \the [src]!</span>")
|
||||
if (!attack_self(user))
|
||||
user.visible_message("<span class='suicide'>[user] couldn't flip \the [src]!</span>")
|
||||
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 class='suicide'>\the [src] lands on [coinflip]! [user] promptly falls over, dead!</span>")
|
||||
user.adjustOxyLoss(200)
|
||||
user.death(0)
|
||||
user.set_suicide(TRUE)
|
||||
user.suicide_log()
|
||||
else
|
||||
user.visible_message("<span class='suicide'>\the [src] lands on [coinflip]! [user] keeps on living!</span>")
|
||||
|
||||
/obj/item/coin/examine(mob/user)
|
||||
. = ..()
|
||||
. += "<span class='info'>It's worth [value] credit\s.</span>"
|
||||
|
||||
/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 class='warning'>There already is a string attached to this coin!</span>")
|
||||
return
|
||||
|
||||
if (CC.use(1))
|
||||
add_overlay("coin_string_overlay")
|
||||
string_attached = 1
|
||||
to_chat(user, "<span class='notice'>You attach a string to the coin.</span>")
|
||||
else
|
||||
to_chat(user, "<span class='warning'>You need one length of cable to attach a string to the coin!</span>")
|
||||
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 class='notice'>You detach the string from the coin.</span>")
|
||||
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 class='warning'>The coin won't flip very well with something attached!</span>" )
|
||||
return FALSE//do not flip the coin
|
||||
cooldown = world.time + 15
|
||||
flick("coin_[coinflip]_flip", src)
|
||||
coinflip = pick(sideslist)
|
||||
icon_state = "coin_[coinflip]"
|
||||
playsound(user.loc, 'sound/items/coinflip.ogg', 50, TRUE)
|
||||
var/oldloc = loc
|
||||
sleep(15)
|
||||
if(loc == oldloc && user && !user.incapacitated())
|
||||
user.visible_message("<span class='notice'>[user] flips [src]. It lands on [coinflip].</span>", \
|
||||
"<span class='notice'>You flip [src]. It lands on [coinflip].</span>", \
|
||||
"<span class='hear'>You hear the clattering of loose change.</span>")
|
||||
return TRUE//did the coin flip? useful for suicide_act
|
||||
|
||||
/obj/item/coin/gold
|
||||
custom_materials = list(/datum/material/gold = 400)
|
||||
|
||||
/obj/item/coin/silver
|
||||
custom_materials = list(/datum/material/silver = 400)
|
||||
|
||||
/obj/item/coin/diamond
|
||||
custom_materials = list(/datum/material/diamond = 400)
|
||||
|
||||
/obj/item/coin/plasma
|
||||
custom_materials = list(/datum/material/plasma = 400)
|
||||
|
||||
/obj/item/coin/uranium
|
||||
custom_materials = list(/datum/material/uranium = 400)
|
||||
|
||||
/obj/item/coin/titanium
|
||||
custom_materials = list(/datum/material/titanium = 400)
|
||||
|
||||
/obj/item/coin/bananium
|
||||
custom_materials = list(/datum/material/bananium = 400)
|
||||
|
||||
/obj/item/coin/adamantine
|
||||
custom_materials = list(/datum/material/adamantine = 400)
|
||||
|
||||
/obj/item/coin/mythril
|
||||
custom_materials = list(/datum/material/mythril = 400)
|
||||
|
||||
/obj/item/coin/plastic
|
||||
custom_materials = list(/datum/material/plastic = 400)
|
||||
|
||||
/obj/item/coin/runite
|
||||
custom_materials = list(/datum/material/runite = 400)
|
||||
|
||||
/obj/item/coin/twoheaded
|
||||
desc = "Hey, this coin's the same on both sides!"
|
||||
sideslist = list("heads")
|
||||
|
||||
/obj/item/coin/antagtoken
|
||||
name = "antag token"
|
||||
desc = "A novelty coin that helps the heart know what hard evidence cannot prove."
|
||||
icon_state = "coin_valid"
|
||||
custom_materials = list(/datum/material/plastic = 400)
|
||||
sideslist = list("valid", "salad")
|
||||
material_flags = NONE
|
||||
|
||||
/obj/item/coin/iron
|
||||
|
||||
#undef ORESTACK_OVERLAYS_MAX
|
||||
|
||||
@@ -1,105 +1,105 @@
|
||||
|
||||
/**********************Ore box**************************/
|
||||
|
||||
/obj/structure/ore_box
|
||||
icon = 'icons/obj/mining.dmi'
|
||||
icon_state = "orebox"
|
||||
name = "ore box"
|
||||
desc = "A heavy wooden box, which can be filled with a lot of ores."
|
||||
density = TRUE
|
||||
pressure_resistance = 5*ONE_ATMOSPHERE
|
||||
|
||||
var/ui_x = 335
|
||||
var/ui_y = 415
|
||||
|
||||
/obj/structure/ore_box/attackby(obj/item/W, mob/user, params)
|
||||
if (istype(W, /obj/item/stack/ore))
|
||||
user.transferItemToLoc(W, src)
|
||||
else if(SEND_SIGNAL(W, COMSIG_CONTAINS_STORAGE))
|
||||
SEND_SIGNAL(W, COMSIG_TRY_STORAGE_TAKE_TYPE, /obj/item/stack/ore, src)
|
||||
to_chat(user, "<span class='notice'>You empty the ore in [W] into \the [src].</span>")
|
||||
else
|
||||
return ..()
|
||||
|
||||
/obj/structure/ore_box/ComponentInitialize()
|
||||
. = ..()
|
||||
AddComponent(/datum/component/rad_insulation, 0.01) //please datum mats no more cancer
|
||||
|
||||
/obj/structure/ore_box/crowbar_act(mob/living/user, obj/item/I)
|
||||
if(I.use_tool(src, user, 50, volume=50))
|
||||
user.visible_message("<span class='notice'>[user] pries \the [src] apart.</span>",
|
||||
"<span class='notice'>You pry apart \the [src].</span>",
|
||||
"<span class='hear'>You hear splitting wood.</span>")
|
||||
deconstruct(TRUE, user)
|
||||
return TRUE
|
||||
|
||||
/obj/structure/ore_box/examine(mob/living/user)
|
||||
if(Adjacent(user) && istype(user))
|
||||
ui_interact(user)
|
||||
. = ..()
|
||||
|
||||
/obj/structure/ore_box/attack_hand(mob/user)
|
||||
. = ..()
|
||||
if(.)
|
||||
return
|
||||
if(Adjacent(user))
|
||||
ui_interact(user)
|
||||
|
||||
/obj/structure/ore_box/attack_robot(mob/user)
|
||||
if(Adjacent(user))
|
||||
ui_interact(user)
|
||||
|
||||
/obj/structure/ore_box/proc/dump_box_contents()
|
||||
var/drop = drop_location()
|
||||
for(var/obj/item/stack/ore/O in src)
|
||||
if(QDELETED(O))
|
||||
continue
|
||||
if(QDELETED(src))
|
||||
break
|
||||
O.forceMove(drop)
|
||||
if(TICK_CHECK)
|
||||
stoplag()
|
||||
drop = drop_location()
|
||||
|
||||
/obj/structure/ore_box/ui_interact(mob/user, ui_key = "main", datum/tgui/ui = null, force_open = FALSE, \
|
||||
datum/tgui/master_ui = null, datum/ui_state/state = GLOB.default_state)
|
||||
ui = SStgui.try_update_ui(user, src, ui_key, ui, force_open)
|
||||
if(!ui)
|
||||
ui = new(user, src, ui_key, "OreBox", name, ui_x, ui_y, master_ui, state)
|
||||
ui.open()
|
||||
|
||||
/obj/structure/ore_box/ui_data()
|
||||
var/contents = list()
|
||||
for(var/obj/item/stack/ore/O in src)
|
||||
contents[O.type] += O.amount
|
||||
|
||||
var/data = list()
|
||||
data["materials"] = list()
|
||||
for(var/type in contents)
|
||||
var/obj/item/stack/ore/O = type
|
||||
var/name = initial(O.name)
|
||||
data["materials"] += list(list("name" = name, "amount" = contents[type], "id" = type))
|
||||
|
||||
return data
|
||||
|
||||
/obj/structure/ore_box/ui_act(action, params)
|
||||
if(..())
|
||||
return
|
||||
if(!Adjacent(usr))
|
||||
return
|
||||
add_fingerprint(usr)
|
||||
usr.set_machine(src)
|
||||
switch(action)
|
||||
if("removeall")
|
||||
dump_box_contents()
|
||||
to_chat(usr, "<span class='notice'>You open the release hatch on the box..</span>")
|
||||
|
||||
/obj/structure/ore_box/deconstruct(disassembled = TRUE, mob/user)
|
||||
var/obj/item/stack/sheet/mineral/wood/WD = new (loc, 4)
|
||||
if(user)
|
||||
WD.add_fingerprint(user)
|
||||
dump_box_contents()
|
||||
qdel(src)
|
||||
|
||||
/obj/structure/ore_box/onTransitZ()
|
||||
return
|
||||
|
||||
/**********************Ore box**************************/
|
||||
|
||||
/obj/structure/ore_box
|
||||
icon = 'icons/obj/mining.dmi'
|
||||
icon_state = "orebox"
|
||||
name = "ore box"
|
||||
desc = "A heavy wooden box, which can be filled with a lot of ores."
|
||||
density = TRUE
|
||||
pressure_resistance = 5*ONE_ATMOSPHERE
|
||||
|
||||
var/ui_x = 335
|
||||
var/ui_y = 415
|
||||
|
||||
/obj/structure/ore_box/attackby(obj/item/W, mob/user, params)
|
||||
if (istype(W, /obj/item/stack/ore))
|
||||
user.transferItemToLoc(W, src)
|
||||
else if(SEND_SIGNAL(W, COMSIG_CONTAINS_STORAGE))
|
||||
SEND_SIGNAL(W, COMSIG_TRY_STORAGE_TAKE_TYPE, /obj/item/stack/ore, src)
|
||||
to_chat(user, "<span class='notice'>You empty the ore in [W] into \the [src].</span>")
|
||||
else
|
||||
return ..()
|
||||
|
||||
/obj/structure/ore_box/ComponentInitialize()
|
||||
. = ..()
|
||||
AddComponent(/datum/component/rad_insulation, 0.01) //please datum mats no more cancer
|
||||
|
||||
/obj/structure/ore_box/crowbar_act(mob/living/user, obj/item/I)
|
||||
if(I.use_tool(src, user, 50, volume=50))
|
||||
user.visible_message("<span class='notice'>[user] pries \the [src] apart.</span>",
|
||||
"<span class='notice'>You pry apart \the [src].</span>",
|
||||
"<span class='hear'>You hear splitting wood.</span>")
|
||||
deconstruct(TRUE, user)
|
||||
return TRUE
|
||||
|
||||
/obj/structure/ore_box/examine(mob/living/user)
|
||||
if(Adjacent(user) && istype(user))
|
||||
ui_interact(user)
|
||||
. = ..()
|
||||
|
||||
/obj/structure/ore_box/attack_hand(mob/user)
|
||||
. = ..()
|
||||
if(.)
|
||||
return
|
||||
if(Adjacent(user))
|
||||
ui_interact(user)
|
||||
|
||||
/obj/structure/ore_box/attack_robot(mob/user)
|
||||
if(Adjacent(user))
|
||||
ui_interact(user)
|
||||
|
||||
/obj/structure/ore_box/proc/dump_box_contents()
|
||||
var/drop = drop_location()
|
||||
for(var/obj/item/stack/ore/O in src)
|
||||
if(QDELETED(O))
|
||||
continue
|
||||
if(QDELETED(src))
|
||||
break
|
||||
O.forceMove(drop)
|
||||
if(TICK_CHECK)
|
||||
stoplag()
|
||||
drop = drop_location()
|
||||
|
||||
/obj/structure/ore_box/ui_interact(mob/user, ui_key = "main", datum/tgui/ui = null, force_open = FALSE, \
|
||||
datum/tgui/master_ui = null, datum/ui_state/state = GLOB.default_state)
|
||||
ui = SStgui.try_update_ui(user, src, ui_key, ui, force_open)
|
||||
if(!ui)
|
||||
ui = new(user, src, ui_key, "OreBox", name, ui_x, ui_y, master_ui, state)
|
||||
ui.open()
|
||||
|
||||
/obj/structure/ore_box/ui_data()
|
||||
var/contents = list()
|
||||
for(var/obj/item/stack/ore/O in src)
|
||||
contents[O.type] += O.amount
|
||||
|
||||
var/data = list()
|
||||
data["materials"] = list()
|
||||
for(var/type in contents)
|
||||
var/obj/item/stack/ore/O = type
|
||||
var/name = initial(O.name)
|
||||
data["materials"] += list(list("name" = name, "amount" = contents[type], "id" = type))
|
||||
|
||||
return data
|
||||
|
||||
/obj/structure/ore_box/ui_act(action, params)
|
||||
if(..())
|
||||
return
|
||||
if(!Adjacent(usr))
|
||||
return
|
||||
add_fingerprint(usr)
|
||||
usr.set_machine(src)
|
||||
switch(action)
|
||||
if("removeall")
|
||||
dump_box_contents()
|
||||
to_chat(usr, "<span class='notice'>You open the release hatch on the box..</span>")
|
||||
|
||||
/obj/structure/ore_box/deconstruct(disassembled = TRUE, mob/user)
|
||||
var/obj/item/stack/sheet/mineral/wood/WD = new (loc, 4)
|
||||
if(user)
|
||||
WD.add_fingerprint(user)
|
||||
dump_box_contents()
|
||||
qdel(src)
|
||||
|
||||
/obj/structure/ore_box/onTransitZ()
|
||||
return
|
||||
|
||||
Reference in New Issue
Block a user