Merge pull request #427 from Shadowfire117/master

Feeder
This commit is contained in:
Vollybally
2019-02-21 14:42:38 -05:00
committed by GitHub
6 changed files with 155 additions and 9 deletions
+127
View File
@@ -0,0 +1,127 @@
/obj/machinery/feeder
name = "\improper Feeder"
icon = 'icons/obj/feeder.dmi'
anchored = 0
density = 0
/obj/machinery/feeder/var/mob/living/carbon/human/attached = null
/obj/machinery/feeder/var/obj/item/weapon/reagent_containers/beaker = null
/obj/machinery/feeder/update_icon()
if(attached)
icon_state = "feeding"
else
icon_state = ""
overlays = null
if(beaker)
var/datum/reagents/reagents = beaker.reagents
if(reagents.total_volume)
var/image/filling = image('icons/obj/feeder.dmi', src, "reagent")
var/percent = round((reagents.total_volume / beaker.volume) * 100)
switch(percent)
if(0 to 9) filling.icon_state = "reagent0"
if(10 to 19) filling.icon_state = "reagent10"
if(20 to 44) filling.icon_state = "reagent20"
if(45 to 59) filling.icon_state = "reagent45"
if(60 to 74) filling.icon_state = "reagent60"
if(75 to 89) filling.icon_state = "reagent75"
if(90 to 94) filling.icon_state = "reagent90"
if(95 to INFINITY) filling.icon_state = "reagent100"
filling.icon += reagents.get_color()
overlays += filling
/obj/machinery/feeder/MouseDrop(over_object, src_location, over_location)
..()
if(!isliving(usr))
return
if(attached)
visible_message("The feeding tube is pulled out of [attached]")
attached = null
update_icon()
return
if(in_range(src, usr) && ishuman(over_object) && get_dist(over_object, src) <= 1)
visible_message("[usr] inserts the feeding tube into \the [over_object].")
attached = over_object
update_icon()
/obj/machinery/feeder/attackby(obj/item/weapon/W as obj, mob/user as mob)
if(istype(W, /obj/item/weapon/reagent_containers))
if(!isnull(beaker))
user << "There is already a reagent container inserted!"
return
user.drop_item()
W.loc = src
beaker = W
user << "You insert \the [W] into \the [src]."
update_icon()
return
if(istype(W, /obj/item/weapon/screwdriver))
playsound(src, W.usesound, 50, 1)
user << "<span class='notice'>You start to dismantle the feeder.</span>"
if(do_after(user, 15))
user << "<span class='notice'>You dismantle the feeder.</span>"
var/obj/item/stack/material/plastic/A = new /obj/item/stack/material/plastic(src.loc)
A.amount = 4
if(beaker)
beaker.loc = get_turf(src)
beaker = null
qdel(src)
return
else
return ..()
/obj/machinery/feeder/process()
set background = 1
if(attached)
if(!(get_dist(src, attached) <= 1 && isturf(attached.loc)))
visible_message("The tube is pulled out of [attached]")
attached = null
update_icon()
return
if(attached && beaker)
// Give food
if(beaker.volume > 0)
var/transfer_amount = 2
beaker.reagents.trans_to_mob(attached, transfer_amount, CHEM_INGEST)
update_icon()
/obj/machinery/feeder/attack_hand(mob/user as mob)
if(beaker)
beaker.loc = get_turf(src)
beaker = null
update_icon()
else
return ..()
/obj/machinery/feeder/examine(mob/user)
..(user)
if(!(user in view(2)) && user != src.loc) return
if(beaker)
if(beaker.reagents && beaker.reagents.reagent_list.len)
usr << "<span class='notice'>Inserted is \a [beaker] with [beaker.reagents.total_volume] units of liquid.</span>"
else
usr << "<span class='notice'>Inserted is an empty [beaker].</span>"
else
usr << "<span class='notice'>No container is inserted.</span>"
usr << "<span class='notice'>[attached ? attached : "No one"] is being feed by it.</span>"
/obj/machinery/feeder/CanPass(atom/movable/mover, turf/target, height = 0, air_group = 0)
if(height && istype(mover) && mover.checkpass(PASSTABLE)) //allow bullets, beams, thrown objects, mice, drones, and the like through.
return 1
return ..()
+23 -7
View File
@@ -516,57 +516,73 @@
if(0) //Plant cancer!
set_trait(TRAIT_ENDURANCE,get_trait(TRAIT_ENDURANCE)-rand(10,20),null,0)
source_turf.visible_message("<span class='danger'>\The [display_name] withers rapidly!</span>")
source_turf.visible_message("<span class='notice'>Mutation 0!</span>")
if(1)
set_trait(TRAIT_NUTRIENT_CONSUMPTION,get_trait(TRAIT_NUTRIENT_CONSUMPTION)+rand(-(degree*0.1),(degree*0.1)),5,0)
set_trait(TRAIT_WATER_CONSUMPTION, get_trait(TRAIT_WATER_CONSUMPTION) +rand(-degree,degree),50,0)
set_trait(TRAIT_JUICY, !get_trait(TRAIT_JUICY))
set_trait(TRAIT_STINGS, !get_trait(TRAIT_STINGS))
source_turf.visible_message("<span class='notice'>Mutation 1!</span>")
if(2)
set_trait(TRAIT_IDEAL_HEAT, get_trait(TRAIT_IDEAL_HEAT) + (rand(-5,5)*degree),800,70)
set_trait(TRAIT_HEAT_TOLERANCE, get_trait(TRAIT_HEAT_TOLERANCE) + (rand(-5,5)*degree),800,70)
set_trait(TRAIT_LOWKPA_TOLERANCE, get_trait(TRAIT_LOWKPA_TOLERANCE)+ (rand(-5,5)*degree),80,0)
set_trait(TRAIT_HIGHKPA_TOLERANCE, get_trait(TRAIT_HIGHKPA_TOLERANCE)+(rand(-5,5)*degree),500,110)
set_trait(TRAIT_EXPLOSIVE,1)
source_turf.visible_message("<span class='notice'>Mutation 2!</span>")
if(3)
set_trait(TRAIT_IDEAL_LIGHT, get_trait(TRAIT_IDEAL_LIGHT)+(rand(-1,1)*degree),30,0)
set_trait(TRAIT_LIGHT_TOLERANCE, get_trait(TRAIT_LIGHT_TOLERANCE)+(rand(-2,2)*degree),10,0)
source_turf.visible_message("<span class='notice'>Mutation 3!</span>")
if(4)
set_trait(TRAIT_TOXINS_TOLERANCE, get_trait(TRAIT_TOXINS_TOLERANCE)+(rand(-2,2)*degree),10,0)
source_turf.visible_message("<span class='notice'>Mutation 4!</span>")
if(5)
source_turf.visible_message("<span class='notice'>Mutation 5!</span>")
set_trait(TRAIT_WEED_TOLERANCE, get_trait(TRAIT_WEED_TOLERANCE)+(rand(-2,2)*degree),10, 0)
if(prob(degree*5))
if(prob(5))
set_trait(TRAIT_CARNIVOROUS, get_trait(TRAIT_CARNIVOROUS)+rand(-degree,degree),2, 0)
if(get_trait(TRAIT_CARNIVOROUS))
source_turf.visible_message("<span class='notice'>\The [display_name] shudders hungrily.</span>")
if(6)
source_turf.visible_message("<span class='notice'>Mutation 6!</span>")
set_trait(TRAIT_WEED_TOLERANCE, get_trait(TRAIT_WEED_TOLERANCE)+(rand(-2,2)*degree),10, 0)
if(prob(degree*5))
if(prob(5))
set_trait(TRAIT_PARASITE,!get_trait(TRAIT_PARASITE))
if(7)
source_turf.visible_message("<span class='notice'>Mutation 7!</span>")
if(get_trait(TRAIT_YIELD) != -1)
set_trait(TRAIT_YIELD, get_trait(TRAIT_YIELD)+(rand(-2,2)*degree),10,0)
if(8)
source_turf.visible_message("<span class='notice'>Mutation 8!</span>")
set_trait(TRAIT_ENDURANCE, get_trait(TRAIT_ENDURANCE)+(rand(-5,5)*degree),100,10)
set_trait(TRAIT_PRODUCTION, get_trait(TRAIT_PRODUCTION)+(rand(-1,1)*degree),10, 1)
set_trait(TRAIT_POTENCY, get_trait(TRAIT_POTENCY)+(rand(-20,20)*degree),200, 0)
if(prob(degree*5))
set_trait(TRAIT_POTENCY, get_trait(TRAIT_POTENCY)+(rand(-15,20)*degree),200, 0)
if(prob(5))
set_trait(TRAIT_SPREAD, get_trait(TRAIT_SPREAD)+rand(-1,1),2, 0)
source_turf.visible_message("<span class='notice'>\The [display_name] spasms visibly, shifting in the tray.</span>")
if(9)
source_turf.visible_message("<span class='notice'>Mutation 9!</span>")
set_trait(TRAIT_MATURATION, get_trait(TRAIT_MATURATION)+(rand(-1,1)*degree),30, 0)
if(prob(degree*5))
if(prob(5))
set_trait(TRAIT_HARVEST_REPEAT, !get_trait(TRAIT_HARVEST_REPEAT))
if(10)
if(prob(degree*2))
source_turf.visible_message("<span class='notice'>Mutation 10!</span>")
if(prob(10))
set_trait(TRAIT_BIOLUM, !get_trait(TRAIT_BIOLUM))
if(get_trait(TRAIT_BIOLUM))
source_turf.visible_message("<span class='notice'>\The [display_name] begins to glow!</span>")
if(prob(degree*2))
if(prob(25))
set_trait(TRAIT_BIOLUM_COLOUR,"#[get_random_colour(0,75,190)]")
source_turf.visible_message("<span class='notice'>\The [display_name]'s glow </span><font color='[get_trait(TRAIT_BIOLUM_COLOUR)]'>changes colour</font>!")
else
source_turf.visible_message("<span class='notice'>\The [display_name]'s glow dims...</span>")
if(prob(10))
set_trait(TRAIT_PRODUCES_POWER, 1)
source_turf.visible_message("<span class='notice'>We got power!</span>")
if(11)
source_turf.visible_message("<span class='notice'>Mutation 11!</span>")
set_trait(TRAIT_TELEPORTING,1)
return
+2 -1
View File
@@ -123,7 +123,8 @@
recipes += new/datum/stack_recipe("airtight plastic flaps", /obj/structure/plasticflaps/mining, 5, time = 25, one_per_turf = 1, on_floor = 1)
recipes += new/datum/stack_recipe("water-cooler", /obj/structure/reagent_dispensers/water_cooler, 4, time = 10, one_per_turf = 1, on_floor = 1)
recipes += new/datum/stack_recipe("lampshade", /obj/item/weapon/lampshade, 1, time = 1)
recipes += new/datum/stack_recipe("Feeder", /obj/machinery/feeder, 4, time = 20, one_per_turf = 1, on_floor = 1)
/material/wood/generate_recipes()
..()
recipes += new/datum/stack_recipe("oar", /obj/item/weapon/oar, 2, time = 30, supplied_material = "[name]")
@@ -44,7 +44,8 @@
/obj/machinery/smartfridge/,
/obj/machinery/biogenerator,
/obj/structure/frame,
/obj/machinery/radiocarbon_spectrometer
/obj/machinery/radiocarbon_spectrometer,
/obj/machinery/feeder
)
/obj/item/weapon/reagent_containers/glass/New()
Binary file not shown.

After

Width:  |  Height:  |  Size: 1.7 KiB

+1
View File
@@ -670,6 +670,7 @@
#include "code\game\machinery\doorbell_vr.dm"
#include "code\game\machinery\doppler_array.dm"
#include "code\game\machinery\exonet_node.dm"
#include "code\game\machinery\feeder.dm"
#include "code\game\machinery\flasher.dm"
#include "code\game\machinery\floodlight.dm"
#include "code\game\machinery\floor_light.dm"