mirror of
https://github.com/PolarisSS13/Polaris.git
synced 2025-12-26 18:13:11 +00:00
A lot of new defines are now in inventory_sizes.dm, which contains; All the size identifiers (the thing that tells the game if something is bulky, or w/e). Storage costs for all the sizes, which are exponents of two, as previously. A few constants for inventory size. Also changes all storage item's capacity definitions by basing it off of how many 'normal slots' exist for it. This allows one to change the definition for all of the defines in the file, and everything will follow along without needing to change 500 files. In testing, I made all ITEMSIZE_COST_* defines doubled, and nothing had broke. The benefit of doing all of this is that it makes adding new weight classes in the future much simpler, and makes knowing how much space a container has easier, as seeing ITEMSIZE_COST_NORMAL * 7 means it can hold seven normal items.
203 lines
5.8 KiB
Plaintext
203 lines
5.8 KiB
Plaintext
//Contains the rapid construction device.
|
|
/obj/item/weapon/rcd
|
|
name = "rapid construction device"
|
|
desc = "A device used to rapidly build walls and floors."
|
|
icon = 'icons/obj/items.dmi'
|
|
icon_state = "rcd"
|
|
opacity = 0
|
|
density = 0
|
|
anchored = 0.0
|
|
flags = CONDUCT
|
|
force = 10.0
|
|
throwforce = 10.0
|
|
throw_speed = 1
|
|
throw_range = 5
|
|
w_class = ITEMSIZE_NORMAL
|
|
origin_tech = list(TECH_ENGINEERING = 4, TECH_MATERIAL = 2)
|
|
matter = list(DEFAULT_WALL_MATERIAL = 50000)
|
|
var/datum/effect/effect/system/spark_spread/spark_system
|
|
var/stored_matter = 0
|
|
var/working = 0
|
|
var/mode = 1
|
|
var/list/modes = list("Floor & Walls","Airlock","Deconstruct")
|
|
var/canRwall = 0
|
|
var/disabled = 0
|
|
|
|
/obj/item/weapon/rcd/attack()
|
|
return 0
|
|
|
|
/obj/item/weapon/rcd/proc/can_use(var/mob/user,var/turf/T)
|
|
return (user.Adjacent(T) && user.get_active_hand() == src && !user.stat && !user.restrained())
|
|
|
|
/obj/item/weapon/rcd/examine()
|
|
..()
|
|
if(src.type == /obj/item/weapon/rcd && loc == usr)
|
|
usr << "It currently holds [stored_matter]/30 matter-units."
|
|
|
|
/obj/item/weapon/rcd/New()
|
|
..()
|
|
src.spark_system = new /datum/effect/effect/system/spark_spread
|
|
spark_system.set_up(5, 0, src)
|
|
spark_system.attach(src)
|
|
|
|
/obj/item/weapon/rcd/Destroy()
|
|
qdel(spark_system)
|
|
spark_system = null
|
|
return ..()
|
|
|
|
/obj/item/weapon/rcd/attackby(obj/item/weapon/W, mob/user)
|
|
|
|
if(istype(W, /obj/item/weapon/rcd_ammo))
|
|
if((stored_matter + 10) > 30)
|
|
user << "<span class='notice'>The RCD can't hold any more matter-units.</span>"
|
|
return
|
|
user.drop_from_inventory(W)
|
|
qdel(W)
|
|
stored_matter += 10
|
|
playsound(src.loc, 'sound/machines/click.ogg', 50, 1)
|
|
user << "<span class='notice'>The RCD now holds [stored_matter]/30 matter-units.</span>"
|
|
return
|
|
..()
|
|
|
|
/obj/item/weapon/rcd/attack_self(mob/user)
|
|
//Change the mode
|
|
if(++mode > 3) mode = 1
|
|
user << "<span class='notice'>Changed mode to '[modes[mode]]'</span>"
|
|
playsound(src.loc, 'sound/effects/pop.ogg', 50, 0)
|
|
if(prob(20)) src.spark_system.start()
|
|
|
|
/obj/item/weapon/rcd/afterattack(atom/A, mob/user, proximity)
|
|
if(!proximity) return
|
|
if(disabled && !isrobot(user))
|
|
return 0
|
|
if(istype(get_area(A),/area/shuttle)||istype(get_area(A),/turf/space/transit))
|
|
return 0
|
|
return alter_turf(A,user,(mode == 3))
|
|
|
|
/obj/item/weapon/rcd/proc/useResource(var/amount, var/mob/user)
|
|
if(stored_matter < amount)
|
|
return 0
|
|
stored_matter -= amount
|
|
return 1
|
|
|
|
/obj/item/weapon/rcd/proc/alter_turf(var/turf/T,var/mob/user,var/deconstruct)
|
|
|
|
var/build_cost = 0
|
|
var/build_type
|
|
var/build_turf
|
|
var/build_delay
|
|
var/build_other
|
|
|
|
if(working == 1)
|
|
return 0
|
|
|
|
if(mode == 3 && istype(T,/obj/machinery/door/airlock))
|
|
build_cost = 10
|
|
build_delay = 50
|
|
build_type = "airlock"
|
|
else if(mode == 2 && !deconstruct && istype(T,/turf/simulated/floor))
|
|
build_cost = 10
|
|
build_delay = 50
|
|
build_type = "airlock"
|
|
build_other = /obj/machinery/door/airlock
|
|
else if(!deconstruct && (istype(T,/turf/space) || istype(T,get_base_turf_by_area(T))))
|
|
build_cost = 1
|
|
build_type = "floor"
|
|
build_turf = /turf/simulated/floor/airless
|
|
else if(!deconstruct && istype(T,/turf/simulated/mineral/floor))
|
|
build_cost = 1
|
|
build_type = "floor"
|
|
build_turf = /turf/simulated/floor/plating
|
|
else if(deconstruct && istype(T,/turf/simulated/wall))
|
|
var/turf/simulated/wall/W = T
|
|
build_delay = deconstruct ? 50 : 40
|
|
build_cost = 5
|
|
build_type = (!canRwall && W.reinf_material) ? null : "wall"
|
|
build_turf = /turf/simulated/floor
|
|
else if(istype(T,/turf/simulated/floor) || (istype(T,/turf/simulated/mineral) && !T.density))
|
|
var/turf/simulated/F = T
|
|
build_delay = deconstruct ? 50 : 20
|
|
build_cost = deconstruct ? 10 : 3
|
|
build_type = deconstruct ? "floor" : "wall"
|
|
if(F.check_destroy_override(F))
|
|
build_turf = deconstruct ? destroy_floor_override_path : /turf/simulated/wall
|
|
else
|
|
build_turf = deconstruct ? /turf/space : /turf/simulated/wall
|
|
|
|
if(!build_type)
|
|
working = 0
|
|
return 0
|
|
|
|
if(!useResource(build_cost, user))
|
|
user << "Insufficient resources."
|
|
return 0
|
|
|
|
playsound(src.loc, 'sound/machines/click.ogg', 50, 1)
|
|
|
|
working = 1
|
|
user << "[(deconstruct ? "Deconstructing" : "Building")] [build_type]..."
|
|
|
|
if(build_delay && !do_after(user, build_delay))
|
|
working = 0
|
|
return 0
|
|
|
|
working = 0
|
|
if(build_delay && !can_use(user,T))
|
|
return 0
|
|
|
|
if(build_turf)
|
|
T.ChangeTurf(build_turf)
|
|
else if(build_other)
|
|
new build_other(T)
|
|
else
|
|
qdel(T)
|
|
|
|
playsound(src.loc, 'sound/items/Deconstruct.ogg', 50, 1)
|
|
return 1
|
|
|
|
/obj/item/weapon/rcd_ammo
|
|
name = "compressed matter cartridge"
|
|
desc = "Highly compressed matter for the RCD."
|
|
icon = 'icons/obj/ammo.dmi'
|
|
icon_state = "rcd"
|
|
item_state = "rcdammo"
|
|
w_class = ITEMSIZE_SMALL
|
|
origin_tech = list(TECH_MATERIAL = 2)
|
|
matter = list(DEFAULT_WALL_MATERIAL = 30000,"glass" = 15000)
|
|
|
|
/obj/item/weapon/rcd/borg
|
|
canRwall = 1
|
|
|
|
/obj/item/weapon/rcd/borg/useResource(var/amount, var/mob/user)
|
|
if(isrobot(user))
|
|
var/mob/living/silicon/robot/R = user
|
|
if(R.cell)
|
|
var/cost = amount*30
|
|
if(R.cell.charge >= cost)
|
|
R.cell.use(cost)
|
|
return 1
|
|
return 0
|
|
|
|
/obj/item/weapon/rcd/borg/attackby()
|
|
return
|
|
|
|
/obj/item/weapon/rcd/borg/can_use(var/mob/user,var/turf/T)
|
|
return (user.Adjacent(T) && !user.stat)
|
|
|
|
|
|
/obj/item/weapon/rcd/mounted/useResource(var/amount, var/mob/user)
|
|
var/cost = amount*130 //so that a rig with default powercell can build ~2.5x the stuff a fully-loaded RCD can.
|
|
if(istype(loc,/obj/item/rig_module))
|
|
var/obj/item/rig_module/module = loc
|
|
if(module.holder && module.holder.cell)
|
|
if(module.holder.cell.charge >= cost)
|
|
module.holder.cell.use(cost)
|
|
return 1
|
|
return 0
|
|
|
|
/obj/item/weapon/rcd/mounted/attackby()
|
|
return
|
|
|
|
/obj/item/weapon/rcd/mounted/can_use(var/mob/user,var/turf/T)
|
|
return (user.Adjacent(T) && !user.stat && !user.restrained())
|