mirror of
https://github.com/ParadiseSS13/Paradise.git
synced 2026-07-10 14:44:05 +01:00
Table crafting refactor
This commit is contained in:
@@ -0,0 +1,83 @@
|
||||
// This file is for projectile weapon crafting. All parts and construction paths will be contained here.
|
||||
// The weapons themselves are children of other weapons and should be contained in their respective files.
|
||||
|
||||
// PARTS //
|
||||
|
||||
/obj/item/weaponcrafting/receiver
|
||||
name = "modular receiver"
|
||||
desc = "A prototype modular receiver and trigger assembly for a firearm."
|
||||
icon = 'icons/obj/improvised.dmi'
|
||||
icon_state = "receiver"
|
||||
|
||||
/obj/item/weaponcrafting/stock
|
||||
name = "rifle stock"
|
||||
desc = "A classic rifle stock that doubles as a grip, roughly carved out of wood."
|
||||
icon = 'icons/obj/improvised.dmi'
|
||||
icon_state = "riflestock"
|
||||
|
||||
|
||||
// CRAFTING //
|
||||
|
||||
/obj/item/weaponcrafting/receiver/attackby(obj/item/W as obj, mob/user as mob)
|
||||
if(istype(W,/obj/item/pipe))
|
||||
user << "You attach the shotgun barrel to the receiver. The pins seem loose."
|
||||
var/obj/item/weaponcrafting/ishotgunconstruction/I = new /obj/item/weaponcrafting/ishotgunconstruction
|
||||
user.unEquip(src)
|
||||
user.put_in_hands(I)
|
||||
del(W)
|
||||
del(src)
|
||||
return
|
||||
|
||||
// SHOTGUN //
|
||||
|
||||
/obj/item/weaponcrafting/ishotgunconstruction
|
||||
name = "slightly conspicuous metal construction"
|
||||
desc = "A long pipe attached to a firearm receiver. The pins seem loose."
|
||||
icon = 'icons/obj/improvised.dmi'
|
||||
icon_state = "ishotgunstep1"
|
||||
|
||||
/obj/item/weaponcrafting/ishotgunconstruction/attackby(var/obj/item/I, mob/user as mob)
|
||||
..()
|
||||
if(istype(I, /obj/item/weapon/screwdriver))
|
||||
var/obj/item/weaponcrafting/ishotgunconstruction2/C = new /obj/item/weaponcrafting/ishotgunconstruction2
|
||||
user.unEquip(src)
|
||||
user.put_in_hands(C)
|
||||
user << "<span class='notice'>You screw the pins into place, securing the pipe to the receiver.</span>"
|
||||
qdel(src)
|
||||
|
||||
/obj/item/weaponcrafting/ishotgunconstruction2
|
||||
name = "very conspicuous metal construction"
|
||||
desc = "A long pipe attached to a trigger assembly."
|
||||
icon = 'icons/obj/improvised.dmi'
|
||||
icon_state = "ishotgunstep1"
|
||||
|
||||
/obj/item/weaponcrafting/ishotgunconstruction2/attackby(obj/item/W as obj, mob/user as mob)
|
||||
if(istype(W,/obj/item/weaponcrafting/stock))
|
||||
user << "You attach the stock to the receiver-barrel assembly."
|
||||
var/obj/item/weaponcrafting/ishotgunconstruction3/I = new /obj/item/weaponcrafting/ishotgunconstruction3
|
||||
user.unEquip(src)
|
||||
user.put_in_hands(I)
|
||||
del(W)
|
||||
del(src)
|
||||
return
|
||||
|
||||
/obj/item/weaponcrafting/ishotgunconstruction3
|
||||
name = "extremely conspicuous metal construction"
|
||||
desc = "A receiver-barrel shotgun assembly with a loose wooden stock. There's no way you can fire it without the stock coming loose."
|
||||
icon = 'icons/obj/improvised.dmi'
|
||||
icon_state = "ishotgunstep2"
|
||||
|
||||
/obj/item/weaponcrafting/ishotgunconstruction3/attackby(var/obj/item/I, mob/user as mob)
|
||||
..()
|
||||
if(istype(I, /obj/item/stack/packageWrap))
|
||||
var/obj/item/stack/packageWrap/C = I
|
||||
if (C.use(5))
|
||||
var/obj/item/weapon/gun/projectile/revolver/doublebarrel/improvised/W = new /obj/item/weapon/gun/projectile/revolver/doublebarrel/improvised
|
||||
user.unEquip(src)
|
||||
user.put_in_hands(W)
|
||||
user << "<span class='notice'>You tie the wrapping paper around the stock and the barrel to secure it.</span>"
|
||||
qdel(src)
|
||||
else
|
||||
user << "<span class='warning'>You need at least five feet of wrapping paper to secure the stock.</span>"
|
||||
return
|
||||
|
||||
@@ -0,0 +1,138 @@
|
||||
/datum/table_recipe
|
||||
var/name = "" //in-game display name
|
||||
var/reqs[] = list() //type paths of items consumed associated with how many are needed
|
||||
var/result //type path of item resulting from this craft
|
||||
var/tools[] = list() //type paths of items needed but not consumed
|
||||
var/time = 30 //time in deciseconds
|
||||
var/parts[] = list() //type paths of items that will be placed in the result
|
||||
var/chem_catalists[] = list() //like tools but for reagents
|
||||
|
||||
|
||||
/datum/table_recipe/IED
|
||||
name = "IED"
|
||||
result = /obj/item/weapon/grenade/iedcasing
|
||||
reqs = list(/datum/reagent/fuel = 50,
|
||||
/obj/item/stack/cable_coil = 1,
|
||||
/obj/item/device/assembly/igniter = 1,
|
||||
/obj/item/weapon/reagent_containers/food/drinks/cans = 1)
|
||||
parts = list(/obj/item/weapon/reagent_containers/food/drinks/cans = 1)
|
||||
time = 80
|
||||
|
||||
/datum/table_recipe/stunprod
|
||||
name = "Stunprod"
|
||||
result = /obj/item/weapon/melee/baton/cattleprod
|
||||
reqs = list(/obj/item/weapon/restraints/handcuffs/cable = 1,
|
||||
/obj/item/stack/rods = 1,
|
||||
/obj/item/weapon/wirecutters = 1,
|
||||
/obj/item/weapon/stock_parts/cell = 1)
|
||||
time = 80
|
||||
parts = list(/obj/item/weapon/stock_parts/cell = 1)
|
||||
|
||||
/datum/table_recipe/ed209
|
||||
name = "ED209"
|
||||
result = /obj/machinery/bot/ed209
|
||||
reqs = list(/obj/item/robot_parts/robot_suit = 1,
|
||||
/obj/item/clothing/head/helmet = 1,
|
||||
/obj/item/clothing/suit/armor/vest = 1,
|
||||
/obj/item/robot_parts/l_leg = 1,
|
||||
/obj/item/robot_parts/r_leg = 1,
|
||||
/obj/item/stack/sheet/metal = 5,
|
||||
/obj/item/stack/cable_coil = 5,
|
||||
/obj/item/weapon/gun/energy/advtaser = 1,
|
||||
/obj/item/weapon/stock_parts/cell = 1,
|
||||
/obj/item/device/assembly/prox_sensor = 1,
|
||||
/obj/item/robot_parts/r_arm = 1)
|
||||
tools = list(/obj/item/weapon/weldingtool, /obj/item/weapon/screwdriver)
|
||||
time = 120
|
||||
|
||||
/datum/table_recipe/secbot
|
||||
name = "Secbot"
|
||||
result = /obj/machinery/bot/secbot
|
||||
reqs = list(/obj/item/device/assembly/signaler = 1,
|
||||
/obj/item/clothing/head/helmet = 1,
|
||||
/obj/item/weapon/melee/baton = 1,
|
||||
/obj/item/device/assembly/prox_sensor = 1,
|
||||
/obj/item/robot_parts/r_arm = 1)
|
||||
tools = list(/obj/item/weapon/weldingtool)
|
||||
time = 120
|
||||
|
||||
/datum/table_recipe/cleanbot
|
||||
name = "Cleanbot"
|
||||
result = /obj/machinery/bot/cleanbot
|
||||
reqs = list(/obj/item/weapon/reagent_containers/glass/bucket = 1,
|
||||
/obj/item/device/assembly/prox_sensor = 1,
|
||||
/obj/item/robot_parts/r_arm = 1)
|
||||
time = 80
|
||||
|
||||
/datum/table_recipe/floorbot
|
||||
name = "Floorbot"
|
||||
result = /obj/machinery/bot/floorbot
|
||||
reqs = list(/obj/item/weapon/storage/toolbox/mechanical = 1,
|
||||
/obj/item/stack/tile/plasteel = 1,
|
||||
/obj/item/device/assembly/prox_sensor = 1,
|
||||
/obj/item/robot_parts/r_arm = 1)
|
||||
time = 80
|
||||
|
||||
/datum/table_recipe/medbot
|
||||
name = "Medbot"
|
||||
result = /obj/machinery/bot/medbot
|
||||
reqs = list(/obj/item/device/healthanalyzer = 1,
|
||||
/obj/item/weapon/storage/firstaid = 1,
|
||||
/obj/item/device/assembly/prox_sensor = 1,
|
||||
/obj/item/robot_parts/r_arm = 1)
|
||||
time = 80
|
||||
|
||||
/datum/table_recipe/flamethrower
|
||||
name = "Flamethrower"
|
||||
result = /obj/item/weapon/flamethrower
|
||||
reqs = list(/obj/item/weapon/weldingtool = 1,
|
||||
/obj/item/device/assembly/igniter = 1,
|
||||
/obj/item/stack/rods = 2)
|
||||
tools = list(/obj/item/weapon/screwdriver)
|
||||
time = 20
|
||||
|
||||
/datum/table_recipe/meteorshot
|
||||
name = "Meteorshot Shell"
|
||||
result = /obj/item/ammo_casing/shotgun/meteorshot
|
||||
reqs = list(/obj/item/ammo_casing/shotgun/techshell = 1,
|
||||
/obj/item/weapon/rcd_ammo = 1,
|
||||
/obj/item/weapon/stock_parts/manipulator = 2)
|
||||
tools = list(/obj/item/weapon/screwdriver)
|
||||
time = 5
|
||||
|
||||
/datum/table_recipe/pulseslug
|
||||
name = "Pulse Slug Shell"
|
||||
result = /obj/item/ammo_casing/shotgun/pulseslug
|
||||
reqs = list(/obj/item/ammo_casing/shotgun/techshell = 1,
|
||||
/obj/item/weapon/stock_parts/capacitor/adv = 2,
|
||||
/obj/item/weapon/stock_parts/micro_laser/ultra = 1)
|
||||
tools = list(/obj/item/weapon/screwdriver)
|
||||
time = 5
|
||||
|
||||
/datum/table_recipe/dragonsbreath
|
||||
name = "Dragonsbreath Shell"
|
||||
result = /obj/item/ammo_casing/shotgun/incendiary/dragonsbreath
|
||||
reqs = list(/obj/item/ammo_casing/shotgun/techshell = 1,
|
||||
/datum/reagent/phosphorus = 5,)
|
||||
tools = list(/obj/item/weapon/screwdriver)
|
||||
time = 5
|
||||
|
||||
/datum/table_recipe/frag12
|
||||
name = "FRAG-12 Shell"
|
||||
result = /obj/item/ammo_casing/shotgun/frag12
|
||||
reqs = list(/obj/item/ammo_casing/shotgun/techshell = 1,
|
||||
/datum/reagent/glycerol = 5,
|
||||
/datum/reagent/sacid = 5,
|
||||
/datum/reagent/pacid = 5,)
|
||||
tools = list(/obj/item/weapon/screwdriver)
|
||||
time = 5
|
||||
|
||||
/datum/table_recipe/ishotgun
|
||||
name = "Improvised Shotgun"
|
||||
result = /obj/item/weapon/gun/projectile/revolver/doublebarrel/improvised
|
||||
reqs = list(/obj/item/weaponcrafting/receiver = 1,
|
||||
/obj/item/pipe = 1,
|
||||
/obj/item/weaponcrafting/stock = 1,
|
||||
/obj/item/stack/packageWrap = 5,)
|
||||
tools = list(/obj/item/weapon/screwdriver)
|
||||
time = 200
|
||||
@@ -0,0 +1,200 @@
|
||||
#define TABLECRAFT_MAX_ITEMS 30
|
||||
|
||||
/obj/structure/table
|
||||
var/list/table_contents = list()
|
||||
|
||||
/obj/structure/table/MouseDrop(atom/over)
|
||||
if(over != usr)
|
||||
return
|
||||
interact(usr)
|
||||
|
||||
/obj/structure/table/proc/check_contents(datum/table_recipe/R)
|
||||
check_table()
|
||||
main_loop:
|
||||
for(var/A in R.reqs)
|
||||
for(var/B in table_contents)
|
||||
if(ispath(B, A))
|
||||
if(table_contents[B] >= R.reqs[A])
|
||||
continue main_loop
|
||||
return 0
|
||||
for(var/A in R.chem_catalists)
|
||||
if(table_contents[A] < R.chem_catalists[A])
|
||||
return 0
|
||||
return 1
|
||||
|
||||
/obj/structure/table/proc/check_table()
|
||||
table_contents = list()
|
||||
for(var/obj/item/I in loc)
|
||||
if(istype(I, /obj/item/stack))
|
||||
var/obj/item/stack/S = I
|
||||
table_contents[I.type] += S.amount
|
||||
else
|
||||
if(istype(I, /obj/item/weapon/reagent_containers))
|
||||
var/obj/item/weapon/reagent_containers/RC = I
|
||||
if(RC.flags & OPENCONTAINER)
|
||||
for(var/datum/reagent/A in RC.reagents.reagent_list)
|
||||
table_contents[A.type] += A.volume
|
||||
table_contents[I.type] += 1
|
||||
|
||||
/obj/structure/table/proc/check_tools(mob/user, datum/table_recipe/R)
|
||||
if(!R.tools.len)
|
||||
return 1
|
||||
var/list/possible_tools = list()
|
||||
for(var/obj/item/I in user.contents)
|
||||
if(istype(I, /obj/item/weapon/storage))
|
||||
for(var/obj/item/SI in I.contents)
|
||||
possible_tools += SI.type
|
||||
else
|
||||
possible_tools += I.type
|
||||
possible_tools += table_contents
|
||||
var/i = R.tools.len
|
||||
var/I
|
||||
for(var/A in R.tools)
|
||||
I = possible_tools.Find(A)
|
||||
if(I)
|
||||
possible_tools.Cut(I, I+1)
|
||||
i--
|
||||
else
|
||||
break
|
||||
return !i
|
||||
|
||||
/obj/structure/table/proc/construct_item(mob/user, datum/table_recipe/R)
|
||||
check_table()
|
||||
if(check_contents(R) && check_tools(user, R))
|
||||
if(do_after(user, R.time))
|
||||
if(!check_contents(R) || !check_tools(user, R))
|
||||
return 0
|
||||
var/atom/movable/I = new R.result (loc)
|
||||
var/list/parts = del_reqs(R, I)
|
||||
for(var/A in parts)
|
||||
if(istype(A, /obj/item))
|
||||
var/atom/movable/B = A
|
||||
B.loc = I
|
||||
else
|
||||
if(!I.reagents)
|
||||
I.reagents = new /datum/reagents()
|
||||
I.reagents.reagent_list.Add(A)
|
||||
I.CheckParts()
|
||||
return 1
|
||||
return 0
|
||||
|
||||
/obj/structure/table/proc/del_reqs(datum/table_recipe/R, atom/movable/resultobject)
|
||||
var/list/Deletion = list()
|
||||
var/amt
|
||||
var/reagenttransfer = 0
|
||||
if(istype(resultobject,/obj/item/weapon/reagent_containers))
|
||||
reagenttransfer = 1
|
||||
for(var/A in R.reqs)
|
||||
amt = R.reqs[A]
|
||||
if(ispath(A, /obj/item/stack))
|
||||
var/obj/item/stack/S
|
||||
stack_loop:
|
||||
for(var/B in table_contents)
|
||||
if(ispath(B, A))
|
||||
while(amt > 0)
|
||||
S = locate(B) in loc
|
||||
if(S.amount >= amt)
|
||||
S.use(amt)
|
||||
break stack_loop
|
||||
else
|
||||
amt -= S.amount
|
||||
qdel(S)
|
||||
else if(ispath(A, /obj/item))
|
||||
var/obj/item/I
|
||||
item_loop:
|
||||
for(var/B in table_contents)
|
||||
if(ispath(B, A))
|
||||
while(amt > 0)
|
||||
I = locate(B) in loc
|
||||
Deletion.Add(I)
|
||||
I.loc = null //remove it from the table loc so that we don't locate the same item every time (will be relocated inside the crafted item in construct_item())
|
||||
amt--
|
||||
if(reagenttransfer && istype(I,/obj/item/weapon/reagent_containers))
|
||||
var/obj/item/weapon/reagent_containers/RC = I
|
||||
RC.reagents.trans_to(resultobject, RC.reagents.total_volume)
|
||||
break item_loop
|
||||
else
|
||||
var/datum/reagent/RG = new A
|
||||
reagent_loop:
|
||||
for(var/B in table_contents)
|
||||
if(ispath(B, /obj/item/weapon/reagent_containers))
|
||||
var/obj/item/RC = locate(B) in loc
|
||||
if(RC.reagents.has_reagent(RG.id, amt))
|
||||
if(reagenttransfer)
|
||||
RC.reagents.trans_id_to(resultobject,RG.id, amt)
|
||||
else
|
||||
RC.reagents.remove_reagent(RG.id, amt)
|
||||
RG.volume = amt
|
||||
Deletion.Add(RG)
|
||||
break reagent_loop
|
||||
else if(RC.reagents.has_reagent(RG.id))
|
||||
Deletion.Add(RG)
|
||||
RG.volume += RC.reagents.get_reagent_amount(RG.id)
|
||||
amt -= RC.reagents.get_reagent_amount(RG.id)
|
||||
if(reagenttransfer)
|
||||
RC.reagents.trans_id_to(resultobject,RG.id, RG.volume)
|
||||
else
|
||||
RC.reagents.del_reagent(RG.id)
|
||||
|
||||
var/list/partlist = list(R.parts.len)
|
||||
for(var/M in R.parts)
|
||||
partlist[M] = R.parts[M]
|
||||
deletion_loop:
|
||||
for(var/B in Deletion)
|
||||
for(var/A in R.parts)
|
||||
if(istype(B, A))
|
||||
if(partlist[A] > 0) //do we still need a part like that?
|
||||
partlist[A] -= 1
|
||||
continue deletion_loop
|
||||
Deletion.Remove(B)
|
||||
qdel(B)
|
||||
|
||||
return Deletion
|
||||
|
||||
/obj/structure/table/interact(mob/user)
|
||||
if(user.stat || user.lying || !Adjacent(user))
|
||||
return
|
||||
check_table()
|
||||
if(!table_contents.len)
|
||||
return
|
||||
user.face_atom(src)
|
||||
var/dat = "<h3>Crafting menu</h3>"
|
||||
dat += "<div class='statusDisplay'>"
|
||||
if(busy)
|
||||
dat += "Crafting in progress...</div>"
|
||||
else
|
||||
for(var/datum/table_recipe/R in table_recipes)
|
||||
if(check_contents(R))
|
||||
dat += "<A href='?src=\ref[src];make=\ref[R]'>[R.name]</A><BR>"
|
||||
dat += "</div>"
|
||||
|
||||
var/datum/browser/popup = new(user, "table", "Table", 300, 300)
|
||||
popup.set_content(dat)
|
||||
popup.open()
|
||||
return
|
||||
|
||||
/obj/structure/table/Topic(href, href_list)
|
||||
if(usr.stat || !Adjacent(usr) || usr.lying)
|
||||
return
|
||||
if(href_list["make"])
|
||||
if(!check_table_space())
|
||||
usr << "<span class ='warning'>The table is too crowded.</span>"
|
||||
return
|
||||
var/datum/table_recipe/TR = locate(href_list["make"])
|
||||
busy = 1
|
||||
interact(usr)
|
||||
if(construct_item(usr, TR))
|
||||
usr << "<span class='notice'>[TR.name] constructed.</span>"
|
||||
else
|
||||
usr << "<span class ='warning'>Construction failed.</span>"
|
||||
busy = 0
|
||||
interact(usr)
|
||||
|
||||
/obj/structure/table/proc/check_table_space()
|
||||
var/Item_amount = 0
|
||||
for(var/obj/item/I in loc)
|
||||
Item_amount++
|
||||
if(Item_amount <= TABLECRAFT_MAX_ITEMS) //is the table crowded?
|
||||
return 1
|
||||
|
||||
#undef TABLECRAFT_MAX_ITEMS
|
||||
@@ -95,6 +95,12 @@
|
||||
desc = "An incendiary-coated shotgun slug."
|
||||
icon_state = "ishell"
|
||||
projectile_type = "/obj/item/projectile/bullet/incendiary/shell"
|
||||
|
||||
/obj/item/ammo_casing/shotgun/frag12
|
||||
name = "FRAG-12 slug"
|
||||
desc = "A high explosive breaching round for a 12 gauge shotgun."
|
||||
icon_state = "heshell"
|
||||
projectile_type = /obj/item/projectile/bullet/frag12
|
||||
|
||||
/obj/item/ammo_casing/shotgun/incendiary/dragonsbreath
|
||||
name = "dragonsbreath shell"
|
||||
|
||||
@@ -205,4 +205,9 @@ obj/item/projectile/kinetic/New()
|
||||
|
||||
/obj/item/effect/kinetic_blast/New()
|
||||
spawn(4)
|
||||
del(src)
|
||||
del(src)
|
||||
|
||||
/obj/item/projectile/bullet/frag12
|
||||
name ="explosive slug"
|
||||
damage = 25
|
||||
weaken = 5
|
||||
|
||||
@@ -1,157 +1,189 @@
|
||||
/obj/structure/bigDelivery
|
||||
desc = "A big wrapped package."
|
||||
name = "large parcel"
|
||||
desc = "A big wrapped package."
|
||||
icon = 'icons/obj/storage.dmi'
|
||||
icon_state = "deliverycloset"
|
||||
var/obj/wrapped = null
|
||||
density = 1
|
||||
var/sortTag = 0
|
||||
flags = NOBLUDGEON
|
||||
mouse_drag_pointer = MOUSE_ACTIVE_POINTER
|
||||
var/obj/wrapped = null
|
||||
var/giftwrapped = 0
|
||||
var/sortTag = 0
|
||||
|
||||
attack_hand(mob/user as mob)
|
||||
if(wrapped) //sometimes items can disappear. For example, bombs. --rastaf0
|
||||
wrapped.loc = (get_turf(src.loc))
|
||||
if(istype(wrapped, /obj/structure/closet))
|
||||
var/obj/structure/closet/O = wrapped
|
||||
O.welded = 0
|
||||
del(src)
|
||||
return
|
||||
|
||||
attackby(obj/item/W as obj, mob/user as mob)
|
||||
if(istype(W, /obj/item/device/destTagger))
|
||||
var/obj/item/device/destTagger/O = W
|
||||
/obj/structure/bigDelivery/attack_hand(mob/user as mob)
|
||||
qdel(src)
|
||||
|
||||
if(src.sortTag != O.currTag)
|
||||
var/tag = uppertext(TAGGERLOCATIONS[O.currTag])
|
||||
user << "\blue *[tag]*"
|
||||
src.sortTag = O.currTag
|
||||
playsound(src.loc, 'sound/machines/twobeep.ogg', 100, 1)
|
||||
/obj/structure/bigDelivery/Destroy()
|
||||
if(wrapped) //sometimes items can disappear. For example, bombs. --rastaf0
|
||||
wrapped.loc = (get_turf(loc))
|
||||
if(istype(wrapped, /obj/structure/closet))
|
||||
var/obj/structure/closet/O = wrapped
|
||||
O.welded = 0
|
||||
var/turf/T = get_turf(src)
|
||||
for(var/atom/movable/AM in contents)
|
||||
AM.loc = T
|
||||
..()
|
||||
|
||||
/obj/structure/bigDelivery/attackby(obj/item/W as obj, mob/user as mob)
|
||||
if(istype(W, /obj/item/device/destTagger))
|
||||
var/obj/item/device/destTagger/O = W
|
||||
|
||||
if(sortTag != O.currTag)
|
||||
var/tag = uppertext(TAGGERLOCATIONS[O.currTag])
|
||||
user << "<span class='notice'>*[tag]*</span>"
|
||||
sortTag = O.currTag
|
||||
playsound(loc, 'sound/machines/twobeep.ogg', 100, 1)
|
||||
|
||||
else if(istype(W, /obj/item/weapon/pen))
|
||||
var/str = copytext(sanitize(input(user,"Label text?","Set label","")),1,MAX_NAME_LEN)
|
||||
if(!str || !length(str))
|
||||
user << "<span class='notice'>Invalid text.</span>"
|
||||
return
|
||||
user.visible_message("<span class='notice'>[user] labels [src] as [str].</span>")
|
||||
name = "[name] ([str])"
|
||||
|
||||
else if(istype(W, /obj/item/stack/wrapping_paper) && !giftwrapped)
|
||||
var/obj/item/stack/wrapping_paper/WP = W
|
||||
if(WP.use(3))
|
||||
user.visible_message("<span class='notice'>[user] wraps the package in festive paper!</span>")
|
||||
giftwrapped = 1
|
||||
if(istype(wrapped, /obj/structure/closet/crate))
|
||||
icon_state = "giftcrate"
|
||||
else
|
||||
icon_state = "giftcloset"
|
||||
if(WP.amount <= 0 && !WP.loc) //if we used our last wrapping paper, drop a cardboard tube
|
||||
new /obj/item/weapon/c_tube( get_turf(user) )
|
||||
else
|
||||
user << "<span class='notice'>You need more paper.</span>"
|
||||
|
||||
else if(istype(W, /obj/item/weapon/pen))
|
||||
var/str = sanitize(copytext(input(usr,"Label text?","Set label",""),1,MAX_NAME_LEN))
|
||||
if(!str || !length(str))
|
||||
usr << "\red Invalid text."
|
||||
return
|
||||
for(var/mob/M in viewers())
|
||||
M << "\blue [user] labels [src] as [str]."
|
||||
src.name = "[src.name] ([str])"
|
||||
return
|
||||
|
||||
/obj/item/smallDelivery
|
||||
desc = "A small wrapped package."
|
||||
name = "small parcel"
|
||||
desc = "A small wrapped package."
|
||||
icon = 'icons/obj/storage.dmi'
|
||||
icon_state = "deliverycrateSmall"
|
||||
var/obj/item/wrapped = null
|
||||
var/giftwrapped = 0
|
||||
var/sortTag = 0
|
||||
|
||||
|
||||
attack_self(mob/user as mob)
|
||||
if (src.wrapped) //sometimes items can disappear. For example, bombs. --rastaf0
|
||||
wrapped.loc = user.loc
|
||||
if(ishuman(user))
|
||||
user.put_in_hands(wrapped)
|
||||
else
|
||||
wrapped.loc = get_turf_loc(src)
|
||||
/obj/item/smallDelivery/attack_self(mob/user as mob)
|
||||
if(wrapped && wrapped.loc) //sometimes items can disappear. For example, bombs. --rastaf0
|
||||
wrapped.loc = user.loc
|
||||
if(ishuman(user))
|
||||
user.put_in_hands(wrapped)
|
||||
else
|
||||
wrapped.loc = get_turf(src)
|
||||
|
||||
del(src)
|
||||
return
|
||||
|
||||
attackby(obj/item/W as obj, mob/user as mob)
|
||||
if(istype(W, /obj/item/device/destTagger))
|
||||
var/obj/item/device/destTagger/O = W
|
||||
|
||||
if(src.sortTag != O.currTag)
|
||||
var/tag = uppertext(TAGGERLOCATIONS[O.currTag])
|
||||
user << "\blue *[tag]*"
|
||||
src.sortTag = O.currTag
|
||||
playsound(src.loc, 'sound/machines/twobeep.ogg', 100, 1)
|
||||
|
||||
else if(istype(W, /obj/item/weapon/pen))
|
||||
var/str = sanitize(copytext(input(usr,"Label text?","Set label",""),1,MAX_NAME_LEN))
|
||||
if(!str || !length(str))
|
||||
usr << "\red Invalid text."
|
||||
return
|
||||
for(var/mob/M in viewers())
|
||||
M << "\blue [user] labels [src] as [str]."
|
||||
src.name = "[src.name] ([str])"
|
||||
return
|
||||
qdel(src)
|
||||
|
||||
|
||||
/obj/item/weapon/packageWrap
|
||||
/obj/item/smallDelivery/attackby(obj/item/W as obj, mob/user as mob)
|
||||
if(istype(W, /obj/item/device/destTagger))
|
||||
var/obj/item/device/destTagger/O = W
|
||||
|
||||
if(sortTag != O.currTag)
|
||||
var/tag = uppertext(TAGGERLOCATIONS[O.currTag])
|
||||
user << "<span class='notice'>*[tag]*</span>"
|
||||
sortTag = O.currTag
|
||||
playsound(loc, 'sound/machines/twobeep.ogg', 100, 1)
|
||||
|
||||
else if(istype(W, /obj/item/weapon/pen))
|
||||
var/str = copytext(sanitize(input(user,"Label text?","Set label","")),1,MAX_NAME_LEN)
|
||||
if(!str || !length(str))
|
||||
user << "<span class='notice'>Invalid text.</span>"
|
||||
return
|
||||
user.visible_message("<span class='notice'>[user] labels [src] as [str].</span>")
|
||||
name = "[name] ([str])"
|
||||
|
||||
else if(istype(W, /obj/item/stack/wrapping_paper) && !giftwrapped)
|
||||
var/obj/item/stack/wrapping_paper/WP = W
|
||||
if(WP.use(1))
|
||||
icon_state = "giftcrate[wrapped.w_class]"
|
||||
giftwrapped = 1
|
||||
user.visible_message("<span class='notice'>[user] wraps the package in festive paper!</span>")
|
||||
if(WP.amount <= 0 && !WP.loc) //if we used our last wrapping paper, drop a cardboard tube
|
||||
new /obj/item/weapon/c_tube( get_turf(user) )
|
||||
else
|
||||
user << "<span class='notice'>You need more paper.</span>"
|
||||
|
||||
|
||||
|
||||
/obj/item/stack/packageWrap
|
||||
name = "package wrapper"
|
||||
icon = 'icons/obj/items.dmi'
|
||||
icon_state = "deliveryPaper"
|
||||
w_class = 3.0
|
||||
var/amount = 25.0
|
||||
flags = NOBLUDGEON
|
||||
amount = 25
|
||||
max_amount = 25
|
||||
|
||||
|
||||
afterattack(var/obj/target as obj, mob/user as mob, proximity)
|
||||
if(!proximity) return
|
||||
if(!istype(target)) //this really shouldn't be necessary (but it is). -Pete
|
||||
return
|
||||
if(istype(target, /obj/item/smallDelivery) || istype(target,/obj/structure/bigDelivery) \
|
||||
|| istype(target, /obj/item/weapon/gift) || istype(target, /obj/item/weapon/evidencebag))
|
||||
return
|
||||
if(target.anchored)
|
||||
return
|
||||
if(target in user)
|
||||
return
|
||||
|
||||
user.attack_log += text("\[[time_stamp()]\] <font color='blue'>Has used [src.name] on \ref[target]</font>")
|
||||
/obj/item/stack/packageWrap/afterattack(var/obj/target as obj, mob/user as mob, proximity)
|
||||
if(!proximity) return
|
||||
if(!istype(target)) //this really shouldn't be necessary (but it is). -Pete
|
||||
return
|
||||
if(istype(target, /obj/item/smallDelivery) || istype(target,/obj/structure/bigDelivery) \
|
||||
|| istype(target, /obj/item/weapon/evidencebag) || istype(target, /obj/structure/closet/body_bag))
|
||||
return
|
||||
if(target.anchored)
|
||||
return
|
||||
if(target in user)
|
||||
return
|
||||
|
||||
|
||||
if (istype(target, /obj/item) && !(istype(target, /obj/item/weapon/storage) && !istype(target,/obj/item/weapon/storage/box)))
|
||||
var/obj/item/O = target
|
||||
if (src.amount > 1)
|
||||
var/obj/item/smallDelivery/P = new /obj/item/smallDelivery(get_turf(O.loc)) //Aaannd wrap it up!
|
||||
if(!istype(O.loc, /turf))
|
||||
if(user.client)
|
||||
user.client.screen -= O
|
||||
P.wrapped = O
|
||||
O.loc = P
|
||||
var/i = round(O.w_class)
|
||||
if(i in list(1,2,3,4,5))
|
||||
P.icon_state = "deliverycrate[i]"
|
||||
P.add_fingerprint(usr)
|
||||
O.add_fingerprint(usr)
|
||||
src.add_fingerprint(usr)
|
||||
src.amount -= 1
|
||||
else if (istype(target, /obj/structure/closet/crate))
|
||||
var/obj/structure/closet/crate/O = target
|
||||
if (src.amount > 3 && !O.opened)
|
||||
var/obj/structure/bigDelivery/P = new /obj/structure/bigDelivery(get_turf(O.loc))
|
||||
P.icon_state = "deliverycrate"
|
||||
P.wrapped = O
|
||||
O.loc = P
|
||||
src.amount -= 3
|
||||
else if(src.amount < 3)
|
||||
user << "\blue You need more paper."
|
||||
else if (istype (target, /obj/structure/closet))
|
||||
var/obj/structure/closet/O = target
|
||||
if (src.amount > 3 && !O.opened)
|
||||
var/obj/structure/bigDelivery/P = new /obj/structure/bigDelivery(get_turf(O.loc))
|
||||
P.wrapped = O
|
||||
O.welded = 1
|
||||
O.loc = P
|
||||
src.amount -= 3
|
||||
else if(src.amount < 3)
|
||||
user << "\blue You need more paper."
|
||||
|
||||
if(istype(target, /obj/item) && !(istype(target, /obj/item/weapon/storage) && !istype(target,/obj/item/weapon/storage/box)))
|
||||
var/obj/item/O = target
|
||||
if(use(1))
|
||||
var/obj/item/smallDelivery/P = new /obj/item/smallDelivery(get_turf(O.loc)) //Aaannd wrap it up!
|
||||
if(!istype(O.loc, /turf))
|
||||
if(user.client)
|
||||
user.client.screen -= O
|
||||
P.wrapped = O
|
||||
O.loc = P
|
||||
var/i = round(O.w_class)
|
||||
if(i in list(1,2,3,4,5))
|
||||
P.icon_state = "deliverycrate[i]"
|
||||
P.w_class = i
|
||||
P.add_fingerprint(usr)
|
||||
O.add_fingerprint(usr)
|
||||
add_fingerprint(usr)
|
||||
else
|
||||
user << "\blue The object you are trying to wrap is unsuitable for the sorting machinery!"
|
||||
if (src.amount <= 0)
|
||||
new /obj/item/weapon/c_tube( src.loc )
|
||||
del(src)
|
||||
return
|
||||
else if(istype(target, /obj/structure/closet/crate))
|
||||
var/obj/structure/closet/crate/O = target
|
||||
if(O.opened)
|
||||
return
|
||||
if(use(3))
|
||||
var/obj/structure/bigDelivery/P = new /obj/structure/bigDelivery(get_turf(O.loc))
|
||||
P.icon_state = "deliverycrate"
|
||||
P.wrapped = O
|
||||
O.loc = P
|
||||
else
|
||||
user << "<span class='notice'>You need more paper.</span>"
|
||||
return
|
||||
else if(istype (target, /obj/structure/closet))
|
||||
var/obj/structure/closet/O = target
|
||||
if(O.opened)
|
||||
return
|
||||
if(use(3))
|
||||
var/obj/structure/bigDelivery/P = new /obj/structure/bigDelivery(get_turf(O.loc))
|
||||
P.wrapped = O
|
||||
O.welded = 1
|
||||
O.loc = P
|
||||
else
|
||||
user << "<span class='notice'>You need more paper.</span>"
|
||||
return
|
||||
else
|
||||
user << "<span class='notice'>The object you are trying to wrap is unsuitable for the sorting machinery.</span>"
|
||||
return
|
||||
|
||||
examine()
|
||||
if(src in usr)
|
||||
usr << "\blue There are [amount] units of package wrap left!"
|
||||
..()
|
||||
return
|
||||
user.visible_message("<span class='notice'>[user] wraps [target].</span>")
|
||||
user.attack_log += text("\[[time_stamp()]\] <font color='blue'>Has used [name] on [target]</font>")
|
||||
|
||||
if(amount <= 0 && !src.loc) //if we used our last wrapping paper, drop a cardboard tube
|
||||
new /obj/item/weapon/c_tube( get_turf(user) )
|
||||
return
|
||||
|
||||
/obj/item/device/destTagger
|
||||
name = "destination tagger"
|
||||
|
||||
@@ -78,6 +78,16 @@
|
||||
build_path = /obj/item/weapon/gun/energy/lasercannon
|
||||
locked = 1
|
||||
category = list("Weapons")
|
||||
|
||||
/datum/design/receiver
|
||||
name = "Modular Receiver"
|
||||
desc = "A prototype modular receiver and trigger assembly for a variety of firearms."
|
||||
id = "receiver"
|
||||
req_tech = list("combat" = 5, "materials" = 4)
|
||||
build_type = PROTOLATHE
|
||||
materials = list("$metal" = 6500, "$silver" = 500)
|
||||
build_path = /obj/item/weaponcrafting/receiver
|
||||
category = list("Weapons")
|
||||
|
||||
/datum/design/plasmapistol
|
||||
name = "Plasma Pistol"
|
||||
|
||||
Reference in New Issue
Block a user