mirror of
https://github.com/Bubberstation/Bubberstation.git
synced 2026-01-19 05:26:28 +00:00
Works pretty well. If it can't GC something, it'll just del() it and be done. Speed is amazing, holy shit. New procs you should be aware of: qdel(atom/movable) - sets up an object for garbage collection. Call this rather than del(atom/movable). atom/movable/Destroy() - called right before the object is GC'd, so it still has a loc. Also called if the object is del()'d. new controller - garbage.dm has all the details on this. Basically it nulls all references on GC'd objects and force del() them if necessary. Generally speaking, objects should use Destroy() for behavior prior to deletion rather than Del(). You should also always call the parent so the object gets the right gc_destroyed var set. ISSUES: Tries to GC mobs atm. This actually works for new players, not so much for humans/monkies/simple_animals/anything. I'm guessing it needs to clear out their mind and HUD and maybe other things. Gibbing is really bugged. It works, but the overlays just sit there for awhile and ugh. I'm very tempted just to del() mob/living and mob/camera and call it a day. qdel() equipment doesn't unequip the item. Pipes don't generally GC correctly. Debugging suggests they get referenced in many pipenets and that isn't cleared properly. However some do work fine. Need assistance here. Bots don't GC, probably in the radio controller. Lots of other shit doesn't GC but it's hard to find them because of the pipe spam. I think I'm calling Destroy() twice by accident.
234 lines
8.0 KiB
Plaintext
234 lines
8.0 KiB
Plaintext
/*
|
|
CONTAINS:
|
|
RSF
|
|
|
|
*/
|
|
/obj/item/weapon/rsf
|
|
name = "\improper Rapid-Service-Fabricator"
|
|
desc = "A device used to rapidly deploy service items."
|
|
icon = 'icons/obj/items.dmi'
|
|
icon_state = "rcd"
|
|
opacity = 0
|
|
density = 0
|
|
anchored = 0.0
|
|
var/matter = 0
|
|
var/mode = 1
|
|
w_class = 3.0
|
|
|
|
/obj/item/weapon/rsf/New()
|
|
desc = "A RSF. It currently holds [matter]/30 fabrication-units."
|
|
return
|
|
|
|
/obj/item/weapon/rsf/attackby(obj/item/weapon/W as obj, mob/user as mob)
|
|
..()
|
|
if (istype(W, /obj/item/weapon/rcd_ammo))
|
|
if ((matter + 10) > 30)
|
|
user << "The RSF cant hold any more matter."
|
|
return
|
|
qdel(W)
|
|
matter += 10
|
|
playsound(src.loc, 'sound/machines/click.ogg', 10, 1)
|
|
user << "The RSF now holds [matter]/30 fabrication-units."
|
|
desc = "A RSF. It currently holds [matter]/30 fabrication-units."
|
|
return
|
|
|
|
/obj/item/weapon/rsf/attack_self(mob/user as mob)
|
|
playsound(src.loc, 'sound/effects/pop.ogg', 50, 0)
|
|
if (mode == 1)
|
|
mode = 2
|
|
user << "Changed dispensing mode to 'Drinking Glass'"
|
|
return
|
|
if (mode == 2)
|
|
mode = 3
|
|
user << "Changed dispensing mode to 'Paper'"
|
|
return
|
|
if (mode == 3)
|
|
mode = 4
|
|
user << "Changed dispensing mode to 'Pen'"
|
|
return
|
|
if (mode == 4)
|
|
mode = 5
|
|
user << "Changed dispensing mode to 'Dice Pack'"
|
|
return
|
|
if (mode == 5)
|
|
mode = 6
|
|
user << "Changed dispensing mode to 'Cigarette'"
|
|
return
|
|
if (mode == 6)
|
|
mode = 1
|
|
user << "Changed dispensing mode to 'Dosh'"
|
|
return
|
|
// Change mode
|
|
|
|
/obj/item/weapon/rsf/afterattack(atom/A, mob/user as mob, proximity)
|
|
if(!proximity) return
|
|
if (!(istype(A, /obj/structure/table) || istype(A, /turf/simulated/floor)))
|
|
return
|
|
|
|
if (istype(A, /obj/structure/table) && mode == 1)
|
|
if (istype(A, /obj/structure/table) && matter >= 1)
|
|
user << "Dispensing Dosh..."
|
|
playsound(src.loc, 'sound/machines/click.ogg', 10, 1)
|
|
new /obj/item/weapon/spacecash/c10( A.loc )
|
|
if (isrobot(user))
|
|
var/mob/living/silicon/robot/engy = user
|
|
engy.cell.charge -= 200 //once money becomes useful, I guess changing this to a high ammount, like 500 units a kick, till then, enjoy dosh!
|
|
else
|
|
matter--
|
|
user << "The RSF now holds [matter]/30 fabrication-units."
|
|
desc = "A RSF. It currently holds [matter]/30 fabrication-units."
|
|
return
|
|
|
|
else if (istype(A, /turf/simulated/floor) && mode == 1)
|
|
if (istype(A, /turf/simulated/floor) && matter >= 1)
|
|
user << "Dispensing Dosh..."
|
|
playsound(src.loc, 'sound/machines/click.ogg', 10, 1)
|
|
new /obj/item/weapon/spacecash/c10( A )
|
|
if (isrobot(user))
|
|
var/mob/living/silicon/robot/engy = user
|
|
engy.cell.charge -= 200 //once money becomes useful, I guess changing this to a high ammount, like 500 units a kick, till then, enjoy dosh!
|
|
else
|
|
matter--
|
|
user << "The RSF now holds [matter]/30 fabrication-units."
|
|
desc = "A RSF. It currently holds [matter]/30 fabrication-units."
|
|
return
|
|
|
|
else if (istype(A, /obj/structure/table) && mode == 2)
|
|
if (istype(A, /obj/structure/table) && matter >= 1)
|
|
user << "Dispensing Drinking Glass..."
|
|
playsound(src.loc, 'sound/machines/click.ogg', 10, 1)
|
|
new /obj/item/weapon/reagent_containers/food/drinks/drinkingglass( A.loc )
|
|
if (isrobot(user))
|
|
var/mob/living/silicon/robot/engy = user
|
|
engy.cell.charge -= 50
|
|
else
|
|
matter--
|
|
user << "The RSF now holds [matter]/30 fabrication-units."
|
|
desc = "A RSF. It currently holds [matter]/30 fabrication-units."
|
|
return
|
|
|
|
else if (istype(A, /turf/simulated/floor) && mode == 2)
|
|
if (istype(A, /turf/simulated/floor) && matter >= 1)
|
|
user << "Dispensing Drinking Glass..."
|
|
playsound(src.loc, 'sound/machines/click.ogg', 10, 1)
|
|
new /obj/item/weapon/reagent_containers/food/drinks/drinkingglass( A )
|
|
if (isrobot(user))
|
|
var/mob/living/silicon/robot/engy = user
|
|
engy.cell.charge -= 50
|
|
else
|
|
matter--
|
|
user << "The RSF now holds [matter]/30 fabrication-units."
|
|
desc = "A RSF. It currently holds [matter]/30 fabrication-units."
|
|
return
|
|
|
|
else if (istype(A, /obj/structure/table) && mode == 3)
|
|
if (istype(A, /obj/structure/table) && matter >= 1)
|
|
user << "Dispensing Paper Sheet..."
|
|
playsound(src.loc, 'sound/machines/click.ogg', 10, 1)
|
|
new /obj/item/weapon/paper( A.loc )
|
|
if (isrobot(user))
|
|
var/mob/living/silicon/robot/engy = user
|
|
engy.cell.charge -= 10
|
|
else
|
|
matter--
|
|
user << "The RSF now holds [matter]/30 fabrication-units."
|
|
desc = "A RSF. It currently holds [matter]/30 fabrication-units."
|
|
return
|
|
|
|
else if (istype(A, /turf/simulated/floor) && mode == 3)
|
|
if (istype(A, /turf/simulated/floor) && matter >= 1)
|
|
user << "Dispensing Paper Sheet..."
|
|
playsound(src.loc, 'sound/machines/click.ogg', 10, 1)
|
|
new /obj/item/weapon/paper( A )
|
|
if (isrobot(user))
|
|
var/mob/living/silicon/robot/engy = user
|
|
engy.cell.charge -= 10
|
|
else
|
|
matter--
|
|
user << "The RSF now holds [matter]/30 fabrication-units."
|
|
desc = "A RSF. It currently holds [matter]/30 fabrication-units."
|
|
return
|
|
|
|
else if (istype(A, /obj/structure/table) && mode == 4)
|
|
if (istype(A, /obj/structure/table) && matter >= 1)
|
|
user << "Dispensing Pen..."
|
|
playsound(src.loc, 'sound/machines/click.ogg', 10, 1)
|
|
new /obj/item/weapon/pen( A.loc )
|
|
if (isrobot(user))
|
|
var/mob/living/silicon/robot/engy = user
|
|
engy.cell.charge -= 50
|
|
else
|
|
matter--
|
|
user << "The RSF now holds [matter]/30 fabrication-units."
|
|
desc = "A RSF. It currently holds [matter]/30 fabrication-units."
|
|
return
|
|
|
|
else if (istype(A, /turf/simulated/floor) && mode == 4)
|
|
if (istype(A, /turf/simulated/floor) && matter >= 1)
|
|
user << "Dispensing Pen..."
|
|
playsound(src.loc, 'sound/machines/click.ogg', 10, 1)
|
|
new /obj/item/weapon/pen( A )
|
|
if (isrobot(user))
|
|
var/mob/living/silicon/robot/engy = user
|
|
engy.cell.charge -= 50
|
|
else
|
|
matter--
|
|
user << "The RSF now holds [matter]/30 fabrication-units."
|
|
desc = "A RSF. It currently holds [matter]/30 fabrication-units."
|
|
return
|
|
|
|
else if (istype(A, /obj/structure/table) && mode == 5)
|
|
if (istype(A, /obj/structure/table) && matter >= 1)
|
|
user << "Dispensing Dice Pack..."
|
|
playsound(src.loc, 'sound/machines/click.ogg', 10, 1)
|
|
new /obj/item/weapon/storage/pill_bottle/dice( A.loc )
|
|
if (isrobot(user))
|
|
var/mob/living/silicon/robot/engy = user
|
|
engy.cell.charge -= 200
|
|
else
|
|
matter--
|
|
user << "The RSF now holds [matter]/30 fabrication-units."
|
|
desc = "A RSF. It currently holds [matter]/30 fabrication-units."
|
|
return
|
|
|
|
else if (istype(A, /turf/simulated/floor) && mode == 5)
|
|
if (istype(A, /turf/simulated/floor) && matter >= 1)
|
|
user << "Dispensing Dice Pack..."
|
|
playsound(src.loc, 'sound/machines/click.ogg', 10, 1)
|
|
new /obj/item/weapon/storage/pill_bottle/dice( A )
|
|
if (isrobot(user))
|
|
var/mob/living/silicon/robot/engy = user
|
|
engy.cell.charge -= 200
|
|
else
|
|
matter--
|
|
user << "The RSF now holds [matter]/30 fabrication-units."
|
|
desc = "A RSF. It currently holds [matter]/30 fabrication-units."
|
|
return
|
|
|
|
else if (istype(A, /obj/structure/table) && mode == 6)
|
|
if (istype(A, /obj/structure/table) && matter >= 1)
|
|
user << "Dispensing Cigarette..."
|
|
playsound(src.loc, 'sound/machines/click.ogg', 10, 1)
|
|
new /obj/item/clothing/mask/cigarette( A.loc )
|
|
if (isrobot(user))
|
|
var/mob/living/silicon/robot/engy = user
|
|
engy.cell.charge -= 10
|
|
else
|
|
matter--
|
|
user << "The RSF now holds [matter]/30 fabrication-units."
|
|
desc = "A RSF. It currently holds [matter]/30 fabrication-units."
|
|
return
|
|
|
|
else if (istype(A, /turf/simulated/floor) && mode == 6)
|
|
if (istype(A, /turf/simulated/floor) && matter >= 1)
|
|
user << "Dispensing Cigarette..."
|
|
playsound(src.loc, 'sound/machines/click.ogg', 10, 1)
|
|
new /obj/item/clothing/mask/cigarette( A )
|
|
if (isrobot(user))
|
|
var/mob/living/silicon/robot/engy = user
|
|
engy.cell.charge -= 10
|
|
else
|
|
matter--
|
|
user << "The RSF now holds [matter]/30 fabrication-units."
|
|
desc = "A RSF. It currently holds [matter]/30 fabrication-units."
|
|
return |