mirror of
https://github.com/ParadiseSS13/Paradise.git
synced 2026-08-29 23:17:02 +01:00
Smith Expansion - Smith + Xenobiology = Energy Guns (#29040)
* Initial Commit * Small adjustment * Vendor stock update * Icon states * Finished merge, fixed runtimes, coded properly now * Mapped in assemblers * Swapped bluespace slime and sepia slime guns * Replaced scatter laser with eshotgun --------- Signed-off-by: PollardTheDragon <144391971+PollardTheDragon@users.noreply.github.com>
This commit is contained in:
@@ -50,6 +50,16 @@
|
||||
. += "<span class='notice'> - [MAT]: [ROUND_UP(((temp_product.materials[MAT] * quality.material_mult) * efficiency) / MINERAL_MATERIAL_AMOUNT)] sheets.</span>"
|
||||
// Get rid of the temp product
|
||||
qdel(temp_product)
|
||||
else if(istype(cast, /obj/item/smithing_cast/misc) && !produced_item)
|
||||
var/obj/item/temp_product = new cast.selected_product(src) // This is necessary due to selected_product being a type
|
||||
var/obj/item/smithing_cast/component/comp_cast = cast
|
||||
. += "<span class='notice'>Required Resources:</span>"
|
||||
var/MAT
|
||||
// Get the materials the item needs and display
|
||||
for(MAT in temp_product.materials)
|
||||
. += "<span class='notice'> - [MAT]: [ROUND_UP((temp_product.materials[MAT] * efficiency) / MINERAL_MATERIAL_AMOUNT)] sheets.</span>"
|
||||
// Get rid of the temp product
|
||||
qdel(temp_product)
|
||||
|
||||
if(produced_item)
|
||||
. += "<span class='notice'>There is a [produced_item] in the machine. You can pick it up with your hand.</span>"
|
||||
@@ -86,6 +96,8 @@
|
||||
. += "cast_lens"
|
||||
else if(istype(cast, /obj/item/smithing_cast/component/trim))
|
||||
. += "cast_trim"
|
||||
else if(istype(cast, /obj/item/smithing_cast/misc/egun_parts))
|
||||
. += "cast_egun_parts"
|
||||
. += "casting_lip"
|
||||
if(panel_open)
|
||||
. += "casting_wires"
|
||||
@@ -233,6 +245,32 @@
|
||||
qdel(temp_product)
|
||||
return FINISH_ATTACK
|
||||
|
||||
if(istype(cast, /obj/item/smithing_cast/misc))
|
||||
var/list/used_mats = list()
|
||||
|
||||
// Check if there is enough materials to craft the item
|
||||
for(MAT in temp_product.materials)
|
||||
used_mats[MAT] = temp_product.materials[MAT] * efficiency
|
||||
|
||||
if(!materials.has_materials(used_mats, 1))
|
||||
to_chat(user, "<span class='warning'>Not enough materials in the crucible to smelt [temp_product.name]!</span>")
|
||||
qdel(temp_product)
|
||||
return FINISH_ATTACK
|
||||
|
||||
to_chat(user, "<span class='notice'>You begin to pour the liquid minerals into the [src]...</span>")
|
||||
// Use the materials and create the item.
|
||||
materials.use_amount(used_mats)
|
||||
linked_crucible.animate_pour(operation_time SECONDS)
|
||||
operate(operation_time, user)
|
||||
produced_item = new cast.selected_product(src)
|
||||
produced_item.set_worktime()
|
||||
produced_item.update_appearance(UPDATE_NAME)
|
||||
produced_item.update_icon(UPDATE_ICON_STATE)
|
||||
update_icon(UPDATE_OVERLAYS)
|
||||
// Clean up temps
|
||||
qdel(temp_product)
|
||||
return FINISH_ATTACK
|
||||
|
||||
/obj/machinery/smithing/casting_basin/Destroy()
|
||||
if(linked_crucible)
|
||||
linked_crucible.linked_machines -= src
|
||||
|
||||
@@ -231,3 +231,148 @@
|
||||
extra_product.update_appearance(UPDATE_NAME)
|
||||
extra_product.scatter_atom()
|
||||
finished_product = null
|
||||
|
||||
// MARK: Scientific Assembler
|
||||
|
||||
/obj/machinery/smithing/scientific_assembler
|
||||
name = "scientific assembler"
|
||||
desc = "A smart assembler that takes slime cores, energy cells, and energy gun parts to produce energy guns."
|
||||
icon = 'icons/obj/machines/smithing_machines.dmi'
|
||||
icon_state = "assembler"
|
||||
max_integrity = 100
|
||||
pixel_x = 0 // 1x1
|
||||
pixel_y = 0
|
||||
bound_height = 32
|
||||
bound_width = 32
|
||||
bound_y = 0
|
||||
operation_sound = 'sound/items/welder.ogg'
|
||||
/// Slime extract for the egun
|
||||
var/obj/item/slime_extract/slime_core
|
||||
/// The gun frame
|
||||
var/obj/item/smithed_item/component/egun_parts/parts
|
||||
/// The battery
|
||||
var/obj/item/stock_parts/cell/cell
|
||||
|
||||
/obj/machinery/smithing/scientific_assembler/Initialize(mapload)
|
||||
. = ..()
|
||||
// Stock parts
|
||||
component_parts = list()
|
||||
component_parts += new /obj/item/circuitboard/kinetic_assembler(null)
|
||||
component_parts += new /obj/item/stock_parts/manipulator(null)
|
||||
component_parts += new /obj/item/stock_parts/manipulator(null)
|
||||
component_parts += new /obj/item/stock_parts/manipulator(null)
|
||||
component_parts += new /obj/item/stock_parts/micro_laser(null)
|
||||
component_parts += new /obj/item/stack/sheet/glass(null)
|
||||
RefreshParts()
|
||||
|
||||
/obj/machinery/smithing/scientific_assembler/examine(mob/user)
|
||||
. = ..()
|
||||
if(slime_core || parts || cell)
|
||||
. += "<span class='notice'>You can activate the machine with your hand, or remove a component by alt-clicking.</span>"
|
||||
if(slime_core)
|
||||
. += "<span class='notice'>There is a [slime_core] in the core slot.</span>"
|
||||
if(parts)
|
||||
. += "<span class='notice'>There is a [parts] in the gun frame slot.</span>"
|
||||
if(cell)
|
||||
. += "<span class='notice'>There is a [cell] in the power cell slot.</span>"
|
||||
|
||||
/obj/machinery/smithing/scientific_assembler/RefreshParts()
|
||||
var/operation_mult = 0
|
||||
for(var/obj/item/stock_parts/component in component_parts)
|
||||
operation_mult += OPERATION_SPEED_MULT_PER_RATING * component.rating
|
||||
// Update our values
|
||||
operation_time = operation_time = max(ROUND_UP(initial(operation_time) * (1.3 - operation_mult)), 2)
|
||||
|
||||
/obj/machinery/smithing/scientific_assembler/update_icon_state()
|
||||
. = ..()
|
||||
if(panel_open)
|
||||
icon_state = "assembler_wires"
|
||||
|
||||
/obj/machinery/smithing/kinetic_assembler/default_deconstruction_screwdriver(mob/user, icon_state_open, icon_state_closed, obj/item/I)
|
||||
. = ..()
|
||||
update_icon(UPDATE_ICON_STATE)
|
||||
|
||||
/obj/machinery/smithing/scientific_assembler/update_overlays()
|
||||
. = ..()
|
||||
overlays.Cut()
|
||||
if(panel_open)
|
||||
icon_state = "assembler_wires"
|
||||
|
||||
/obj/machinery/smithing/scientific_assembler/item_interaction(mob/living/user, obj/item/used, list/modifiers)
|
||||
if(operating)
|
||||
to_chat(user, "<span class='warning'>[src] is still operating!</span>")
|
||||
return ITEM_INTERACT_COMPLETE
|
||||
|
||||
if(istype(used, /obj/item/slime_extract))
|
||||
var/obj/item/slime_extract/core = used
|
||||
if(!core.associated_gun_type)
|
||||
to_chat(user, "<span class='notice'>[core] is not capable of producing an energy gun!</span>")
|
||||
return ITEM_INTERACT_COMPLETE
|
||||
if(slime_core)
|
||||
to_chat(user, "<span class='notice'>You remove [slime_core] from the core component slot of [src].</span>")
|
||||
slime_core.forceMove(src.loc)
|
||||
slime_core = null
|
||||
if(used.flags & NODROP || !user.transfer_item_to(used, src))
|
||||
to_chat(user, "<span class='warning'>[used] is stuck to your hand!</span>")
|
||||
return ITEM_INTERACT_COMPLETE
|
||||
to_chat(user, "<span class='notice'>You insert [used] into the core component slot of [src].</span>")
|
||||
slime_core = used
|
||||
return ITEM_INTERACT_COMPLETE
|
||||
|
||||
if(istype(used, /obj/item/smithed_item/component/egun_parts))
|
||||
if(parts)
|
||||
to_chat(user, "<span class='notice'>You remove [parts] from the gun parts component slot of [src].</span>")
|
||||
parts.forceMove(src.loc)
|
||||
parts = null
|
||||
if(used.flags & NODROP || !user.transfer_item_to(used, src))
|
||||
to_chat(user, "<span class='warning'>[used] is stuck to your hand!</span>")
|
||||
return ITEM_INTERACT_COMPLETE
|
||||
var/obj/item/smithed_item/component/egun_parts/new_parts = used
|
||||
if(new_parts.hammer_time)
|
||||
to_chat(user, "<span class='warning'>[new_parts] is not complete yet!</span>")
|
||||
return ITEM_INTERACT_COMPLETE
|
||||
to_chat(user, "<span class='notice'>You insert [used] into the gun parts component slot of [src].</span>")
|
||||
parts = used
|
||||
return ITEM_INTERACT_COMPLETE
|
||||
|
||||
if(istype(used, /obj/item/stock_parts/cell))
|
||||
if(cell)
|
||||
to_chat(user, "<span class='notice'>You remove [cell] from the power cell component slot of [src].</span>")
|
||||
cell.forceMove(src.loc)
|
||||
cell = null
|
||||
if(used.flags & NODROP || !user.transfer_item_to(used, src))
|
||||
to_chat(user, "<span class='warning'>[used] is stuck to your hand!</span>")
|
||||
return ITEM_INTERACT_COMPLETE
|
||||
to_chat(user, "<span class='notice'>You insert [used] into the power cell component slot of [src].</span>")
|
||||
cell = used
|
||||
return ITEM_INTERACT_COMPLETE
|
||||
|
||||
to_chat(user, "<span class='warning'>You feel like there's no reason to process [used].</span>")
|
||||
return ITEM_INTERACT_COMPLETE
|
||||
|
||||
/obj/machinery/smithing/scientific_assembler/attack_hand(mob/user)
|
||||
if(!slime_core)
|
||||
to_chat(user, "<span class='warning'>[src] lacks a slime core!</span>")
|
||||
return FINISH_ATTACK
|
||||
|
||||
if(!parts)
|
||||
to_chat(user, "<span class='warning'>[src] lacks an energy gun frame!</span>")
|
||||
return FINISH_ATTACK
|
||||
|
||||
if(!cell)
|
||||
to_chat(user, "<span class='warning'>[src] lacks a power cell!</span>")
|
||||
return FINISH_ATTACK
|
||||
|
||||
operate(operation_time, user)
|
||||
return FINISH_ATTACK
|
||||
|
||||
/obj/machinery/smithing/scientific_assembler/operate(loops, mob/living/user)
|
||||
..()
|
||||
var/obj/item/gun/energy/finished_product = new slime_core.associated_gun_type(src)
|
||||
finished_product.forceMove(src.loc)
|
||||
qdel(slime_core)
|
||||
qdel(parts)
|
||||
qdel(cell)
|
||||
slime_core = null
|
||||
parts = null
|
||||
cell = null
|
||||
|
||||
@@ -48,7 +48,7 @@
|
||||
|
||||
/obj/machinery/smithing/power_hammer/operate(loops, mob/living/user)
|
||||
if(!working_component)
|
||||
to_chat(user, "<span class='notice'>There is no component in the machine.</span>")
|
||||
to_chat(user, "<span class='notice'>There is no component to hammer!</span>")
|
||||
return
|
||||
if(!working_component.heat)
|
||||
to_chat(user, "<span class='notice'>[working_component] is too cold to properly shape.</span>")
|
||||
|
||||
@@ -0,0 +1,7 @@
|
||||
// MARK: Energy Gun Frame
|
||||
/obj/item/smithed_item/component/egun_parts
|
||||
name = "energy gun parts"
|
||||
desc = "Smithed component of an energy gun."
|
||||
icon_state = "egun_parts"
|
||||
materials = list(MAT_TITANIUM = 10000, MAT_PLASMA = 10000)
|
||||
hammer_time = 6
|
||||
@@ -26,11 +26,15 @@
|
||||
. = ..()
|
||||
if(!possible_products)
|
||||
return
|
||||
if(!length(possible_products))
|
||||
return
|
||||
var/list/product_names = list()
|
||||
var/product
|
||||
for(product in possible_products)
|
||||
var/obj/item/possible_product = product
|
||||
product_names[possible_product.name] = possible_product
|
||||
if(!length(product_names))
|
||||
return
|
||||
var/new_product = tgui_input_list(user, "Select a product", src, product_names)
|
||||
if(!new_product)
|
||||
selected_product = possible_products[1]
|
||||
@@ -158,3 +162,20 @@
|
||||
icon_state = "trim_cast"
|
||||
desc = "A cast for creating trims."
|
||||
product_type = /obj/item/smithed_item/component/trim
|
||||
|
||||
/obj/item/smithing_cast/misc
|
||||
name = "misc cast"
|
||||
icon_state = "insert_frame_cast"
|
||||
desc = "Debug cast. If you see this, notify the development team."
|
||||
|
||||
/obj/item/smithing_cast/misc/AltClick(mob/user, modifiers)
|
||||
return
|
||||
|
||||
/obj/item/smithing_cast/misc/examine(mob/user)
|
||||
. = desc
|
||||
|
||||
/obj/item/smithing_cast/misc/egun_parts
|
||||
name = "energy gun parts cast"
|
||||
icon_state = "egun_parts_cast"
|
||||
desc = "A cast for creating energy gun frames."
|
||||
selected_product = /obj/item/smithed_item/component/egun_parts
|
||||
|
||||
Reference in New Issue
Block a user