[MIRROR] even more local defines (#8516)

Co-authored-by: Kashargul <144968721+Kashargul@users.noreply.github.com>
Co-authored-by: Kashargul <KashL@t-online.de>
This commit is contained in:
CHOMPStation2
2024-06-13 23:28:10 -07:00
committed by GitHub
parent 5a99e2b366
commit f172e1f5b3
113 changed files with 699 additions and 490 deletions

View File

@@ -1,5 +1,3 @@
#define PROCESS_REACTION_ITER 5 //when processing a reaction, iterate this many times
/datum/reagents
var/list/datum/reagent/reagent_list = list()
var/total_volume = 0

View File

@@ -5,11 +5,15 @@
#define SYRINGE_INJECT 1
#define SYRINGE_BROKEN 2
#define SYRINGE_CAPPED 10
/obj/item/weapon/reagent_containers/syringe
name = "syringe"
desc = "A syringe."
//description_fluff = "This could be used to engrave messages on suitable surfaces if you really put your mind to it! Alt-click a floor or wall to engrave with it." //This way it's not a completely hidden, arcane art to engrave. //CHOMP Remove
icon = 'icons/obj/syringe.dmi'
//description_fluff = "This could be used to engrave messages on suitable surfaces if you really put your mind to it! Alt-click a floor or wall to engrave with it." //This way it's not a completely hidden, arcane art to engrave. //CHOMP Remove
icon = 'icons/goonstation/objects/syringe_vr.dmi'
item_state = "syringe_0"
icon_state = "0"
center_of_mass_x = 16 //CHOMPEdit
@@ -22,14 +26,34 @@
slot_flags = SLOT_EARS
sharp = TRUE
unacidable = TRUE //glass
var/mode = SYRINGE_DRAW
var/mode = SYRINGE_CAPPED
var/image/filling //holds a reference to the current filling overlay
var/visible_name = "a syringe"
var/time = 30
var/drawing = 0
var/used = FALSE
var/dirtiness = 0
var/list/targets
var/list/datum/disease2/disease/viruses
drop_sound = 'sound/items/drop/glass.ogg'
pickup_sound = 'sound/items/pickup/glass.ogg'
/obj/item/weapon/reagent_containers/syringe/Initialize()
. = ..()
update_icon()
/obj/item/weapon/reagent_containers/syringe/Destroy()
QDEL_LIST_NULL(viruses)
LAZYCLEARLIST(targets)
return ..()
/obj/item/weapon/reagent_containers/syringe/process()
dirtiness = min(dirtiness + targets.len,75)
if(dirtiness >= 75)
STOP_PROCESSING(SSobj, src)
return 1
/obj/item/weapon/reagent_containers/syringe/on_reagent_change()
update_icon()
@@ -43,6 +67,10 @@
/obj/item/weapon/reagent_containers/syringe/attack_self(mob/user as mob)
switch(mode)
if(SYRINGE_CAPPED)
mode = SYRINGE_DRAW
// to_chat(user,"<span class='notice'>You uncap the syringe.</span>")
balloon_alert(user, "[src] uncapped") // CHOMPEdit - Changed to balloon_alert
if(SYRINGE_DRAW)
mode = SYRINGE_INJECT
if(SYRINGE_INJECT)
@@ -230,36 +258,8 @@
to_chat(user, "<span class='notice'>The syringe is empty.</span>")
// dirty(target,affected) //VOREStation Add -- Removed by Request
return
/* VOREStation Edit - See syringes_vr.dm
/obj/item/weapon/reagent_containers/syringe/update_icon()
cut_overlays()
if(mode == SYRINGE_BROKEN)
icon_state = "broken"
return
var/rounded_vol = round(reagents.total_volume, round(reagents.maximum_volume / 3))
if(ismob(loc))
var/injoverlay
switch(mode)
if (SYRINGE_DRAW)
injoverlay = "draw"
if (SYRINGE_INJECT)
injoverlay = "inject"
add_overlay(injoverlay)
icon_state = "[rounded_vol]"
item_state = "syringe_[rounded_vol]"
if(reagents.total_volume)
filling = image('icons/obj/reagentfillings.dmi', src, "syringe10")
filling.icon_state = "syringe[rounded_vol]"
filling.color = reagents.get_color()
add_overlay(filling)
*/
/obj/item/weapon/reagent_containers/syringe/proc/syringestab(mob/living/carbon/target as mob, mob/living/carbon/user as mob)
if(istype(target, /mob/living/carbon/human))
@@ -393,3 +393,93 @@
..()
//reagents.add_reagent("adrenaline",5) //VOREStation Edit - No thanks.
reagents.add_reagent("hyperzine",10)
/obj/item/weapon/reagent_containers/syringe/proc/dirty(var/mob/living/carbon/human/target, var/obj/item/organ/external/eo)
if(!ishuman(loc))
return //Avoid borg syringe problems.
LAZYINITLIST(targets)
//We can't keep a mob reference, that's a bad idea, so instead name+ref should suffice.
var/name_to_use = ismob(target) ? target.real_name : target.name
var/hash = md5(name_to_use + "\ref[target]")
//Just once!
targets |= hash
//Grab any viruses they have
if(iscarbon(target) && LAZYLEN(target.virus2.len))
LAZYINITLIST(viruses)
var/datum/disease2/disease/virus = pick(target.virus2.len)
viruses[hash] = virus.getcopy()
//Dirtiness should be very low if you're the first injectee. If you're spam-injecting 4 people in a row around you though,
//This gives the last one a 30% chance of infection.
var/infect_chance = dirtiness //Start with dirtiness
if(infect_chance <= 10 && (hash in targets)) //Extra fast uses on target is free
infect_chance = 0
infect_chance += (targets.len-1)*10 //Extra 10% per extra target
if(prob(infect_chance))
log_and_message_admins("[loc] infected [target]'s [eo.name] with \the [src].")
infect_limb(eo)
//75% chance to spread a virus if we have one
if(LAZYLEN(viruses) && prob(75))
var/old_hash = pick(viruses)
if(hash != old_hash) //Same virus you already had?
var/datum/disease2/disease/virus = viruses[old_hash]
infect_virus2(target,virus.getcopy())
if(!used)
START_PROCESSING(SSobj, src)
/obj/item/weapon/reagent_containers/syringe/proc/infect_limb(var/obj/item/organ/external/eo)
src = null
var/datum/weakref/limb_ref = WEAKREF(eo)
spawn(rand(5 MINUTES,10 MINUTES))
var/obj/item/organ/external/found_limb = limb_ref.resolve()
if(istype(found_limb))
eo.germ_level += INFECTION_LEVEL_ONE+30
//Allow for capped syringe mode
//Allow for capped syringes
/obj/item/weapon/reagent_containers/syringe/update_icon()
cut_overlays()
var/matrix/tf = matrix()
if(isstorage(loc))
tf.Turn(-90) //Vertical for storing compact-ly
tf.Translate(-3,0) //Could do this with pixel_x but let's just update the appearance once.
transform = tf
if(mode == SYRINGE_BROKEN)
icon_state = "broken"
return
if(mode == SYRINGE_CAPPED)
icon_state = "capped"
return
var/rounded_vol = round(reagents.total_volume, round(reagents.maximum_volume / 3))
if(reagents.total_volume)
filling = image(icon, src, "filler[rounded_vol]")
filling.color = reagents.get_color()
add_overlay(filling)
if(ismob(loc))
var/injoverlay
switch(mode)
if (SYRINGE_DRAW)
injoverlay = "draw"
if (SYRINGE_INJECT)
injoverlay = "inject"
add_overlay(injoverlay)
icon_state = "[rounded_vol]"
item_state = "syringe_[rounded_vol]"
#undef SYRINGE_DRAW
#undef SYRINGE_INJECT
#undef SYRINGE_BROKEN
#undef SYRINGE_CAPPED

View File

@@ -1,123 +0,0 @@
#define SYRINGE_CAPPED 10
/obj/item/weapon/reagent_containers/syringe
icon = 'icons/goonstation/objects/syringe_vr.dmi'
mode = SYRINGE_CAPPED //Override
var/used = FALSE
var/dirtiness = 0
var/list/targets
var/list/datum/disease2/disease/viruses
/obj/item/weapon/reagent_containers/syringe/Initialize()
. = ..()
update_icon()
/obj/item/weapon/reagent_containers/syringe/Destroy()
QDEL_LIST_NULL(viruses)
LAZYCLEARLIST(targets)
return ..()
/obj/item/weapon/reagent_containers/syringe/process()
dirtiness = min(dirtiness + targets.len,75)
if(dirtiness >= 75)
STOP_PROCESSING(SSobj, src)
return 1
/obj/item/weapon/reagent_containers/syringe/proc/dirty(var/mob/living/carbon/human/target, var/obj/item/organ/external/eo)
if(!ishuman(loc))
return //Avoid borg syringe problems.
LAZYINITLIST(targets)
//We can't keep a mob reference, that's a bad idea, so instead name+ref should suffice.
var/name_to_use = ismob(target) ? target.real_name : target.name
var/hash = md5(name_to_use + "\ref[target]")
//Just once!
targets |= hash
//Grab any viruses they have
if(iscarbon(target) && LAZYLEN(target.virus2.len))
LAZYINITLIST(viruses)
var/datum/disease2/disease/virus = pick(target.virus2.len)
viruses[hash] = virus.getcopy()
//Dirtiness should be very low if you're the first injectee. If you're spam-injecting 4 people in a row around you though,
//This gives the last one a 30% chance of infection.
var/infect_chance = dirtiness //Start with dirtiness
if(infect_chance <= 10 && (hash in targets)) //Extra fast uses on target is free
infect_chance = 0
infect_chance += (targets.len-1)*10 //Extra 10% per extra target
if(prob(infect_chance))
log_and_message_admins("[loc] infected [target]'s [eo.name] with \the [src].")
infect_limb(eo)
//75% chance to spread a virus if we have one
if(LAZYLEN(viruses) && prob(75))
var/old_hash = pick(viruses)
if(hash != old_hash) //Same virus you already had?
var/datum/disease2/disease/virus = viruses[old_hash]
infect_virus2(target,virus.getcopy())
if(!used)
START_PROCESSING(SSobj, src)
/obj/item/weapon/reagent_containers/syringe/proc/infect_limb(var/obj/item/organ/external/eo)
src = null
var/datum/weakref/limb_ref = WEAKREF(eo)
spawn(rand(5 MINUTES,10 MINUTES))
var/obj/item/organ/external/found_limb = limb_ref.resolve()
if(istype(found_limb))
eo.germ_level += INFECTION_LEVEL_ONE+30
//Allow for capped syringe mode
/obj/item/weapon/reagent_containers/syringe/attack_self(mob/user as mob)
switch(mode)
if(SYRINGE_CAPPED)
mode = SYRINGE_DRAW
// to_chat(user,"<span class='notice'>You uncap the syringe.</span>")
balloon_alert(user, "[src] uncapped") // CHOMPEdit - Changed to balloon_alert
if(SYRINGE_DRAW)
mode = SYRINGE_INJECT
if(SYRINGE_INJECT)
mode = SYRINGE_DRAW
if(SYRINGE_BROKEN)
return
update_icon()
//Allow for capped syringes
/obj/item/weapon/reagent_containers/syringe/update_icon()
cut_overlays()
var/matrix/tf = matrix()
if(isstorage(loc))
tf.Turn(-90) //Vertical for storing compact-ly
tf.Translate(-3,0) //Could do this with pixel_x but let's just update the appearance once.
transform = tf
if(mode == SYRINGE_BROKEN)
icon_state = "broken"
return
if(mode == SYRINGE_CAPPED)
icon_state = "capped"
return
var/rounded_vol = round(reagents.total_volume, round(reagents.maximum_volume / 3))
if(reagents.total_volume)
filling = image(icon, src, "filler[rounded_vol]")
filling.color = reagents.get_color()
add_overlay(filling)
if(ismob(loc))
var/injoverlay
switch(mode)
if (SYRINGE_DRAW)
injoverlay = "draw"
if (SYRINGE_INJECT)
injoverlay = "inject"
add_overlay(injoverlay)
icon_state = "[rounded_vol]"
item_state = "syringe_[rounded_vol]"
#undef SYRINGE_CAPPED

View File

@@ -156,6 +156,7 @@
..()
#define WATER_LATENT_HEAT 19000 // How much heat is removed when applied to a hot turf, in J/unit (19000 makes 120 u of water roughly equivalent to 4L)
/datum/reagent/water
name = "Water"
id = "water"
@@ -250,6 +251,8 @@
..()
//VOREStation Edit End,
#undef WATER_LATENT_HEAT
/datum/reagent/fuel
name = "Welding fuel"
id = "fuel"