Nano-Mob Hunter GO! WIP commit 3: The committening

This commit is contained in:
FalseIncarnate
2016-09-06 04:15:44 -04:00
parent 42b6c73efa
commit cddc7cb340
15 changed files with 118 additions and 44 deletions
+3 -3
View File
@@ -90,7 +90,7 @@ var/global/obj/machinery/mob_hunt_server/mob_hunt_server = null
/obj/machinery/mob_hunt_server/proc/register_spawn(datum/mob_hunt/mob_info)
if(!mob_info)
return 0
var/obj/effect/nanomob/new_mob = new /obj/effect/nanomob(get_turf(src), mob_info)
var/obj/effect/nanomob/new_mob = new /obj/effect/nanomob(mob_info.spawn_point, mob_info)
normal_spawns += new_mob
return 1
@@ -98,8 +98,8 @@ var/global/obj/machinery/mob_hunt_server/mob_hunt_server = null
if(!mob_info)
return 0
if(!mob_info.is_trap)
return register_spawn()
var/obj/effect/nanomob/new_mob = new /obj/effect/nanomob(locate(mob_info.x_coord, mob_info.y_coord, STATION_LEVEL), mob_info)
return register_spawn(mob_info)
var/obj/effect/nanomob/new_mob = new /obj/effect/nanomob(mob_info.spawn_point, mob_info)
trap_spawns += new_mob
check_stability()
return 1
+21 -9
View File
@@ -2,8 +2,8 @@
/obj/effect/nanomob
name = "Nano-Mob Avatar" //will be overridden by the mob datum name value when created
desc = "A wild Nano-Mob appeared! Hit it with your PDA with the game open to attempt to capture it!"
alpha = 128
invisibility = 101 //normally invisible, this gets adjusted through the game's scanning
alpha = 128
anchored = 1 //just in case
density = 0
icon = 'icons/effects/mob_hunt.dmi'
@@ -17,28 +17,36 @@
qdel(src)
return
mob_info = new_info
update_self()
forceMove(mob_info.spawn_point)
if(!mob_info.is_trap)
addtimer(src, "despawn", mob_info.lifetime)
/obj/effect/nanomob/proc/update_self()
if(!mob_info)
return
name = mob_info.mob_name
desc = "A wild [name] (level [mob_info.level]) appeared! Hit it with your PDA with the game open to attempt to capture it!"
if(mob_info.is_shiny)
icon_state = mob_info.icon_state_shiny
else
icon_state = mob_info.icon_state_normal
var/turf/target_turf = locate(mob_info.x_coord, mob_info.y_coord, STATION_LEVEL)
forceMove(target_turf)
to_chat(world, "[name] located at ([x],[y],[z])")
if(!mob_info.is_trap)
addtimer(src, "despawn", mob_info.lifetime)
/obj/effect/nanomob/attackby(obj/item/O, mob/user)
if(invisibility) //no catching mobs you can't normally see!
return
if(istype(O, /obj/item/device/pda))
var/obj/item/device/pda/P = O
if(P.current_app && P.current_app == /datum/data/pda/app/mob_hunter_game)
if(P.current_app && istype(P.current_app, /datum/data/pda/app/mob_hunter_game))
attempt_capture(P)
return 1
/obj/effect/nanomob/hitby(obj/item/O)
if(invisibility) //no catching mobs you can't normally see!
return
if(istype(O, /obj/item/device/pda))
var/obj/item/device/pda/P = O
if(P.current_app && P.current_app == /datum/data/pda/app/mob_hunter_game)
if(P.current_app && istype(P.current_app, /datum/data/pda/app/mob_hunter_game))
attempt_capture(P)
return 1
@@ -52,7 +60,9 @@
O.show_message("[bicon(P)] No server connection. Capture aborted.")
return
if(mob_info.is_trap) //traps work even if you ran into them before
if(mob_info.is_trap) //traps work even if you ran into them before, which is why this is before the clients_encountered check
if(client.hacked) //hacked copies of the game (copies capable of setting traps) are protected from traps
return
if(istype(P.loc, /mob/living/carbon))
var/mob/living/carbon/C = P.loc
//Strike them down with a lightning bolt to complete the illusion (copied from the surge reagent overdose, probably could
@@ -97,6 +107,8 @@
/obj/effect/nanomob/proc/reveal()
if(invisibility == 101)
invisibility = 0
//density = 1
spawn(30)
if(src)
invisibility = 101
//density = 1
+1 -1
View File
@@ -28,7 +28,7 @@
/obj/item/weapon/nanomob_card/booster/New()
var/datum/mob_hunt/mob_info = pick(subtypesof(/datum/mob_hunt))
mob_data = new mob_info(0,0,0,1)
mob_data = new mob_info(0,null,1)
update_info()
//Booster Packs (Box of booster pack cards)
+19 -22
View File
@@ -41,8 +41,7 @@
var/list/turf_blacklist = list() //list of turfs this mob can NOT spawn on (such as wood floors)
var/list/area_whitelist = list() //list of areas this mob is more likely to spawn in (can be used to reinclude subtypes of blacklisted areas)
var/list/turf_whitelist = list() //list of turfs this mob is more likely to spawn on (can be used to reinclude subtypes of blacklisted turfs)
var/x_coord = 0 //gets set and sent to the game server to spawn its avatar (generated in select_spawn)
var/y_coord = 0 //gets set and sent to the game server to spawn its avatar (generated in select_spawn)
var/turf/spawn_point //gets set and sent to the game server to spawn its avatar (generated in select_spawn or assigned via set_trap)
var/lifetime = 6000 //number of deciseconds the mob will remain before despawning (REMEMBER: DECISECONDS! So 6000 is 600 seconds which is 10 minutes)
var/is_shiny = 0 //if this gets set at spawn (super rare), the mob is considered "shiny" and will use the shiny icon_state and holographic cards
@@ -52,29 +51,32 @@
var/is_trap = 0 //if this gets set, the mob is a booby-trap and will electrocute any players that dare attempt to catch it
/datum/mob_hunt/New(set_trap = 0, trap_x = 0, trap_y=0, no_register = 0)
level = rand(min_level, max_level)
health[2] = base_health + (level * health_multiplier)
/datum/mob_hunt/New(set_trap = 0, turf/trap_turf = null, no_register = 0)
if(set_trap)
level = max_level
is_trap = 1
spawn_point = trap_turf
else
level = rand(min_level, max_level)
if(prob(1) && prob(1))
is_shiny = 1
health[2] = base_health + (level * health_multiplier)
if(no_register) //for booster pack cards
return
if(mob_hunt_server)
if(set_trap)
is_trap = 1
x_coord = trap_x
y_coord = trap_y
mob_hunt_server.register_trap(src)
if(mob_hunt_server.register_trap(src))
return
else if(select_spawn())
mob_hunt_server.register_spawn(src)
else //if we aren't a trap and can't spawn, delete the datum to avoid buildups
qdel(src)
else
qdel(src)
if(mob_hunt_server.register_spawn(src))
return
qdel(src) //if you reach this, the datum is just pure clutter, so delete it
/datum/mob_hunt/proc/select_spawn()
var/list/possible_areas = list()
for(var/areapath in the_station_areas)
if(istype(areapath, /area/holodeck)) //don't allow holodeck areas as possible spawns since it will allow it to spawn in the holodeck rooms on z2 as well
continue
possible_areas += typesof(areapath)
for(var/areapath in area_blacklist)
possible_areas -= typesof(areapath)
@@ -84,7 +86,6 @@
log_admin("No possible areas to spawn [type] found. Possible code/mapping error?")
return 0
var/list/possible_turfs = list()
var/turf/T
while(possible_areas.len)
//randomly select an area from our possible_areas list to try spawning in, then remove it from possible_areas so it won't get picked over and over forever.
var/area/spawn_area = locate(pick_n_take(possible_areas))
@@ -104,17 +105,13 @@
if(!possible_turfs.len) //If we don't have any possible turfs, this attempt was a failure. Try again.
continue
//if we got this far, we're spawning on this attempt, hooray!
T = pickweight(possible_turfs)
x_coord = T.x
y_coord = T.y
spawn_point = pickweight(possible_turfs)
break
if(T)
to_chat(world, "DEBUGGING: [type] spawning at ([x_coord], [y_coord])")
return 1
else
if(!spawn_point)
//if we get to this, we failed every attempt to find a suitable turf for EVERY area in our list of possible areas. DAMN.
log_admin("No acceptable turfs to spawn [type] on could be located. Possible code/mapping error, or someone replaced/destroyed all the acceptable turf types?")
return 0
return 1
/datum/mob_hunt/proc/calc_dam_multiplier(datum/mob_type/attack_type)
if(!primary_type)
+6
View File
@@ -190,6 +190,12 @@ var/global/datum/prizes/global_prizes = new
typepath = /obj/item/weapon/spellbook/oneuse/fake_gib
cost = 100
/datum/prize_item/nanomob_booster
name = "Nano-Mob Hunter Trading Card Booster Pack"
desc = "Contains 6 random Nano-Mob Hunter Trading Cards. May contain a holographic card!"
typepath = /obj/item/weapon/storage/box/nanomob_booster_pack
cost = 100
/datum/prize_item/capgun
name = "Capgun Revolver"
desc = "Do you feel lucky... punk?"