Final tweaks to recipe availability and material inheritance.

This commit is contained in:
Zuhayr
2015-05-17 18:22:21 +09:30
parent ed34aa2466
commit 8ce787ef68
12 changed files with 151 additions and 108 deletions
+34 -37
View File
@@ -1,39 +1,49 @@
/obj/item/ashtray
var/global/list/ashtray_cache = list()
/obj/item/weapon/material/ashtray
name = "ashtray"
icon = 'icons/obj/objects.dmi'
icon_state = "blank"
var/max_butts = 0
var/material/material
force_divisor = 0.1
thrown_force_divisor = 0.1
var/image/base_image
var/max_butts = 10
/obj/item/ashtray/New(var/newloc, var/material_name)
..(newloc)
if(!material_name)
material_name = "plastic"
material = get_material_by_name(material_name)
/obj/item/weapon/material/ashtray/New(var/newloc, var/material_name)
..(newloc, material_name)
if(!material)
qdel(src)
return
name = "[material.display_name] ashtray"
max_butts = round(material.hardness/10) //This is arbitrary but whatever.
src.pixel_y = rand(-5, 5)
src.pixel_x = rand(-6, 6)
update_icon()
return
/obj/item/ashtray/update_icon()
/obj/item/weapon/material/ashtray/update_icon()
color = null
overlays.Cut()
var/image/I = image('icons/obj/objects.dmi',"ashtray")
I.color = material.icon_colour
overlays |= I
var/cache_key = "base-[material.name]"
if(!ashtray_cache[cache_key])
var/image/I = image('icons/obj/objects.dmi',"ashtray")
I.color = material.icon_colour
ashtray_cache[cache_key] = I
overlays |= ashtray_cache[cache_key]
if (contents.len == max_butts)
overlays |= image('icons/obj/objects.dmi',"ashtray_full")
if(!ashtray_cache["full"])
ashtray_cache["full"] = image('icons/obj/objects.dmi',"ashtray_full")
overlays |= ashtray_cache["full"]
desc = "It's stuffed full."
else if (contents.len > max_butts/2)
overlays |= image('icons/obj/objects.dmi',"ashtray_half")
if(!ashtray_cache["half"])
ashtray_cache["half"] = image('icons/obj/objects.dmi',"ashtray_half")
overlays |= ashtray_cache["half"]
desc = "It's half-filled."
else
desc = "An ashtray made of [material.display_name]."
/obj/item/ashtray/attackby(obj/item/weapon/W as obj, mob/user as mob)
/obj/item/weapon/material/ashtray/attackby(obj/item/weapon/W as obj, mob/user as mob)
if (health <= 0)
return
if (istype(W,/obj/item/weapon/cigbutt) || istype(W,/obj/item/clothing/mask/smokable/cigarette) || istype(W, /obj/item/weapon/flame/match))
@@ -52,6 +62,8 @@
cig.transfer_fingerprints_to(butt)
qdel(cig)
W = butt
spawn(1)
TemperatureAct(150)
else if (cig.lit == 0)
user << "You place [cig] in [src] without even smoking it. Why would you do that?"
@@ -67,44 +79,29 @@
die()
return
/obj/item/ashtray/throw_impact(atom/hit_atom)
/obj/item/weapon/material/ashtray/throw_impact(atom/hit_atom)
if (health > 0)
health = max(0,health - 3)
if (health < 1)
die()
return
if (contents.len)
src.visible_message("\red [src] slams into [hit_atom] spilling its contents!")
src.visible_message("<span class='danger'>\The [src] slams into [hit_atom], spilling its contents!</span>")
for (var/obj/item/clothing/mask/smokable/cigarette/O in contents)
O.loc = src.loc
update_icon()
return ..()
/obj/item/ashtray/proc/die()
/obj/item/weapon/material/ashtray/proc/die()
material.place_shard(get_turf(src))
qdel(src)
return
/obj/item/ashtray/plastic
max_butts = 14
health = 24
throwforce = 3
/obj/item/ashtray/plastic/New(var/newloc)
/obj/item/weapon/material/ashtray/plastic/New(var/newloc)
..(newloc, "plastic")
/obj/item/ashtray/bronze
max_butts = 10
health = 72
throwforce = 10
/obj/item/ashtray/bronze/New(var/newloc)
/obj/item/weapon/material/ashtray/bronze/New(var/newloc)
..(newloc, "gold") //placeholder
/obj/item/ashtray/glass
max_butts = 12
health = 12
throwforce = 6
/obj/item/ashtray/glass/New(var/newloc)
/obj/item/weapon/material/ashtray/glass/New(var/newloc)
..(newloc, "glass")
+1 -3
View File
@@ -147,13 +147,11 @@ var/last_chew = 0
if(istype(I, /obj/item/stack/rods))
var/obj/item/stack/rods/R = I
if (R.use(1))
var/obj/item/weapon/wirerod/W = new /obj/item/weapon/wirerod
var/obj/item/weapon/material/wirerod/W = new(get_turf(user))
user.put_in_hands(W)
user << "<span class='notice'>You wrap the cable restraint around the top of the rod.</span>"
qdel(src)
update_icon(user)
/obj/item/weapon/handcuffs/cyborg
dispenser = 1
@@ -1,40 +1,44 @@
/obj/item/butterflyconstruction
/obj/item/weapon/material/butterflyconstruction
name = "unfinished concealed knife"
desc = "An unfinished concealed knife, it looks like the screws need to be tightened."
icon = 'icons/obj/buildingobject.dmi'
icon_state = "butterflystep1"
force_divisor = 0.1
thrown_force_divisor = 0.1
/obj/item/butterflyconstruction/attackby(obj/item/W as obj, mob/user as mob)
/obj/item/weapon/material/butterflyconstruction/attackby(obj/item/W as obj, mob/user as mob)
if(istype(W,/obj/item/weapon/screwdriver))
user << "You finish the concealed blade weapon."
new /obj/item/weapon/material/butterfly(user.loc)
new /obj/item/weapon/material/butterfly(user.loc, material.name)
qdel(src)
return
/obj/item/butterflyblade
/obj/item/weapon/material/butterflyblade
name = "knife blade"
desc = "A knife blade. Unusable as a weapon without a grip."
icon = 'icons/obj/buildingobject.dmi'
icon_state = "butterfly2"
matter = list(DEFAULT_WALL_MATERIAL = 5000)
force_divisor = 0.1
thrown_force_divisor = 0.1
/obj/item/butterflyhandle
/obj/item/weapon/material/butterflyhandle
name = "concealed knife grip"
desc = "A plasteel grip with screw fittings for a blade."
icon = 'icons/obj/buildingobject.dmi'
icon_state = "butterfly1"
matter = list(DEFAULT_WALL_MATERIAL = 4000)
force_divisor = 0.1
thrown_force_divisor = 0.1
/obj/item/butterflyhandle/attackby(obj/item/W as obj, mob/user as mob)
if(istype(W,/obj/item/butterflyblade))
/obj/item/weapon/material/butterflyhandle/attackby(obj/item/W as obj, mob/user as mob)
if(istype(W,/obj/item/weapon/material/butterflyblade))
var/obj/item/weapon/material/butterflyblade/B = W
user << "You attach the two concealed blade parts."
new /obj/item/butterflyconstruction(user.loc)
new /obj/item/weapon/material/butterflyconstruction(user.loc, B.material.name)
qdel(W)
qdel(src)
return
update_icon(user)
/obj/item/weapon/wirerod
/obj/item/weapon/material/wirerod
name = "wired rod"
desc = "A rod with some wire wrapped around the top. It'd be easy to attach something to the top bit."
icon_state = "wiredrod"
@@ -44,25 +48,23 @@
throwforce = 10
w_class = 3
attack_verb = list("hit", "bludgeoned", "whacked", "bonked")
force_divisor = 0.1
thrown_force_divisor = 0.1
/obj/item/weapon/wirerod/attackby(var/obj/item/I, mob/user as mob)
/obj/item/weapon/material/wirerod/attackby(var/obj/item/I, mob/user as mob)
..()
var/obj/item/finished
if(istype(I, /obj/item/weapon/material/shard))
var/obj/item/weapon/material/twohanded/spear/S = new /obj/item/weapon/material/twohanded/spear
user.put_in_hands(S)
user << "<span class='notice'>You fasten the glass shard to the top of the rod with the cable.</span>"
qdel(I)
qdel(src)
update_icon(user)
var/obj/item/weapon/material/tmp_shard = I
finished = new /obj/item/weapon/material/twohanded/spear(get_turf(user), tmp_shard.material.name)
user << "<span class='notice'>You fasten \the [I] to the top of the rod with the cable.</span>"
else if(istype(I, /obj/item/weapon/wirecutters))
var/obj/item/weapon/melee/baton/cattleprod/P = new /obj/item/weapon/melee/baton/cattleprod
user.put_in_hands(P)
finished = new /obj/item/weapon/melee/baton/cattleprod(get_turf(user))
user << "<span class='notice'>You fasten the wirecutters to the top of the rod with the cable, prongs outward.</span>"
if(finished)
user.drop_from_inventory(src)
user.drop_from_inventory(I)
qdel(I)
qdel(src)
update_icon(user)
user.put_in_hands(finished)
update_icon(user)
@@ -52,14 +52,19 @@
if(!..())
return
if(!unbreakable)
if(!prob(material.hardness))
if(material.is_brittle())
health = 0
else if(!prob(material.hardness))
health--
if(health<=0)
shatter()
check_health()
/obj/item/weapon/material/proc/check_health()
if(health<=0)
shatter()
/obj/item/weapon/material/proc/shatter()
var/turf/T = get_turf(src)
T.visible_message("<span class='danger'>\The [src] shatters!</span>")
T.visible_message("<span class='danger'>\The [src] [material.destruction_desc]!</span>")
if(istype(loc, /mob/living))
var/mob/living/M = loc
M.drop_from_inventory(src)
@@ -71,4 +76,26 @@
if(!material.radioactivity)
return
for(var/mob/living/L in range(1,src))
L.apply_effect(round(material.radioactivity/3),IRRADIATE,0)
L.apply_effect(round(material.radioactivity/3),IRRADIATE,0)
/obj/item/weapon/material/fire_act(datum/gas_mixture/air, exposed_temperature, exposed_volume)
if(exposed_temperature > material.ignition_point)
TemperatureAct(exposed_temperature)
// This might need adjustment. Will work that out later.
/obj/item/weapon/material/proc/TemperatureAct(temperature)
if(temperature > material.ignition_point)
for(var/turf/simulated/floor/target_tile in range(2,loc))
var/phoronToDeduce = temperature/30
target_tile.assume_gas("phoron", phoronToDeduce, 200+T0C)
spawn (0) target_tile.hotspot_expose(temperature, 400)
health -= phoronToDeduce/100
check_health()
/obj/item/weapon/material/attackby(obj/item/weapon/W as obj, mob/user as mob)
if(istype(W,/obj/item/weapon/weldingtool))
var/obj/item/weapon/weldingtool/WT = W
if(material.ignition_point && WT.remove_fuel(0, user))
TemperatureAct(150)
else
return ..()
+3 -3
View File
@@ -163,9 +163,9 @@
prob(2);/obj/item/weapon/storage/pill_bottle/zoom,\
prob(5);/obj/item/weapon/contraband/poster,\
prob(2);/obj/item/weapon/material/butterfly,\
prob(3);/obj/item/butterflyblade,\
prob(3);/obj/item/butterflyhandle,\
prob(3);/obj/item/weapon/wirerod,\
prob(3);/obj/item/weapon/material/butterflyblade,\
prob(3);/obj/item/weapon/material/butterflyhandle,\
prob(3);/obj/item/weapon/material/wirerod,\
prob(1);/obj/item/weapon/material/butterfly/switchblade,\
prob(1);/obj/item/weapon/reagent_containers/syringe/drugs)
+10 -1
View File
@@ -41,9 +41,12 @@
opacity = 0
else
opacity = 1
if(material.products_need_process())
processing_objects |= src
update_nearby_tiles(need_rebuild=1)
/obj/structure/simple_door/Destroy()
processing_objects -= src
update_nearby_tiles()
..()
@@ -137,7 +140,7 @@
else if(istype(W,/obj/item/weapon/weldingtool))
var/obj/item/weapon/weldingtool/WT = W
if(material.ignition_point && WT.remove_fuel(0, user))
TemperatureAct(100)
TemperatureAct(150)
else
attack_hand(user)
return
@@ -165,6 +168,12 @@
CheckHardness()
return
/obj/structure/simple_door/process()
if(!material.radioactivity)
return
for(var/mob/living/L in range(1,src))
L.apply_effect(round(material.radioactivity/3),IRRADIATE,0)
/obj/structure/simple_door/iron/New(var/newloc,var/material_name)
..(newloc, "iron")