Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- /obj/structure/destructible/dwarven/workshop
- name = "Dwarven workshop"
- icon_state = "workshop"
- var/state = 0
- custom_materials = list(/datum/material/wood = 20000)
- /obj/structure/destructible/dwarven/workshop/Initialize()
- . = ..()
- AddComponent(/datum/component/material_container,
- list(/datum/material/iron,
- /datum/material/glass,
- /datum/material/gold,
- /datum/material/silver,
- /datum/material/diamond,
- /datum/material/uranium,
- /datum/material/plasma,
- /datum/material/bluespace,
- /datum/material/bananium,
- /datum/material/titanium,
- /datum/material/runite,
- /datum/material/plastic,
- /datum/material/adamantine,
- /datum/material/mythril,
- /datum/material/wood
- ), 20000, TRUE, /obj/item/stack, null, null)
- /obj/structure/destructible/dwarven/workshop/examine(mob/user)
- . = ..()
- . += "<span class='notice'>Alt click to change the function</span>"
- . += "<span class='notice'>Click with mats to put them inside of the workshop</span>"
- . += "<span class='notice'>Click with a hand to retrieve all mats</span>"
- . += "<span class='notice'>Click with a mallet to activate the function</span>"
- . += "<span class='notice'>Current function is : [state]</span>"
- /obj/structure/destructible/dwarven/workshop/AltClick(mob/user)
- if(!istype(user) || !user.canUseTopic(src, BE_CLOSE))
- return
- if(state == 2)
- state = 0
- else
- state++
- /obj/structure/destructible/dwarven/workshop/attack_hand(mob/user)
- var/datum/component/material_container/materials = GetComponent(/datum/component/material_container)
- materials.retrieve_all()
- . = ..()
- /obj/structure/destructible/dwarven/workshop/attacked_by(obj/item/I, mob/living/user)
- if(istype(I,/obj/item/dwarven/mallet))
- handle_mallet(user)
- return
- . = ..()
- /obj/structure/destructible/dwarven/workshop/proc/handle_mallet(mob/user)
- var/efficiency = user?.mind.get_skill_modifier(/datum/skill/operating, SKILL_EFFICIENCY_MODIFIER)
- to_chat(user,"<span class='notice'>You start looking through design notes...</span>")
- if(!do_after(user, 15, target = src))
- return FALSE
- if(!prob(efficiency))
- user?.mind.adjust_experience(/datum/skill/operating, 1)
- to_chat(user,"<span class='notice'>You cannot find anything of value.</span>")
- return
- user?.mind.adjust_experience(/datum/skill/operating, 2)
- to_chat(user,"<span class='notice'>You find something useful!</span>")
- switch(state)
- if(1)
- handle_create_blueprints(user)
- if(2)
- handle_create_pickaxe(user)
- //if(3) //upgrades this will require dwarven metal datum
- // handle_create_pickaxe(user)
- return
- /obj/structure/destructible/dwarven/workshop/proc/handle_create_blueprints(mob/user)
- var/obj/structure/destructible/dwarven/wanted_structure
- var/choice
- choice = alert("What structure do you wish to design?",,"Lava forge","Workbench","Dwarven Anvil","Dwarven Gringer")
- switch(choice)
- if("Lava forge")
- wanted_structure = /obj/structure/destructible/dwarven/lava_forge
- if("Workbench")
- wanted_structure = /obj/structure/destructible/dwarven/workshop
- if("Dwarven Anvil")
- wanted_structure = /obj/structure/destructible/dwarven/workshop //todo
- if("Dwarven Gringer")
- wanted_structure = /obj/structure/destructible/dwarven/workshop // todo
- var/datum/component/material_container/materials = GetComponent(/datum/component/material_container)
- for(var/i in wanted_structure.custom_materials)
- var/datum/material/M = i
- if(!materials.has_enough_of_material(M))
- return
- materials.use_materials(wanted_structure.custom_materials)
- new /obj/item/dwarven/blueprint(drop_location(),wanted_structure)
- /obj/structure/destructible/dwarven/workshop/proc/handle_create_pickaxe(mob/user)
- var/obj/item/pickaxe/wanted_pickaxe
- var/choice
- choice = alert("What pickaxe do you wish to create?",,"Iron","Silver","Diamond")
- switch(choice)
- if("Iron")
- wanted_pickaxe = /obj/item/pickaxe
- if("Silver")
- wanted_pickaxe = /obj/item/pickaxe/silver
- if("Diamond")
- wanted_pickaxe = /obj/item/pickaxe/diamond
- var/datum/component/material_container/materials = GetComponent(/datum/component/material_container)
- for(var/i in wanted_pickaxe.custom_materials)
- var/datum/material/M = i
- if(!materials.has_enough_of_material(M))
- return
- materials.use_materials(wanted_pickaxe.custom_materials)
- new wanted_pickaxe(drop_location())
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement