Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Adds Gibtonite, the explosive ore! #2312

Merged
merged 4 commits into from
Jan 25, 2014
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
26 changes: 26 additions & 0 deletions code/game/objects/items/weapons/twohanded.dm
Original file line number Diff line number Diff line change
Expand Up @@ -115,6 +115,32 @@
if(!I) return 0
return I.IsShield()

///////////Two hand required objects///////////////
//This is for objects that require two hands to even pick up
/obj/item/weapon/twohanded/required/
w_class = 5.0

/obj/item/weapon/twohanded/required/attack_self()
return

/obj/item/weapon/twohanded/required/mob_can_equip(M as mob, slot)
if(wielded)
M << "<span class='warning'>[src.name] is too cumbersome to carry with anything but your hands!</span>"
return 0
return ..()

/obj/item/weapon/twohanded/required/attack_hand(mob/user)//Can't even pick it up without both hands empty
var/obj/item/weapon/twohanded/required/H = user.get_inactive_hand()
if(H != null)
user.visible_message("<span class='notice'>[src.name] is too cumbersome to carry in one hand!</span>")
return
var/obj/item/weapon/twohanded/offhand/O = new(user)
user.put_in_inactive_hand(O)
..()
wielded = 1


obj/item/weapon/twohanded/

/*
* Fireaxe
Expand Down
100 changes: 92 additions & 8 deletions code/modules/mining/mine_turfs.dm
Original file line number Diff line number Diff line change
Expand Up @@ -19,13 +19,12 @@
/turf/simulated/mineral/ex_act(severity)
switch(severity)
if(3.0)
return
if (prob(75))
src.gets_drilled()
if(2.0)
if (prob(70))
src.mineralAmt -= 1 //some of the stuff gets blown up
if (prob(90))
src.gets_drilled()
if(1.0)
src.mineralAmt -= 2 //some of the stuff gets blown up
src.gets_drilled()
return

Expand Down Expand Up @@ -63,7 +62,7 @@

/turf/simulated/mineral/random
name = "Mineral deposit"
var/mineralSpawnChanceList = list("Uranium" = 5, "Iron" = 50, "Diamond" = 1, "Gold" = 5, "Silver" = 5, "Plasma" = 25/*, "Adamantine" =5*/, "Cave" = 1)//Currently, Adamantine won't spawn as it has no uses. -Durandan
var/mineralSpawnChanceList = list("Uranium" = 5, "Iron" = 50, "Diamond" = 1, "Gold" = 5, "Silver" = 5, "Plasma" = 25, "Gibtonite" = 5/*, "Adamantine" =5*/, "Cave" = 1)//Currently, Adamantine won't spawn as it has no uses. -Durandan
var/mineralChance = 10 //means 10% chance of this plot changing to a mineral deposit

/turf/simulated/mineral/random/New()
Expand All @@ -88,7 +87,8 @@
M = new/turf/simulated/mineral/plasma(src)
if("Cave")
new/turf/simulated/floor/plating/asteroid/airless/cave(src)

if("Gibtonite")
M = new/turf/simulated/mineral/gibtonite(src)
/*if("Adamantine")
M = new/turf/simulated/mineral/adamantine(src)*/
if(M)
Expand All @@ -98,7 +98,7 @@

/turf/simulated/mineral/random/high_chance
mineralChance = 25
mineralSpawnChanceList = list("Uranium" = 10, "Iron" = 30, "Diamond" = 2, "Gold" = 10, "Silver" = 10, "Plasma" = 25)
mineralSpawnChanceList = list("Uranium" = 10, "Iron" = 30, "Diamond" = 2, "Gold" = 10, "Silver" = 10, "Plasma" = 25, "Gibtonite" = 8)

/turf/simulated/mineral/uranium
name = "Uranium deposit"
Expand Down Expand Up @@ -163,6 +163,87 @@
spreadChance = 0
spread = 0

////////////////////////////////Gibtonite
/turf/simulated/mineral/gibtonite
name = "Diamond deposit" //honk
icon_state = "rock_Diamond"
mineralName = "Gibtonite"
mineralAmt = 1
spreadChance = 0
spread = 1
var/det_time = 8 //Countdown till explosion, but also rewards the player for how close you were to detonation when you defuse it
var/stage = 0 //How far into the lifecycle of gibtonite we are, 0 is untouched, 1 is active and attempting to detonate, 2 is benign and ready for extraction
var/activated_ckey = null //These are to track who triggered the gibtonite deposit for logging purposes
var/activated_name = null

/turf/simulated/mineral/gibtonite/New()
det_time = rand(8,10) //So you don't know exactly when the hot potato will explode
..()

/turf/simulated/mineral/gibtonite/attackby(obj/item/I, mob/user)
if(istype(I, /obj/item/device/analyzer) && stage == 1)
user.visible_message("<span class='notice'>You use the analyzer to locate where to cut off the chain reaction and attempt to stop it...</span>")
defuse()
if(istype(I, /obj/item/weapon/pickaxe))
src.activated_ckey = "[user.ckey]"
src.activated_name = "[user.name]"
..()

/turf/simulated/mineral/gibtonite/proc/explosive_reaction()
if(stage == 0)
icon_state = "rock_Gibtonite_active"
name = "Gibtonite deposit"
desc = "An active gibtonite reserve. Run!"
stage = 1
visible_message("<span class='warning'>There was gibtonite inside! It's going to explode!</span>")
var/turf/bombturf = get_turf(src)
var/area/A = get_area(bombturf)
var/log_str = "[src.activated_ckey]<A HREF='?_src_=holder;adminmoreinfo=\ref[usr]'>?</A> [src.activated_name] has triggered a gibtonite deposit reaction <A HREF='?_src_=holder;adminplayerobservecoodjump=1;X=[bombturf.x];Y=[bombturf.y];Z=[bombturf.z]'>[A.name] (JMP)</a>."
log_game(log_str)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hyperlinks in the logs?
I remember there was issue by aran that they are bad

