Skip to content

Commit

Permalink
Fixed grass on the ground giving too much astroturf, cleaned up grass…
Browse files Browse the repository at this point in the history
… code.
  • Loading branch information
Cruix committed Nov 18, 2016
1 parent 0e5b69f commit 355133e
Showing 1 changed file with 20 additions and 33 deletions.
53 changes: 20 additions & 33 deletions code/modules/hydroponics/grown/grass_carpet.dm
Original file line number Diff line number Diff line change
Expand Up @@ -24,23 +24,28 @@
icon_state = "grassclump"
filling_color = "#32CD32"
bitesize_mod = 2
var/stacktype = /obj/item/stack/tile/grass
var/tile_coefficient = 0.02 // 1/50

/obj/item/weapon/reagent_containers/food/snacks/grown/grass/attack_self(mob/user)
user << "<span class='notice'>You prepare the astroturf.</span>"
var/grassAmt = 1 + round(seed.potency / 50) // The grass we're holding
var/grassAmt = 1 + round(seed.potency * tile_coefficient) // The grass we're holding
for(var/obj/item/weapon/reagent_containers/food/snacks/grown/grass/G in user.loc) // The grass on the floor
grassAmt += 1 + round(G.seed.potency)
if(G.type != type)
continue
grassAmt += 1 + round(G.seed.potency * tile_coefficient)
qdel(G)
while(grassAmt > 0)
var/obj/item/stack/tile/GT = new /obj/item/stack/tile/grass(user.loc)
if(grassAmt >= GT.max_amount)
GT.amount = GT.max_amount
else
GT.amount = grassAmt
for(var/obj/item/stack/tile/grass/GR in user.loc)
if(GR != GT && GR.amount < GR.max_amount)
GR.attackby(GT, user) //we try to transfer all old unfinished stacks to the new stack we created.
var/obj/item/stack/tile/GT = new stacktype(user.loc)
while(grassAmt > GT.max_amount)
GT.amount = GT.max_amount
grassAmt -= GT.max_amount
GT = new stacktype(user.loc)
GT.amount = grassAmt
for(var/obj/item/stack/tile/T in user.loc)
if((T.type == stacktype) && (T.amount < T.max_amount))
GT.merge(T)
if(GT.amount <= 0)
break
qdel(src)
return

Expand All @@ -51,31 +56,13 @@
icon_state = "seed-carpet"
species = "carpet"
plantname = "Carpet"
product = /obj/item/weapon/reagent_containers/food/snacks/grown/carpet
mutatelist = list(/obj/item/seeds/grass/carpet)
product = /obj/item/weapon/reagent_containers/food/snacks/grown/grass/carpet
mutatelist = list()
rarity = 10

/obj/item/weapon/reagent_containers/food/snacks/grown/carpet
/obj/item/weapon/reagent_containers/food/snacks/grown/grass/carpet
seed = /obj/item/seeds/grass/carpet
name = "carpet"
desc = "The textile industry's dark secret."
icon_state = "carpetclump"

/obj/item/weapon/reagent_containers/food/snacks/grown/carpet/attack_self(mob/user)
user << "<span class='notice'>You roll out the red carpet.</span>"
var/carpetAmt = 1 + round(seed.potency / 50) // The carpet we're holding
for(var/obj/item/weapon/reagent_containers/food/snacks/grown/carpet/C in user.loc) // The carpet on the floor
carpetAmt += 1 + round(C.seed.potency / 50)
qdel(C)
while(carpetAmt > 0)
var/obj/item/stack/tile/CT = new /obj/item/stack/tile/carpet(user.loc)
if(carpetAmt >= CT.max_amount)
CT.amount = CT.max_amount
else
CT.amount = carpetAmt
for(var/obj/item/stack/tile/carpet/CA in user.loc)
if(CA != CT && CA.amount < CA.max_amount)
CA.attackby(CT, user) //we try to transfer all old unfinished stacks to the new stack we created.
carpetAmt -= CT.max_amount
qdel(src)
return
stacktype = /obj/item/stack/tile/carpet

0 comments on commit 355133e

Please sign in to comment.