countdown()

/turf/simulated/mineral/gibtonite/proc/countdown()
spawn(0)
while(stage == 1 && det_time > 0 && mineralAmt >= 1)
det_time--
sleep(5)
if(stage == 1 && det_time <= 0 && mineralAmt >= 1)
var/turf/bombturf = get_turf(src)
mineralAmt = 0
explosion(bombturf,1,3,5, adminlog = 0)
if(stage == 0 || stage == 2)
return

/turf/simulated/mineral/gibtonite/proc/defuse()
if(stage == 1)
icon_state = "rock_Gibtonite"
desc = "An inactive gibtonite reserve. The ore can be extracted."
stage = 2
if(det_time < 0)
det_time = 0
visible_message("<span class='notice'>The chain reaction was stopped! The gibtonite had [src.det_time] reactions left till the explosion!</span>")

/turf/simulated/mineral/gibtonite/gets_drilled()
if(stage == 0 && mineralAmt >= 1) //Gibtonite deposit is activated
playsound(src,'sound/effects/hit_on_shattered_glass.ogg',50,1)
explosive_reaction()
return
if(stage == 1 && mineralAmt >= 1) //Gibtonite deposit goes kaboom
var/turf/bombturf = get_turf(src)
mineralAmt = 0
explosion(bombturf,1,2,5, adminlog = 0)
if(stage == 2) //Gibtonite deposit is now benign and extractable. Depending on how close you were to it blowing up before defusing, you get better quality ore.
var/obj/item/weapon/twohanded/required/gibtonite/G = new /obj/item/weapon/twohanded/required/gibtonite/(src)
if(det_time <= 0)
G.quality = 3
G.icon_state = "Gibtonite ore 3"
if(det_time >= 1 && det_time <= 2)
G.quality = 2
G.icon_state = "Gibtonite ore 2"
..()

////////////////////////////////End Gibtonite

/turf/simulated/floor/plating/asteroid/airless/cave
var/length = 100

Expand Down Expand Up @@ -350,7 +431,7 @@
if(3.0)
return
if(2.0)
if (prob(70))
if (prob(20))
src.gets_dug()
if(1.0)
src.gets_dug()
Expand Down Expand Up @@ -437,6 +518,9 @@
icon_state = "asteroid_dug"
return

/turf/simulated/floor/plating/asteroid/proc/countdown()//This is here to stop runtimes in the event that changeturf() causes asteroid plating to take gibtonite procs
return

/turf/proc/updateMineralOverlays()
src.overlays.Cut()

Expand Down
41 changes: 41 additions & 0 deletions code/modules/mining/ores_coins.dm
Original file line number Diff line number Diff line change
Expand Up @@ -60,10 +60,51 @@
desc = "Completely useless"
icon_state = "slag"

/obj/item/weapon/twohanded/required/gibtonite
name = "Gibtonite ore"
desc = "Extremely explosive if struck with mining equipment, Gibtonite is often used by miners to speed up their work by using it as a mining charge. This material is illegal to possess by unauthorized personnel under space law."
icon = 'icons/obj/mining.dmi'
icon_state = "Gibtonite ore"
item_state = "Gibtonite ore"
w_class = 4
throw_range = 0
anchored = 1 //Forces people to carry it by hand, no pulling!
var/primed = 0
var/det_time = 100
var/quality = 1 //How pure this gibtonite is, determines the explosion produced by it and is derived from the det_time of the rock wall it was taken from, higher value = better

/obj/item/weapon/twohanded/required/gibtonite/attackby(obj/item/I, mob/user)
if(istype(I, /obj/item/weapon/pickaxe) && !primed)
playsound(src,'sound/effects/hit_on_shattered_glass.ogg',50,1)
primed = 1
icon_state = "Gibtonite active"
user.visible_message("<span class='warning'>[user] strikes the [src], causing a chain reaction!</span>")
var/turf/bombturf = get_turf(src)
var/area/A = get_area(bombturf)
message_admins("[key_name(usr)]<A HREF='?_src_=holder;adminmoreinfo=\ref[usr]'>?</A> has triggered a [name] to detonate at <A HREF='?_src_=holder;adminplayerobservecoodjump=1;X=[bombturf.x];Y=[bombturf.y];Z=[bombturf.z]'>[A.name] (JMP)</a>.")
log_game("[key_name(usr)] has primed a [name] for detonation at [A.name]([bombturf.x],[bombturf.y],[bombturf.z])")
spawn(det_time)
if(primed)
if(quality == 3)
explosion(src.loc,2,4,9)
if(quality == 2)
explosion(src.loc,1,2,5)
if(quality == 1)
explosion(src.loc,-1,1,3)
del(src)
if(istype(I, /obj/item/device/analyzer) && primed)
primed = 0
user.visible_message("<span class='notice'>The chain reaction was stopped! ...The ore's quality went down.</span>")
icon_state = "Gibtonite ore"
quality = 1
..()

/obj/item/weapon/ore/New()
pixel_x = rand(0,16)-8
pixel_y = rand(0,8)-8

/obj/item/weapon/ore/ex_act()
return

/*****************************Coin********************************/

Expand Down
Binary file modified icons/mob/items_lefthand.dmi
Binary file not shown.
Binary file modified icons/mob/items_righthand.dmi
Binary file not shown.
Binary file modified icons/obj/mining.dmi
Binary file not shown.
Binary file modified icons/turf/walls.dmi
Binary file not shown.